changeset 0:3e629dc19168

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:24:28 +0100
parents
children 5fe1e87ecf03
files AUTHORS BUGS CMakeLists.txt ChangeLog LICENSE Makefile.M Makefile.embedded Makefile.generic Nmakefile README ToDo autovar/LICENSE.txt autovar/README.txt autovar/autovar_ABI.h autovar/autovar_ARCH.h autovar/autovar_CC.h autovar/autovar_OS.h autovar/autovar_OSFAMILY.h buildsys/cmake/Modules/FindDynCall.cmake buildsys/cmake/Modules/FindDynCallback.cmake buildsys/cmake/Modules/FindDynLoad.cmake buildsys/cmake/Modules/UseLATEX.cmake buildsys/dynmake/Makefile.base.M buildsys/dynmake/dynmake.bat buildsys/dynmake/dynmake.sh buildsys/lua/Makefile buildsys/lua/README.txt buildsys/lua/bootstrap.sh buildsys/lua/cleanup.sh buildsys/lua/mkfile buildsys/lua/setenv.sh buildsys/mk/app.mk buildsys/mk/dirs.mk buildsys/mk/epilog.mk buildsys/mk/lib.mk buildsys/mk/pcc.mk buildsys/mk/prolog.mk buildsys/nmake/common.nmake buildsys/nmake/epilog.nmake buildsys/nmake/prolog.nmake buildsys/nmake/tool_gcc.nmake buildsys/nmake/tool_msvc.nmake buildsys/scripts/batch-build-linux.sh buildsys/scripts/batch-build-minix.sh buildsys/scripts/batch-build-psp.sh buildsys/scripts/conf-nds.bat buildsys/scripts/elf-to-psp-eboot.sh buildsys/scripts/setenv-cross-ios.sh buildsys/scripts/setenv-sdk-ios.sh buildsys/vs2005/dyncall/dyncall.vcproj buildsys/vs2005/test_plain/test_plain.vcproj buildsys/vs2005/vs2005.sln configure configure.bat configure.rc doc/Description.txt doc/License.txt doc/Makefile.generic doc/README-Cross.txt doc/README.CMake doc/README.Generic doc/README.MacOSX doc/README.Minix doc/README.NDS doc/README.PSP doc/README.SunOS doc/README.Windows doc/README.embedded doc/README.iOS doc/manual/CMakeLists.txt doc/manual/Makefile.generic doc/manual/Nmakefile doc/manual/callconvs/callconv_arm32.tex doc/manual/callconvs/callconv_arm64.tex doc/manual/callconvs/callconv_mips.tex doc/manual/callconvs/callconv_mips64.tex doc/manual/callconvs/callconv_ppc32.tex doc/manual/callconvs/callconv_ppc64.tex doc/manual/callconvs/callconv_sparc.tex doc/manual/callconvs/callconv_sparc64.tex doc/manual/callconvs/callconv_x64.tex doc/manual/callconvs/callconv_x86.tex doc/manual/dyncall_logo.eps doc/manual/dyncall_logo.pdf doc/manual/dyncall_logo.svg doc/manual/dyncall_watermark.eps doc/manual/dyncall_watermark.pdf doc/manual/dyncall_watermark.svg doc/manual/manual.tex doc/manual/manual_bindings.tex doc/manual/manual_build.tex doc/manual/manual_cc.tex doc/manual/manual_design.tex doc/manual/manual_devel.tex doc/manual/manual_dyncall_api.tex doc/manual/manual_dyncallback_api.tex doc/manual/manual_dynload_api.tex doc/manual/manual_epilog.tex doc/manual/manual_literature.tex doc/manual/manual_motivation.tex doc/manual/manual_overview.tex doc/manual/manual_tex4ht.cfg doc/manual/manual_title.tex dynMakefile dyncall/CMakeLists.txt dyncall/DynCallConfig.cmake dyncall/Makefile.M dyncall/Makefile.embedded dyncall/Makefile.generic dyncall/Nmakefile dyncall/README-Developer.txt dyncall/README.txt dyncall/TODO dyncall/dynMakefile dyncall/dyncall.3 dyncall/dyncall.h dyncall/dyncall_alloc.h dyncall/dyncall_api.c dyncall/dyncall_call.S dyncall/dyncall_call_arm32_arm.S dyncall/dyncall_call_arm32_arm.h dyncall/dyncall_call_arm32_arm_armhf.S dyncall/dyncall_call_arm32_arm_armhf.h dyncall/dyncall_call_arm32_thumb.h dyncall/dyncall_call_arm32_thumb_apple.s dyncall/dyncall_call_arm32_thumb_armhf.S dyncall/dyncall_call_arm32_thumb_gas.s dyncall/dyncall_call_arm64.S dyncall/dyncall_call_arm64.h dyncall/dyncall_call_mips.h dyncall/dyncall_call_mips_eabi.h dyncall/dyncall_call_mips_eabi_gas.s dyncall/dyncall_call_mips_gas.S dyncall/dyncall_call_mips_n32.h dyncall/dyncall_call_mips_n32_gas.s dyncall/dyncall_call_mips_n64.h dyncall/dyncall_call_mips_n64_gas.s dyncall/dyncall_call_mips_o32.h dyncall/dyncall_call_mips_o32_gas.s dyncall/dyncall_call_ppc32.S dyncall/dyncall_call_ppc32.h dyncall/dyncall_call_ppc64.S dyncall/dyncall_call_ppc64.h dyncall/dyncall_call_sparc.S dyncall/dyncall_call_sparc.h dyncall/dyncall_call_sparc64.S dyncall/dyncall_call_sparc64.h dyncall/dyncall_call_sparc_v9.S dyncall/dyncall_call_sparc_v9.h dyncall/dyncall_call_x64-att.S dyncall/dyncall_call_x64.S dyncall/dyncall_call_x64.h dyncall/dyncall_call_x64_generic_masm.asm dyncall/dyncall_call_x86.S dyncall/dyncall_call_x86.h dyncall/dyncall_call_x86_8a.s dyncall/dyncall_call_x86_generic_masm.asm dyncall/dyncall_call_x86_nasm.asm dyncall/dyncall_callf.c dyncall/dyncall_callf.h dyncall/dyncall_callvm.c dyncall/dyncall_callvm.h dyncall/dyncall_callvm_arm32_arm.c dyncall/dyncall_callvm_arm32_arm.h dyncall/dyncall_callvm_arm32_arm_armhf.c dyncall/dyncall_callvm_arm32_arm_armhf.h dyncall/dyncall_callvm_arm32_thumb.c dyncall/dyncall_callvm_arm32_thumb.h dyncall/dyncall_callvm_arm64.c dyncall/dyncall_callvm_arm64.h dyncall/dyncall_callvm_arm64_apple.c dyncall/dyncall_callvm_base.c dyncall/dyncall_callvm_mips.c dyncall/dyncall_callvm_mips.h dyncall/dyncall_callvm_mips_eabi.c dyncall/dyncall_callvm_mips_eabi.h dyncall/dyncall_callvm_mips_n32.c dyncall/dyncall_callvm_mips_n64.c dyncall/dyncall_callvm_mips_n64.h dyncall/dyncall_callvm_mips_o32.c dyncall/dyncall_callvm_mips_o32.h dyncall/dyncall_callvm_ppc32.c dyncall/dyncall_callvm_ppc32.h dyncall/dyncall_callvm_ppc64.c dyncall/dyncall_callvm_ppc64.h dyncall/dyncall_callvm_sparc.c dyncall/dyncall_callvm_sparc.h dyncall/dyncall_callvm_sparc64.c dyncall/dyncall_callvm_sparc64.h dyncall/dyncall_callvm_sparc_v9.c dyncall/dyncall_callvm_sparc_v9.h dyncall/dyncall_callvm_x64.c dyncall/dyncall_callvm_x64.h dyncall/dyncall_callvm_x86.c dyncall/dyncall_callvm_x86.h dyncall/dyncall_config.h dyncall/dyncall_macros.h dyncall/dyncall_signature.h dyncall/dyncall_struct.c dyncall/dyncall_struct.h dyncall/dyncall_types.h dyncall/dyncall_utils.h dyncall/dyncall_value.h dyncall/dyncall_vector.c dyncall/dyncall_vector.h dyncall/gen-masm.sh dyncall/mkfile dyncallback/CMakeLists.txt dyncallback/DynCallbackConfig.cmake dyncallback/Makefile.M dyncallback/Makefile.embedded dyncallback/Makefile.generic dyncallback/Nmakefile dyncallback/README.txt dyncallback/TODO dyncallback/dynMakefile dyncallback/dyncall_alloc_wx.c dyncallback/dyncall_alloc_wx.h dyncallback/dyncall_alloc_wx_malloc.c dyncallback/dyncall_alloc_wx_mmap.c dyncallback/dyncall_alloc_wx_win32.c dyncallback/dyncall_args.c dyncallback/dyncall_args.h dyncallback/dyncall_args_arm32_arm.c dyncallback/dyncall_args_arm32_arm.h dyncallback/dyncall_args_arm32_thumb.c dyncallback/dyncall_args_arm32_thumb.h dyncallback/dyncall_args_arm64.c dyncallback/dyncall_args_arm64_apple.c dyncallback/dyncall_args_mips.c dyncallback/dyncall_args_mips.h dyncallback/dyncall_args_ppc32.c dyncallback/dyncall_args_ppc32.h dyncallback/dyncall_args_ppc32_sysv.c dyncallback/dyncall_args_ppc64.c dyncallback/dyncall_args_ppc64.h dyncallback/dyncall_args_sparc32.c dyncallback/dyncall_args_sparc32.h dyncallback/dyncall_args_sparc64.c dyncallback/dyncall_args_sparc64.h dyncallback/dyncall_args_x64.c dyncallback/dyncall_args_x64.h dyncallback/dyncall_args_x86.c dyncallback/dyncall_args_x86.h dyncallback/dyncall_callback.c dyncallback/dyncall_callback.h dyncallback/dyncall_callback_arch.S dyncallback/dyncall_callback_arm32_arm.c dyncallback/dyncall_callback_arm32_arm.h dyncallback/dyncall_callback_arm32_arm_apple.s dyncallback/dyncall_callback_arm32_arm_gas.s dyncallback/dyncall_callback_arm32_thumb.c dyncallback/dyncall_callback_arm32_thumb.h dyncallback/dyncall_callback_arm32_thumb_apple.s dyncallback/dyncall_callback_arm32_thumb_gas.s dyncallback/dyncall_callback_arm64.c dyncallback/dyncall_callback_arm64.s dyncallback/dyncall_callback_mips.c dyncallback/dyncall_callback_mips.h dyncallback/dyncall_callback_ppc32.S dyncallback/dyncall_callback_ppc32.c dyncallback/dyncall_callback_ppc32.h dyncallback/dyncall_callback_ppc32_apple.s dyncallback/dyncall_callback_ppc64.S dyncallback/dyncall_callback_ppc64.c dyncallback/dyncall_callback_ppc64.h dyncallback/dyncall_callback_sparc32.c dyncallback/dyncall_callback_sparc32.h dyncallback/dyncall_callback_sparc32.s dyncallback/dyncall_callback_sparc64.c dyncallback/dyncall_callback_sparc64.s dyncallback/dyncall_callback_x64.S dyncallback/dyncall_callback_x64.c dyncallback/dyncall_callback_x64.h dyncallback/dyncall_callback_x64_masm.asm dyncallback/dyncall_callback_x86.S dyncallback/dyncall_callback_x86.c dyncallback/dyncall_callback_x86.h dyncallback/dyncall_callback_x86_8a.s dyncallback/dyncall_callback_x86_masm.asm dyncallback/dyncall_thunk.c dyncallback/dyncall_thunk.h dyncallback/dyncall_thunk_arm32_arm.c dyncallback/dyncall_thunk_arm32_arm.h dyncallback/dyncall_thunk_arm32_thumb.c dyncallback/dyncall_thunk_arm32_thumb.h dyncallback/dyncall_thunk_arm64.c dyncallback/dyncall_thunk_arm64.h dyncallback/dyncall_thunk_mips.c dyncallback/dyncall_thunk_mips.h dyncallback/dyncall_thunk_ppc32.c dyncallback/dyncall_thunk_ppc32.h dyncallback/dyncall_thunk_ppc32_sysv.c dyncallback/dyncall_thunk_ppc64.c dyncallback/dyncall_thunk_ppc64.h dyncallback/dyncall_thunk_sparc32.c dyncallback/dyncall_thunk_sparc32.h dyncallback/dyncall_thunk_sparc64.c dyncallback/dyncall_thunk_sparc64.h dyncallback/dyncall_thunk_x64.c dyncallback/dyncall_thunk_x64.h dyncallback/dyncall_thunk_x86.c dyncallback/dyncall_thunk_x86.h dyncallback/dyncallback.3 dyncallback/gen-masm.sh dyncallback/mkfile dynload/CMakeLists.txt dynload/DynLoadConfig.cmake dynload/Makefile.M dynload/Makefile.embedded dynload/Makefile.generic dynload/Nmakefile dynload/README.txt dynload/TODO dynload/dynMakefile dynload/dynload.3 dynload/dynload.c dynload/dynload.h dynload/dynload_alloc.h dynload/dynload_darwin.c dynload/dynload_syms.c dynload/dynload_syms_elf.c dynload/dynload_syms_mach-o.c dynload/dynload_syms_pe.c dynload/dynload_unix.c dynload/dynload_windows.c mkfile portasm/README.txt portasm/gen-masm.sh portasm/portasm-arm.S portasm/portasm-ppc.S portasm/portasm-x64-att.S portasm/portasm-x86.S test/CMakeLists.txt test/Makefile.M test/Makefile.embedded test/Makefile.generic test/Nmakefile test/arm-thumb-interwork/Makefile-default.config test/arm-thumb-interwork/Makefile-thumb.config test/arm-thumb-interwork/README.txt test/arm-thumb-interwork/build.sh test/call_suite/Makefile.M test/call_suite/Makefile.embedded test/call_suite/Makefile.generic test/call_suite/Nmakefile test/call_suite/README.txt test/call_suite/cases.c test/call_suite/cases.h test/call_suite/cases.txt test/call_suite/config.lua test/call_suite/design.txt test/call_suite/dynMakefile test/call_suite/globals.c test/call_suite/globals.h test/call_suite/invoke.c test/call_suite/main.c test/call_suite/mk-cases.lua test/call_suite/mkfile test/call_suite/rand-sig.lua test/callback_plain/CMakeLists.txt test/callback_plain/Makefile.M test/callback_plain/Makefile.embedded test/callback_plain/Makefile.generic test/callback_plain/Nmakefile test/callback_plain/callback_plain.c test/callback_plain/dynMakefile test/callback_plain/mkfile test/callback_suite/CMakeLists.txt test/callback_suite/Makefile.M test/callback_suite/Makefile.embedded test/callback_suite/Makefile.generic test/callback_suite/Nmakefile test/callback_suite/README.txt test/callback_suite/_auto_config.h test/callback_suite/_auto_invoke_macros.h test/callback_suite/_auto_invoke_table.h test/callback_suite/_auto_invokers.h test/callback_suite/_auto_signatures.txt test/callback_suite/_auto_sigstrings.h test/callback_suite/config-random.lua test/callback_suite/config-stress1.lua test/callback_suite/config.lua test/callback_suite/do_test.c test/callback_suite/dynMakefile test/callback_suite/dyncall_value_set.h test/callback_suite/env.c test/callback_suite/env.h test/callback_suite/handler.c test/callback_suite/invokers.c test/callback_suite/invokers.h test/callback_suite/main.c test/callback_suite/make-config.lua test/callback_suite/make-cstrings.lua test/callback_suite/make-invoke-macros.lua test/callback_suite/make-invoke-table.lua test/callback_suite/make-invokers.lua test/callback_suite/make-signatures.lua test/callback_suite/mkfile test/callback_suite/print.c test/callback_suite/print.h test/callback_suite/signature_utils.c test/callback_suite/signature_utils.h test/callback_suite/sigstrings.c test/callback_suite/sigstrings.h test/callback_suite/stress1.cfg test/callf/CMakeLists.txt test/callf/Makefile.M test/callf/Makefile.embedded test/callf/Makefile.generic test/callf/Nmakefile test/callf/dynMakefile test/callf/main.c test/callf/mkfile test/common/platformInit.c test/common/platformInit.h test/dynMakefile test/ellipsis/CMakeLists.txt test/ellipsis/Makefile.M test/ellipsis/Makefile.embedded test/ellipsis/Makefile.generic test/ellipsis/Nmakefile test/ellipsis/README.txt test/ellipsis/case.h test/ellipsis/config.h test/ellipsis/dynMakefile test/ellipsis/ellipsis.cc test/ellipsis/main.cc test/ellipsis/mkcase.py test/gen-masm/Makefile test/gen-masm/call_x64.S test/gen-masm/call_x64.masm test/gen-masm/call_x86.S test/gen-masm/call_x86.masm test/gen-masm/gen_masm.sh test/hacking-arm-thumb-interwork/Makefile test/hacking-arm-thumb-interwork/Makefile.darwin test/hacking-arm-thumb-interwork/Makefile.linux test/hacking-arm-thumb-interwork/README.txt test/hacking-arm-thumb-interwork/arm.c test/hacking-arm-thumb-interwork/diff-gcc-defs/Makefile test/hacking-arm-thumb-interwork/diff-gcc-defs/diff-generic.sh test/hacking-arm-thumb-interwork/diff-gcc-defs/empty.S test/hacking-arm-thumb-interwork/diff-gcc-defs/empty.c test/hacking-arm-thumb-interwork/test.c test/hacking-arm-thumb-interwork/thumb.c test/hacking-mips/Makefile test/hacking-mips/README.txt test/hacking-mips/call.c test/hacking-mips/calls.c test/hacking-mips/common.h test/hacking-mips/dispatch.c test/hacking-mips/f.c test/hacking-mips/f0.c test/hacking-mips/funs.c test/hacking-mips/main.c test/hacking-mips/node.c test/hacking-mips/prolog.c test/hacking-mips/retn.c test/makepkg.sh test/malloc_wx/CMakeLists.txt test/malloc_wx/Makefile.M test/malloc_wx/Makefile.embedded test/malloc_wx/Makefile.generic test/malloc_wx/Nmakefile test/malloc_wx/dynMakefile test/malloc_wx/mkfile test/malloc_wx/test_wx.c test/mkfile test/nm/CMakeLists.txt test/nm/Makefile.M test/nm/Makefile.embedded test/nm/Makefile.generic test/nm/Nmakefile test/nm/dynMakefile test/nm/nm.c test/pack-tests.sh test/plain/CMakeLists.txt test/plain/Makefile.M test/plain/Makefile.embedded test/plain/Makefile.generic test/plain/Nmakefile test/plain/dynMakefile test/plain/mkfile test/plain/test_framework.h test/plain/test_main.c test/plain/test_structs.c test/plain_c++/CMakeLists.txt test/plain_c++/Makefile.M test/plain_c++/Makefile.embedded test/plain_c++/Makefile.generic test/plain_c++/Nmakefile test/plain_c++/dynMakefile test/plain_c++/mkfile test/plain_c++/test_framework.h test/plain_c++/test_main.cc test/resolve_self/Makefile.M test/resolve_self/Makefile.embedded test/resolve_self/Makefile.generic test/resolve_self/Nmakefile test/resolve_self/README.txt test/resolve_self/dynMakefile test/resolve_self/main.c test/run-build.sh test/runalltests.bat test/runalltests.sh test/samples/calls/d16.c test/samples/calls/d20.c test/samples/calls/d40.c test/samples/calls/f16.c test/samples/calls/f20.c test/samples/calls/f40.c test/samples/calls/fd40.c test/samples/calls/i3.c test/samples/calls/i7.c test/samples/calls/id40.c test/samples/calls/l16.c test/samples/calls/many.c test/samples/composite/args.asm test/samples/composite/args.c test/samples/composite/args.s test/samples/composite/build.bat test/samples/composite/makefile test/sharedlib/CMakeLists.txt test/sharedlib/Makefile.embedded test/sharedlib/sharedlib.c test/sign/Makefile.generic test/sign/sign.c test/suite/CMakeLists.txt test/suite/Makefile.M test/suite/Makefile.embedded test/suite/Makefile.generic test/suite/Nmakefile test/suite/README.txt test/suite/case.c test/suite/case.h test/suite/config.h test/suite/dynMakefile test/suite/main.c test/suite/mkcase.py test/suite/mkfile test/suite2/CMakeLists.txt test/suite2/Makefile.M test/suite2/Makefile.embedded test/suite2/Makefile.generic test/suite2/Nmakefile test/suite2/case.cc test/suite2/case.h test/suite2/config.h test/suite2/design.cfg test/suite2/dynMakefile test/suite2/funcinfo.h test/suite2/ints.cfg test/suite2/main.cc test/suite2/mkcase.py test/suite2/rand.py test/suite2/stress1.cfg test/suite2_x86win32fast/CMakeLists.txt test/suite2_x86win32fast/Makefile.M test/suite2_x86win32fast/Makefile.generic test/suite2_x86win32fast/Nmakefile test/suite2_x86win32fast/case.cc test/suite2_x86win32fast/case.h test/suite2_x86win32fast/config.h test/suite2_x86win32fast/design.cfg test/suite2_x86win32fast/dynMakefile test/suite2_x86win32fast/funcinfo.h test/suite2_x86win32fast/main.cc test/suite2_x86win32fast/mkcase.py test/suite2_x86win32fast/rand.py test/suite2_x86win32std/CMakeLists.txt test/suite2_x86win32std/Makefile.M test/suite2_x86win32std/Makefile.generic test/suite2_x86win32std/Nmakefile test/suite2_x86win32std/case.cc test/suite2_x86win32std/case.h test/suite2_x86win32std/config.h test/suite2_x86win32std/design.cfg test/suite2_x86win32std/dynMakefile test/suite2_x86win32std/funcinfo.h test/suite2_x86win32std/main.cc test/suite2_x86win32std/mkcase.py test/suite2_x86win32std/rand.py test/suite3/CMakeLists.txt test/suite3/Makefile.M test/suite3/Makefile.embedded test/suite3/Makefile.generic test/suite3/Nmakefile test/suite3/README.txt test/suite3/case.cc test/suite3/case.h test/suite3/config.h test/suite3/dynMakefile test/suite3/main.cc test/suite3/mkcase.py test/suite_floats/CMakeLists.txt test/suite_floats/Makefile.M test/suite_floats/Makefile.embedded test/suite_floats/Makefile.generic test/suite_floats/Nmakefile test/suite_floats/README.txt test/suite_floats/case.cc test/suite_floats/case.h test/suite_floats/config.h test/suite_floats/dynMakefile test/suite_floats/main.cc test/suite_floats/mkcase.py test/suite_x86win32fast/CMakeLists.txt test/suite_x86win32fast/Makefile.M test/suite_x86win32fast/Makefile.generic test/suite_x86win32fast/Nmakefile test/suite_x86win32fast/README.txt test/suite_x86win32fast/case.cc test/suite_x86win32fast/case.h test/suite_x86win32fast/config.h test/suite_x86win32fast/dynMakefile test/suite_x86win32fast/main.cc test/suite_x86win32fast/mkcase.py test/suite_x86win32std/CMakeLists.txt test/suite_x86win32std/Makefile.M test/suite_x86win32std/Makefile.generic test/suite_x86win32std/Nmakefile test/suite_x86win32std/README.txt test/suite_x86win32std/case.cc test/suite_x86win32std/case.h test/suite_x86win32std/config.h test/suite_x86win32std/dynMakefile test/suite_x86win32std/main.cc test/suite_x86win32std/mkcase.py test/syscall/CMakeLists.txt test/syscall/Makefile.M test/syscall/Makefile.embedded test/syscall/Makefile.generic test/syscall/dynMakefile test/syscall/syscall.c test/thunk/CMakeLists.txt test/thunk/Makefile.M test/thunk/Makefile.embedded test/thunk/Makefile.generic test/thunk/Nmakefile test/thunk/dynMakefile test/thunk/mkfile test/thunk/test_thunk.c
diffstat 643 files changed, 50682 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AUTHORS	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,6 @@
+Daniel Adler <dadler@uni-goettingen.de>
+Tassilo Philipp <tphilipp@potion-studios.com>
+Olivier Chafik <olivier.chafik@gmail.com>
+Erik Mackdanz <erikmack@gmail.com>
+Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BUGS	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,4 @@
+- add support for SELinux; object files need to be tagged with section '.section .note.GNU-stack,"",%progbits'
+- dyncall sparc v7/v8: -xO3 on SunPro segfaults in tests.
+- dyncall sparc64 port: works fine on Debian 6, but has issues on OpenBSD and Solaris regarding passing of float and double values.
+- this BUGS file should be merged with ToDo or vice-versa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeLists.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,79 @@
+# Package: dyncall
+# File: CMakeLists.txt
+# Description: DynCall Project cmake files
+# License:
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>
+# 
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+cmake_minimum_required (VERSION 2.6)
+project(DynCall)
+
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "dyncall enables dynamic invocation of machine-level function calls")
+set(CPACK_PACKAGE_VENDOR "dyncall project")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/Description.txt")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/License.txt")
+if(APPLE)
+set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/doc/Description.txt")
+endif(APPLE)
+set(CPACK_PACKAGE_NAME "dyncall")
+include(CPack)
+
+# add cmake modules shipped with the package to cmake's module path.
+# currently we have no use for this, but maybe later..
+#set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildsys/cmake/Modules" "${CMAKE_MODULE_PATH}")
+
+
+if(MSVC)
+  enable_language(ASM_MASM)
+  #if(CMAKE_SIZEOF_VOID_P MATCHES 8)
+  #  set(CMAKE_ASM_COMPILER "ml64")
+  #else()
+  #  set(CMAKE_ASM_COMPILER "ml")
+  #endif()
+  #set(CMAKE_ASM_COMPILER_ARG1 "/c")
+  #set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS asm)
+  #set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
+elseif(CMAKE_COMPILER_IS_GNUCC)
+  # when used in shared libraries, -fPIC is required by several architectures
+  # and platforms (observed on AMD64, Solaris/Sparc).
+  # we enable it per default here.
+  add_definitions("-fPIC")
+  # enable gcc as front-end to assembler for .S files
+  set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
+  set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
+  enable_language(ASM)
+elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
+  set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
+  set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
+  enable_language(ASM)
+endif()
+
+
+add_subdirectory(dynload)
+add_subdirectory(dyncall)
+add_subdirectory(dyncallback)
+add_subdirectory(doc/manual EXCLUDE_FROM_ALL)
+add_subdirectory(test EXCLUDE_FROM_ALL)
+
+# install cmake Find scripts (disabled per default)
+
+option(INSTALL_CMAKE_MODULES "install cmake modules to locate dyncall" "NO")
+
+if(INSTALL_CMAKE_MODULES)
+file(GLOB INSTALL_CMAKE_MODULES_FILES buildsys/cmake/Modules/Find*.cmake)
+install(FILES ${INSTALL_CMAKE_MODULES_FILES} DESTINATION ${CMAKE_ROOT}/Modules)
+endif(INSTALL_CMAKE_MODULES)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ChangeLog	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,194 @@
+This file lists bigger/noteworthy changes, only...
+
+Version 0.9 (upcoming)
+dyncall:
+  o ARM64 support (AAPCS64 on Linux, Apple's derived version on iOS)
+  o PPC64 support (thanks Masanori!)
+  o introduced dcArgF and dcVArgF for flexible/convenient argument binding (works like dcCallF/dcVCallF but without the function call)
+  o added -fPIC by default for FreeBSD
+  o PPC32 linux syscall support
+dyncallback:
+  o ARM64 support (AAPCS64 on Linux, Apple's derived version on iOS)
+  o PPC64 support (thanks Masanori!)
+  o PPC32 System V support (Linux)
+  o fix for PPC32 Darwin/OS X
+  o more intuitive specification of callback return type
+doc:
+  o added ARM64 support info and calling convention documentation
+  o added PPC64 support info
+  o cleanup, brought all up to date, etc.
+tests:
+  o callf test covers new argf interface
+buildsys:
+  o more flexible testsuite build and 'pack' target for convenience
+  o fixes/additions for OS X universal builds
+  o added iOS universal build support for armv7/arm64
+  o helper script for generic .elf -> EBOOT.PBP creation for PSP
+  o Sun make fixes for C++ code in test suite
+bindings:
+  o erldc: Erlang binding (thanks Erik!)
+
+Version 0.8
+buildsys:
+  o big simplification make-based build system, no more distinct GNU and BSD makefiles anymore
+  o new, much simpler ./configure for new make-based build-system
+  o support for in-source and out-of-source builds for make-based build systems
+  o made configure.bat guess x64 as target arch for x64 windows hosts
+  o based more sources on portasm generation
+dyncall:
+  o fix for ARMv7 Thumb-2 code (tested on iPhone 4 CDMA / iOS 6.0.1)
+  o bugfixes for -O2 builds for SPARC-v9 and SPARC-v7 
+  o new optimized call kernel for SPARC-v9 without conditionals
+  o bigger refactoring and optimization of mips o32
+  o x64 optimizations
+dyncallback:
+  o added callback support for plan9
+  o big cleanup, removal of duplicate files after introduction of portasm
+  o include path fixes for public facing APIs (removed relative paths)
+doc:
+  o cleanup of manual and corrections
+  o added info about newly supported and/or tested platforms (e.g. FreeBSD on ARM)
+  o restructured folder layout for documentation
+  o added API doc for dyncallback and dynload
+  o added manpages for dyncallback and dynload
+tests:
+  o added arm/thumb interwork test suite
+bindings:
+  o godc: added bindings for Go
+  o rbdc: fixed and extended ruby bindings
+  o shdc: renamed shell binding to shdc and added feature to list shared-objects' symbols
+
+Version 0.7
+architecture:
+  o added subproject: portasm - portable (GNU AS,+Apple and MASM) assembly framework  
+  o added subproject: autovar - predefined macro framework (was dyncall_macros.h)
+  o added support for sparc (32-bit) (tested on linux/debian,openbsd,solaris)
+  o added support for sparc (64-bit) (tested on linux/debian,openbsd,solaris)
+  o added support for Solaris and SunPro compiler for i386, x86_64, sparc and sparc64
+  o improved auto-detection via preprocessor defines
+dyncall updates:
+  o uses portasm (GNU,Apple,Microsoft) common sources for x86,x64,ppc32,arm32_arm
+  o bug fixes for x64/win64 calling convention
+  o added support for mingw32-w64 on x64
+  o improved cdecl x86 calling convention: stack always 16 byte aligned
+  o updated API and initial support for structs (for x86/AMD64)
+  o initial support for syscalls on x86, added x86 int80h linux/bsd
+  o added Minix port (stable)
+  o optimized vector buffer for small type pushing
+  o minor fix for amd64/sysv: alignment to 32-byte
+  o bug fix for ppc32/sysv: ellipsis calls work now
+  o updated API, introduced DC_CALL_C_ELLIPSIS_VARARGS
+  o changed interface: dcMode does not reset internally anymore
+dyncallback updates:
+  o uses portasm for x86,x64
+  o added Solaris/x86/sunpro port (stable)
+  o added Minix port (unstable)
+  o callback support for Darwin/ppc32
+  o updates source, uses relative includes
+dynload updates:
+  o fixes for missing includes (dyncall_alloc.h)
+  o fixes for self-resolving symbols on windows
+  o removed Dbghelf.lib dependency
+  o bug fixes for cygwin/x86
+  o fixes for beos/haiku
+  o no dependencies to libdyncall sources.
+buildsys additions:
+  o added zero-config (BSD,GNU,SUN) make files (Makefile.embedded)
+  o added in/out-of-source configure2 w/ (BSD,GNU) make files (Makefile.generic')
+  o added bootstrap lua script (download/build) 
+  o Nmakefile: more tests included (resolve_self)
+  o improved cross-compilation for iOS (upgrade to 4.3 sdk)
+  o darwin 8.0 support
+  o added 'install' support for Makefile.embedded
+buildsys/gmake updates:
+  o added support for msvc/x64 tool-chain
+  o default settings for build-dir changed to '.'
+  o cleanup: removed top-level Make{Prolog,Epilog,Rules} files and updated all sub-projects and tests
+  o added support for DESTDIR staging installation
+  o added support for manual page installation
+buildsys/cmake updates:
+  o updated find module scripts (see cmake/Modules)
+  o added support for using dyncall as sub-project (via *Config.cmake files)
+    see details in README.CMake
+  o fixes for msvc and ml
+  o fixes for CPack
+  o fixes for universal builds on Mac OS X
+  o supports SunPro with *.S files.
+  o added experimental 'dynMake' portable make-based build-system (not stable, yet)
+documentation updates:
+  o added dyncallback documentation
+  o updated dyncall documentation 
+  o minor updates
+tests:
+  o added flexible test suite for calls (call_suite) based on Lua and C
+  o added syscall test
+  o updates to resolve-self test (adding additional link flags to export symbols)
+  o improved dir name portability (renamed plain_c++ -> plain_cxx) 
+  o renamed *.cpp -> *.cc files (OpenBSD/Sun make has no implicit rules for cpp)
+
+Version 0.6
+building:
+  o new build systems: CMake and Plan9's mk
+  o buildsys/gmake tool chain update: pcc and iphone sdk
+  o x64 bugfix: added "-fPIC" even for static libs
+dynload updates: 
+  o enum symbols update: Mach-O and Win64 (thanks Olivier)
+  o numerous convenience changes to dynload interface (thanks Olivier)
+  o added support for resolving application images itself
+dyncall updates:
+  o new platform support: arm/iphone (armv6), x86/Plan9
+  o new mips calling conventions: oabi, n64 (both endian models)
+  o cleanup: unexported functions in MASM files, b/c export not needed (thanks Olivier)
+  o interface update: added error reporting facility 'dcGetError'
+  o bugfix for ppc32/sysv: ellipsis calls were broken
+  o interface update: added new abstract mode for ellipsis calls (DC_CALL_C_ELLIPSIS) 
+docs:
+  o comprehensive update
+tests:
+  o plain: split "plain" test up in C and C++ part
+  o callbacksuite: added multiple configuration support for callback_suite
+
+Version 0.5
+  o renamed arm9 stuff to arm32
+  o added non-EABI ABI for arm32 (before, EABI was the default implementation)
+  o added dyncallback support for x64/windows (thanks Olivier), x64/darwin, arm32/arm, arm32/thumb
+  o synced documentation again with current state of the source (lots of small changes)
+  o updated ruby binding to current state of signature string (still some features missing, though)
+  o added a couple of new options to configure scripts (e.g. prefix-bd, new targets, etc.)
+  o darwin universal binary support
+  o added new tests callback_plain and calback_suite
+  o added Haiku/BeOS support
+
+Version 0.4
+  o added 'doc' makefile target for coherency and ease of use
+  o fixed nmake buildfiles and configure.bat (were out of date and wrong)
+  o test suite clean up (GNUmake, BSDmake):
+    target "config" modified, phony without dependencies to other builds
+  o bugfix: GNU fastcall calling convention for float and double arguments
+    was wrong. no skip of register.
+  o update: x86win32* suite tests are built on cygwin now, added total result output
+  o signature types change:
+    C Strings: 'S' -> 'Z'
+    long: 'l' -> 'j'
+    long long: 'L' -> 'l'
+    added unsigned integer type signature characters: upper case encoding  
+  o added: callbacks component (support only for some platforms ATM)
+  o added: test cases for alloc_wx, thunk
+  o updated Documentation
+
+Version 0.3
+  o added Linux PPC32 support
+  o added ARM THUMB mode support
+  o cosmetic changes, documentation updated
+  o bugfix: on cygwin exported C symbols in GNU as are prefixed with '_' now.
+  o removed scons build support
+
+Version 0.2
+  o added scons build support
+  o configure variables all prefix CONFIG_* now
+  o configure variable INSTALL_DIR changed to INSTALL_PREFIX
+  o configure (shell version) option "--prefix" changed to "--prefix=<path>"
+
+Version 0.1:
+  o initial release
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,18 @@
+If not stated otherwise inside a file, all files here are distributed in
+terms of:
+
+Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>, 
+                        Tassilo Philipp <tphilipp@potion-studios.com>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.M	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,15 @@
+#include "buildsys/dynmake/Makefile.base.M"
+
+all:
+	cd dyncall     _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)
+	cd dynload     _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)
+	cd dyncallback _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)
+
+clean:
+	cd dyncall     _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE) clean
+	cd dynload     _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE) clean
+	cd dyncallback _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE) clean
+
+tests:
+	cd test        _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.embedded	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,75 @@
+MAKEFILE = Makefile.embedded
+MAKE_CMD = ${MAKE} -f ${MAKEFILE} 
+all:
+	cd dynload && ${MAKE_CMD}
+	cd dyncall && ${MAKE_CMD}
+	cd dyncallback && ${MAKE_CMD}
+tests: 
+	cd test && ${MAKE_CMD} 
+clean:
+	cd dynload     && ${MAKE_CMD} clean
+	cd dyncall     && ${MAKE_CMD} clean
+	cd dyncallback && ${MAKE_CMD} clean
+	cd test        && ${MAKE_CMD} clean
+install:
+	cd dynload     && ${MAKE_CMD} install
+	cd dyncall     && ${MAKE_CMD} install
+	cd dyncallback && ${MAKE_CMD} install
+bsd:
+	${MAKE_CMD} all
+linux:
+	${MAKE_CMD} all
+linux64:
+	CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all
+minix-gcc:
+	cd dyncall	&& CC=gcc CFLAGS= ${MAKE_CMD} 
+	cd dyncallback	&& CC=gcc CFLAGS= ${MAKE_CMD} 
+mingw32:
+	${MAKE_CMD} CC=gcc AS="gcc -c" all
+osx:
+	${MAKE_CMD} all
+osx-universal:
+	CFLAGS="${CFLAGS} -arch i386 -arch x86_64 -arch ppc" ASFLAGS="${ASFLAGS} -arch i386 -arch x86_64 -arch ppc" AR="libtool" ARFLAGS="-static -o" ${MAKE_CMD} all
+osx-template:
+	CC="${CC} ${OSX_ARCH}" AS="${AS} ${OSX_ARCH}" ${MAKE_CMD}
+osx-i386:
+	OSX_ARCH="-arch i386" ${MAKE_CMD} osx-template
+sun:
+	CFLAGS="${CFLAGS}" ${MAKE_CMD} all
+sun-64bit:
+	CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all
+
+sun-gcc:
+	CC=gcc CFLAGS="${CFLAGS} -fPIC" ${MAKE_CMD} all
+sun-gcc-64bit:
+	CC=gcc CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all
+ios-sdkroot:
+	\
+  AS="${CC} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
+  CC="${CC} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
+  CXX="${CXX} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
+  LD="${LD} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
+  ASFLAGS="-isysroot ${IOS_SDKROOT}"\
+  CFLAGS="-isysroot ${IOS_SDKROOT}"\
+  CXXFLAGS="-isysroot ${IOS_SDKROOT}"\
+  LDFLAGS="-Wl,-syslibroot ${IOS_SDKROOT}"\
+  ${MAKE_CMD} all  
+ios:
+	IOS_SDKROOT="`xcode-select -print-path`/Platforms/iPhone${IOS_PLATFORM}.platform/Developer/SDKs/iPhone${IOS_PLATFORM}${IOS_SDK}.sdk" ${MAKE_CMD} ios-sdkroot
+ios-sim:
+	IOS_PLATFORM="Simulator" ${MAKE_CMD} ios
+ios-os:
+	IOS_PLATFORM="OS"        ${MAKE_CMD} ios
+# NOTE iOS 6.1 does not support armv6 (has no libs)
+ios61-os:
+	IOS_SDK="6.1" IOS_ARCH="-arch armv7"             ${MAKE_CMD} ios-os
+ios61-os-no-thumb:
+	IOS_SDK="6.1" IOS_ARCH="-arch armv7 -mno-thumb"  ${MAKE_CMD} ios-os
+ios61-sim:
+	IOS_SDK="6.1" IOS_ARCH="-arch i386"              ${MAKE_CMD} ios-sim
+ios83-os-universal:
+	IOS_SDK="8.3" IOS_ARCH="-arch armv7 -arch arm64" ${MAKE_CMD} ios-os
+ios83-sim:
+	IOS_SDK="8.3" IOS_ARCH="-arch i386"              ${MAKE_CMD} ios-sim
+
+.PHONY: all tests clean install bsd linux linux64 minix-gcc mingw32 osx osx-universal sun sun-64bit sun-gcc sun-gcc-64bit
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.generic	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,36 @@
+.PHONY: all clean install tests docs run-tests clean distclean libdyncall libdyncallback libdynload
+all: libdyncall libdyncallback libdynload
+install: all install-libdyncall install-libdyncallback install-libdynload
+libdyncall:
+	cd dyncall && ${MAKE} all
+libdyncallback:
+	cd dyncallback && ${MAKE} all
+libdynload:
+	cd dynload && ${MAKE} all
+install-libdyncall: libdyncall
+	cd dyncall && ${MAKE} install
+install-libdyncallback: libdyncallback
+	cd dyncallback && ${MAKE} install
+install-libdynload: libdynload
+	cd dynload && ${MAKE} install
+clean:
+	cd dyncall && ${MAKE} $@
+	cd dynload && ${MAKE} $@
+	cd dyncallback && ${MAKE} $@
+	cd test && ${MAKE} $@
+	cd doc && ${MAKE} $@
+tests: tests-libdyncall tests-libdyncallback tests-libdynload
+tests-libdyncall: libdyncall
+	cd test && ${MAKE} all-dyncall
+tests-libdyncallback: libdyncallback
+	cd test && ${MAKE} all-dyncallback
+tests-libdynload: libdynload
+	cd test && ${MAKE} all-dynload
+docs:
+	cd doc && ${MAKE} all
+run-tests: all
+	cd test && ${MAKE} $@
+distclean: clean
+	rm -f Makefile.config
+	find . -type f -name "Makefile.generic" | sed s/\.generic$$// | xargs rm
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Nmakefile	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,45 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	nmake makefile
+#	Nmakefile
+#
+#///////////////////////////////////////////////////
+
+
+TOP = .
+
+!INCLUDE $(TOP)\buildsys\nmake\prolog.nmake
+
+DIRS = dyncall dynload dyncallback
+
+tests: dummy 
+	!echo Building tests ... && cd test && $(MAKE) /NOLOGO /F Nmakefile && cd ..
+
+doc: dummy 
+	!echo Building documentation ... && cd $@/manual && $(MAKE) /NOLOGO /F Nmakefile && cd ..
+
+# Pseudo-targets are always out of date...
+dummy:
+
+
+!INCLUDE $(TOP)\buildsys\nmake\epilog.nmake
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,122 @@
+dyncall - A Generic Dynamic FFI package
+=======================================
+
+dyncall is a low-level toolkit providing a portable abstraction for 
+handling native code dynamically at run time.
+It comprises three independent components, available as C libraries, namely:
+
+ - 'dyncall' for making function calls,
+ - 'dyncallback' or writing generic callback handlers, and
+ - 'dynload' for loading code.
+
+The package provides abstractions to the Application Binary Interface 
+of various hardware platforms such as x86, AMD64, ARM32/64, PowerPCC32/64,
+MIPS32/64 and SPARC32/64.
+
+Our releases are thoroughly tested across all supported platforms using a
+flexible test suite.
+
+A typical application for the use of dyncall is the back-end of a FFI 
+(foreign function interface) for scripting languages to connect with 
+the C/C++ world.
+
+The binary footprint of the package is approx. 10-20 kb, depending on
+the platform.
+Besides the test suite already mentioned, comprehensive documentation is
+available.
+
+
+Building the libraries
+----------------------
+
+Prequisites: 
+ - C compiler such as gcc, clang, sunpro or msvc.
+ - Assembler such as gas (gnu/apple), fbe or masm.
+ - Build system such as 'shell/make', cmake, nmake (windows) or mk (plan9).
+
+
+Supported Architectures and ABIs:
+---------------------------------
+
+ - x86     32/64-bit  (cdecl, fastcall, stdcall, C++ this calls, syscalls, plan9)
+ - ARM     AArch32/64 (32: ARM/Thumb mode, v4t-v7, oabi/eabi, soft/hardfloat ABIs; 64: AAPCS64)
+ - MIPS    32/64-bit  (o32, n64, eabi)
+ - PowerPC 32/64-bit  (32: Mac OS X, System V; 64: System V little and big endian ELF ABI)
+ - Sparc   32/64-bit  (v7/8 and v9)
+
+NOTE: Callback support is currently available on
+      x86-32/64, arm32 softfloat ABIs, arm64, PPC64 and PPC32 Linux/OS X.
+
+Supported Operating Systems:
+----------------------------
+
+ - Android
+ - *BSD
+ - Haiku
+ - iOS
+ - Linux
+ - Mac OS X
+ - Microsoft Windows
+ - Minix
+ - Nintendo DS Homebrew
+ - Plan9 / 9front
+ - Playstation Portable Homebrew
+ - ReactOS
+ - Solaris
+
+
+Building the libraries
+----------------------
+
+Using configure shell script and GNU/BSD/Sun make system.
+
+$ ./configure
+$ make
+$ make install
+
+Testing:
+
+$ make tests
+$ make run-tests
+
+
+Build 'out-of-source'
+---------------------
+
+$ cd <build_dir>
+$ <src_dir>/configure --prefix=<install_dir>
+$ make
+$ sudo make install
+
+
+Building using CMake
+--------------------
+
+$ cmake 
+$ make
+$ sudo make install
+
+
+Building on Windows
+-------------------
+
+See doc/README.Windows
+
+
+Platform-specific build details
+-------------------------------
+
+See doc/README.*
+
+
+Building the manual
+-------------------
+
+Make sure pdflatex is installed and run
+
+$ make docs
+
+
+Please refer to http://www.dyncall.org, dyncall(3), dyncallback(3), the dyncall
+manual and platform-specific READMEs under doc/ for more information.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ToDo	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,130 @@
+1.0:
+----
+- autovar was never really pushed all the way through and still plays second
+  flute to dyncall_macros.h, clean this all up, eventually (Tassilo: for now, I
+  removed out of sync files to avoid confusion)
+- ppc32 callback fixes on bsd
+- make install should install manpages
+- mailing list announcements (html email?)
+- fix for NDS:
+    * ARM:
+      - callback_plain retval wrong (not only platform)
+    * THUMB:
+      - ellipsis (might be test itself, not respecting fixed part of args)
+      - retvals of call_suite (maybe all retvals, in general)
+      - callback_plain retval
+      - callf
+- fix Minix/x86 callbacks (see callback_suite)
+- fix Linux/rpi callbacks (call_suite)
+- armhf callback support
+
+build-system:
+-------------
+- cmake mac os x universal binary builds with *.S does not build 
+  multiple architectures
+
+portasm:
+--------
+- add solaris support for x64
+
+dyncall:
+--------
+- support for return values: aggregate return values
+- support for argument values: structures, half-precision, vector types, long double
+- varargs for mips (might exist, but test all ABIs)
+- consider automatic type-promotion for arguments passed through DC_CALL_C_ELLIPSIS_VARARGS;
+  this would make it easier to just pass arguments instead of having to know about the C
+  type promotions
+- syscalls for x64
+  * bsd
+  * linux
+- other syscalls
+
+dynload:
+--------
+- bug: test/nm crashes on qemu mips linux o32 debian etch
+- test/resolve_self crashes/asserts on windows and bsds
+- rename SymsInit to InitSyms and similar for cleanup function to reflect naming
+  in dyncall
+- get rid of Dl_info and friends (_GNU_SOURCE) in dynload/dynload_syms_elf.c
+  for implementation of dlSymsNameFromValue(..)
+- check if PSP can support dynload (missing elf.h, dlfcn.h, etc.); fixup readme if successful
+
+dyncallback:
+------------
+- callback_plain's return value not correct anymore on NDS (maybe just broken testcode?)
+- add MIPS callbacks for eabi, n32, o32 (thunks are working)
+- finish PPC32 callbacks (see bugs section, below)
+
+bindings:
+---------
+- release bindings as standalone packages (already done for rbdc as a gem and rdyncall on cran)
+  * add note to documentation, where bindings are and that some bindings are svn-only ATM
+- add rdoc documentation to ruby gem
+- bring python up to latest
+- add pydoc for python
+- add manpage for shdc
+- expose callf-convenience functions to go
+- add godoc for godc
+- bring java up to latest
+- add javadoc to java
+- add more bindings
+- add callback support for erlang, go, java, lua, python and ruby (and shell? how?)
+- add call-conv-mode-support for rbdc through signature
+
+manual:
+-------
+- finish tex4ht manual generation (use \ifhtml and \ifnhtml, ...)
+- provide more examples on how to use dyncall, dynload and dyncallback
+  * e.g. enhance manual with a couple of examples (e.g. calling MessageBoxA on windows, etc.)
+- manuals for bindings (as stated in bindings-section, above)
+
+urgent issues:
+--------------
+- finish SPARC/SPARC64 calling conventions in doc's callconv-appendix !!!
+- Haiku/gmake build doesn't build dynload due to the fact, that elf.h is not found
+  on default installations (one has to install the system headers)
+  * add to doc
+- Solaris/gmake build doesn't build dynload and tests anymore (maybe not even dyncallback)
+- test arm32/ATPCS/THUMB (and then change Status in doc Appendix)
+- look over code and fix TODO or @@@ marks
+- add ppc-support to doc (both, 32 and 64, as well as little and big endian remarks)
+
+nice to have:
+-------------
+- update: microsoft visual c++ build files - integrate all test suites in solution file
+- consistency: on x64 platforms: make both ABIs available ('win64','sysv') for all x64 OS ports
+- microsoft build enhancement: autodetect assembly via C preprocessor (like with .S gcc files)
+- test/thunk: some platforms do not allow for allocation of executable code on heap and stack -- 
+  currently this test will crash, maybe we should collect information which platforms allow and which not.
+
+bugs:
+-----
+- callbacks on ppc32 only work on linux and apple (osx abi), but not BSD
+- vararg function calls don't work for ARM THUMB mode (Daniel's new interface for modesetting for varag
+  args should be used); adapt test/ellipsis and/or retest
+
+missing implementations (descending priority):
+----------------------------------------------
+- riscv
+- itanium
+- 68k, 88k, 6502, etc.
+- alpha
+- superh
+- cell
+- blackfin
+- z80
+- hppa
+- vax
+- atmel avr
+- propeller
+- amd29k
+- arc
+- seaforth
+
+available exotic hardware for outstanding ports:
+------------------------------------------------
+- 68k: Tassilo's old Palm m100 (MC68EZ328 (16MHz))
+- sh4: Tassilo's Dreamcast
+- sigmatel stmp3550b: Daniel's iPod Nano
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/LICENSE.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,15 @@
+Copyright (c) 2011 Daniel Adler <dadler@uni-goettingen.de> 
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/README.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,69 @@
+autovar -- a small macro auto-detection library
+
+
+the following gives the list of variables available.
+for each variable, a separate header file is used.
+
+OS: Operating System
+ARCH: Architecture
+CC: C Compiler
+ABI: Application Binary Interface
+OSFAMILY: OS Roots
+
+
+the following gives the tree of variables
+
+OS: 
+  Win32
+  Win64
+  Darwin
+    IOS
+    MacOSX
+  Linux
+  FreeBSD
+  OpenBSD
+  NetBSD
+  DragonFlyBSD
+  SunOS
+  Cygwin
+  MinGW
+  NDS
+  PSP
+  BeOS
+  Plan9
+  VMS
+  Minix
+  Unknown
+
+ARCH:
+  X86
+  X64
+  IA64
+  PPC
+  PPC64
+  MIPS64
+  MIPS
+  ARM
+    THUMB
+  SH
+  SPARC64
+  SPARC
+
+ABI:
+  PE
+  Mach
+  ELF
+    ELF32
+    ELF64
+
+OSFAMILY: 
+  Windows
+  Unix
+
+CC:
+  INTEL
+  MSVC
+  GNU
+  WATCOM
+  PCC
+  SUN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/autovar_ABI.h	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,45 @@
+/*
+
+ Package: dyncall
+ Library: autovar
+ File: autovar/autovar_ABI.h
+ Description: 
+ License:
+
+   Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>,
+                           Tassilo Philipp <tphilipp@potion-studios.com>
+
+   Permission to use, copy, modify, and distribute this software for any
+   purpose with or without fee is hereby granted, provided that the above
+   copyright notice and this permission notice appear in all copies.
+
+   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*/
+
+#ifndef AUTOVAR_ABI_H
+#define AUTOVAR_ABI_H
+
+#include "autovar_OS.h"
+
+#if defined(OS_Win32) || defined(OS_Win64) || defined(OS_Cygwin) || defined(OS_MinGW)
+#define ABI_PE
+#elif defined(OS_Darwin)
+#define ABI_Mach
+#else
+#define ABI_ELF
+# if defined(__LP64__) || defined(_LP64)
+#   define ABI_ELF64
+# else
+#   define ABI_ELF32
+# endif
+#endif
+
+#endif /* AUTOVAR_ABI_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/autovar_ARCH.h	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,59 @@
+/*
+
+ Package: dyncall
+ Library: autovar
+ File: autovar/autovar_ARCH.h
+ Description: 
+ License:
+
+   Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>,
+                           Tassilo Philipp <tphilipp@potion-studios.com>
+
+   Permission to use, copy, modify, and distribute this software for any
+   purpose with or without fee is hereby granted, provided that the above
+   copyright notice and this permission notice appear in all copies.
+
+   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*/
+
+#ifndef AUTOVAR_ARCH_H
+#define AUTOVAR_ARCH_H
+
+/* Check architecture. */
+#if defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__386__) || defined(__i386)
+# define ARCH_X86
+#elif defined(_M_X64_) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) 
+# define ARCH_X64
+#elif defined(_M_IA64) || defined(__ia64__)
+# define ARCH_IA64
+#elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__ppc__) || defined(__power__)
+# if defined(__ppc64__) || defined(_ARCH_PPC64) || defined(__power64__) || defined(__powerpc64__)
+#   define ARCH_PPC64
+# else
+#   define ARCH_PPC
+# endif
+#elif defined(__mips64__) || defined(__mips64)
+# define ARCH_MIPS64
+#elif defined(_M_MRX000) || defined(__mips__) || defined(__mips) || defined(_mips)
+# define ARCH_MIPS
+#elif defined(__arm__)
+# define ARCH_ARM
+# if defined(__thumb__)
+#   define ARCH_THUMB
+# endif
+#elif defined(__sh__)
+# define ARCH_SH
+#elif defined(__sparcv9) || defined(__sparc64__) || ( defined(__sparc) && defined(__arch64__) ) 
+# define ARCH_SPARC64
+#elif defined(__sparc)
+# define ARCH_SPARC
+#endif
+
+#endif /* AUTOVAR_ARCH_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/autovar_CC.h	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,47 @@
+/*
+
+ Package: dyncall
+ Library: autovar
+ File: autovar/autovar_CC.h
+ Description: 
+ License:
+
+   Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>,
+                           Tassilo Philipp <tphilipp@potion-studios.com>
+
+   Permission to use, copy, modify, and distribute this software for any
+   purpose with or without fee is hereby granted, provided that the above
+   copyright notice and this permission notice appear in all copies.
+
+   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*/
+
+#ifndef AUTOVAR_CC_H
+#define AUTOVAR_CC_H
+
+/* Compiler specific defines. Do not change the order, because  */
+/* some of the compilers define flags for compatible ones, too. */
+
+#if defined(__INTEL_COMPILER)
+#define CC_INTEL
+#elif defined(_MSC_VER)
+#define CC_MSVC
+#elif defined(__GNUC__)
+#define CC_GNU
+#elif defined(__WATCOMC__)
+#define CC_WATCOM
+#elif defined(__PCC__)
+#define CC_PCC
+#elif defined(__SUNPRO_C)
+#define CC_SUN
+#endif
+
+#endif /* AUTOVAR_CC_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/autovar_OS.h	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,79 @@
+/*
+
+ Package: dyncall
+ Library: autovar
+ File: autovar/autovar_OS.h
+ Description: 
+ License:
+
+   Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>,
+                           Tassilo Philipp <tphilipp@potion-studios.com>
+
+   Permission to use, copy, modify, and distribute this software for any
+   purpose with or without fee is hereby granted, provided that the above
+   copyright notice and this permission notice appear in all copies.
+
+   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*/
+
+#ifndef AUTOVAR_OS_H
+#define AUTOVAR_OS_H
+
+#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
+#  define OS_Win64
+#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__WINDOWS__) || defined(_WINDOWS)
+#  define OS_Win32
+#elif defined(__APPLE__) || defined(__Darwin__)
+#  define OS_Darwin
+#  if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+#    define OS_IOS
+#  else /* defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) */
+#    define OS_MacOSX
+#  endif
+#elif defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
+#  define OS_Linux
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#  define OS_FreeBSD
+#elif defined(__OpenBSD__)
+#  define OS_OpenBSD
+#elif defined(__NetBSD__)
+#  define OS_NetBSD
+#elif defined(__DragonFly__)
+#  define OS_DragonFlyBSD
+#elif defined(__sun__) || defined(__sun) || defined(sun)
+#  define OS_SunOS
+#elif defined(__CYGWIN__)
+#  define OS_Cygwin
+#elif defined(__MINGW__)
+#  define OS_MinGW
+#elif defined(__nds__)
+#  define OS_NDS
+#elif defined(__psp__) || defined(PSP)
+#  define OS_PSP
+#elif defined(__HAIKU__) || defined(__BEOS__)
+#  define OS_BeOS
+#elif defined(Plan9) || defined(__Plan9__)
+#  define OS_Plan9
+#elif defined(__vms)
+#  define OS_VMS
+#elif defined(__minix)
+#  define OS_Minix
+#else
+#  define OS_Unknown
+#endif
+
+/** Platforms. */
+
+#if defined(__ANDROID__)
+#  define OS_Android
+#endif
+
+#endif /* AUTOVAR_OS */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autovar/autovar_OSFAMILY.h	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,40 @@
+/*
+
+ Package: dyncall
+ Library: autovar
+ File: autovar/autovar_OSFAMILY.h
+ Description: 
+ License:
+
+   Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>,
+                           Tassilo Philipp <tphilipp@potion-studios.com>
+
+   Permission to use, copy, modify, and distribute this software for any
+   purpose with or without fee is hereby granted, provided that the above
+   copyright notice and this permission notice appear in all copies.
+
+   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*/
+
+#ifndef AUTOVAR_OSFAMILY_H
+#define AUTOVAR_OSFAMILY_H
+
+#include "autovar_OS.h"
+
+#if defined(OS_Win32) || defined(OS_Win64)
+#define OSFAMILY_Windows
+#elif defined(OS_NDS) || defined(OS_PSP)
+#define OSFAMILY_GameConsole
+#else
+#define OSFAMILY_Unix
+#endif
+
+#endif /* AUTOVAR_OSFAMILY_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/cmake/Modules/FindDynCall.cmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,43 @@
+# - Try to find dyncall library
+#
+#   The following variables will be defined:
+#
+#     DYNCALL_FOUND
+#     DYNCALL_INCLUDE_DIRS
+#     DYNCALL_LIBRARIES
+#
+# ----------------------------------------------------------------------------
+#
+# Package: dyncall
+# File: buildsys/cmake/Modules/CMakeLists.txt
+# Description: CMake Module to find DynCall library
+# License:
+#
+# Copyright (c) 2010,2011 Daniel Adler <dadler@uni-goettingen.de>
+# 
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+find_path(DYNCALL_INCLUDE_DIR NAMES dyncall.h)
+find_library(DYNCALL_LIBRARY dyncall_s)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DynCall DEFAULT_MSG DYNCALL_LIBRARY DYNCALL_INCLUDE_DIR)
+
+if(DYNCALL_FOUND)
+  set(DYNCALL_INCLUDE_DIRS ${DYNCALL_INCLUDE_DIR})
+  set(DYNCALL_LIBRARIES ${DYNCALL_LIBRARY})
+endif(DYNCALL_FOUND)
+
+mark_as_advanced(DYNCALL_INCLUDE_DIR DYNCALL_LIBRARY)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/cmake/Modules/FindDynCallback.cmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,43 @@
+# - Try to find DynLoad library
+#
+#   The following variables will be defined:
+# 
+#     DYNCALLBACK_FOUND
+#     DYNCALLBACK_INCLUDE_DIRS
+#     DYNCALLBACK_LIBRARIES
+#
+# ----------------------------------------------------------------------------
+#
+# Package: dyncall
+# File: buildsys/cmake/Modules/FindDynLoad.cmake
+# Description: CMake Module to find dynload library
+# License:
+#
+# Copyright (c) 2010,2011 Daniel Adler <dadler@uni-goettingen.de>
+# 
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+find_path(DYNCALLBACK_INCLUDE_DIR NAMES dyncall_callback.h)
+find_library(DYNCALLBACK_LIBRARY dyncallback_s)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DynCallback DEFAULT_MSG DYNCALLBACK_LIBRARY DYNCALLBACK_INCLUDE_DIR)
+
+if(DYNCALLBACK_FOUND)
+  set(DYNCALLBACK_INCLUDE_DIRS ${DYNCALLBACK_INCLUDE_DIR})
+  set(DYNCALLBACK_LIBRARIES ${DYNCALLBACK_LIBRARY})
+endif(DYNCALLBACK_FOUND)
+
+mark_as_advanced(DYNCALLBACK_INCLUDE_DIR DYNCALLBACK_LIBRARY)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/cmake/Modules/FindDynLoad.cmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,45 @@
+# - Try to find dynload library
+#
+#   The following variables will be defined:
+#
+#     DYNLOAD_FOUND
+#     DYNLOAD_INCLUDE_DIRS
+#     DYNLOAD_LIBRARIES
+#
+# ----------------------------------------------------------------------------
+#
+# Package: dyncall
+# File: buildsys/cmake/Modules/FindDynLoad.cmake
+# Description: CMake Module to find dynload library
+# License:
+#
+# Copyright (c) 2010-2011 Daniel Adler <dadler@uni-goettingen.de>
+# 
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+find_path(DYNLOAD_INCLUDE_DIR NAMES dynload.h)
+find_library(DYNLOAD_LIBRARY dynload_s)
+
+mark_as_advanced(DYNLOAD_INCLUDE_DIR DYNLOAD_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DynLoad DEFAULT_MSG DYNLOAD_LIBRARY DYNLOAD_INCLUDE_DIR)
+
+if(DYNLOAD_FOUND)
+  set(DYNLOAD_INCLUDE_DIRS ${DYNLOAD_INCLUDE_DIR})
+  set(DYNLOAD_LIBRARIES ${DYNLOAD_LIBRARY})
+endif(DYNLOAD_FOUND)
+
+mark_as_advanced(DYNLOAD_INCLUDE_DIR DYNLOAD_LIBRARY)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/cmake/Modules/UseLATEX.cmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,811 @@
+# File: UseLATEX.cmake
+# CMAKE commands to actually use the LaTeX compiler
+# Version: 1.7.2
+# Author: Kenneth Moreland (kmorel at sandia dot gov)
+#
+# Copyright 2004 Sandia Corporation.
+# Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
+# license for use of this work by or on behalf of the
+# U.S. Government. Redistribution and use in source and binary forms, with
+# or without modification, are permitted provided that this Notice and any
+# statement of authorship are reproduced on all copies.
+#
+# The following MACROS are defined:
+#
+# ADD_LATEX_DOCUMENT(<tex_file>
+#                       [BIBFILES <bib_files>]
+#                       [INPUTS <input_tex_files>]
+#                       [IMAGE_DIRS] <image_directories>
+#                       [IMAGES] <image_files>
+#                       [CONFIGURE] <tex_files>
+#                       [DEPENDS] <tex_files>
+#                       [USE_INDEX] [USE_GLOSSARY]
+#                       [DEFAULT_PDF] [MANGLE_TARGET_NAMES])
+#       Adds targets that compile <tex_file>.  The latex output is placed
+#       in LATEX_OUTPUT_PATH or CMAKE_CURRENT_BINARY_DIR if the former is
+#       not set.  The latex program is picky about where files are located,
+#       so all input files are copied from the source directory to the
+#       output directory.  This includes the target tex file, any tex file
+#       listed with the INPUTS option, the bibliography files listed with
+#       the BIBFILES option, and any .cls, .bst, and .clo files found in
+#       the current source directory.  Images found in the IMAGE_DIRS
+#       directories or listed by IMAGES are also copied to the output
+#       directory and coverted to an appropriate format if necessary.  Any
+#       tex files also listed with the CONFIGURE option are also processed
+#       with the CMake CONFIGURE_FILE command (with the @ONLY flag.  Any
+#       file listed in CONFIGURE but not the target tex file or listed with
+#       INPUTS has no effect. DEPENDS can be used to specify generated files
+#       that are needed to compile the latex target.
+#
+#       The following targets are made:
+#               dvi: Makes <name>.dvi
+#               pdf: Makes <name>.pdf using pdflatex.
+#               safepdf: Makes <name>.pdf using ps2pdf.  If using the default
+#                       program arguments, this will ensure all fonts are
+#                       embedded and no lossy compression has been performed
+#                       on images.
+#               ps: Makes <name>.ps
+#               html: Makes <name>.html
+#               auxclean: Deletes <name>.aux.  This is sometimes necessary
+#                       if a LaTeX error occurs and writes a bad aux file.
+#
+#       The dvi target is added to the ALL.  That is, it will be the target
+#       built by default.  If the DEFAULT_PDF argument is given, then the
+#       pdf target will be the default instead of dvi.
+#
+#       If the argument MANGLE_TARGET_NAMES is given, then each of the
+#       target names above will be mangled with the <tex_file> name.  This
+#       is to make the targets unique if ADD_LATEX_DOCUMENT is called for
+#       multiple documents.  If the argument USE_INDEX is given, then
+#       commands to build an index are made.  If the argument USE_GLOSSARY
+#       is given, then commands to build a glossary are made.
+#
+# History:
+#
+# 1.7.2 Use ps2pdf to convert eps to pdf to get around the problem with
+#       ImageMagick dropping the bounding box (thanks to Lukasz Lis).
+#
+# 1.7.1 Fixed some dependency issues.
+#
+# 1.7.0 Added DEPENDS options (thanks to Theodore Papadopoulo).
+#
+# 1.6.1 Ported the makeglossaries command to CMake and embedded the port
+#       into UseLATEX.cmake.
+#
+# 1.6.0 Allow the use of the makeglossaries command.  Thanks to Oystein
+#       S. Haaland for the patch.
+#
+# 1.5.0 Allow any type of file in the INPUTS lists, not just tex file
+#       (suggested by Eric Noulard).  As a consequence, the ability to
+#       specify tex files without the .tex extension is removed.  The removed
+#       function is of dubious value anyway.
+#
+#       When copying input files, skip over any file that exists in the
+#       binary directory but does not exist in the source directory with the
+#       assumption that these files were added by some other mechanism.  I
+#       find this useful when creating large documents with multiple
+#       chapters that I want to build separately (for speed) as I work on
+#       them.  I use the same boilerplate as the starting point for all
+#       and just copy it with different configurations.  This was what the
+#       separate ADD_LATEX_DOCUMENT method was supposed to originally be for.
+#       Since its external use is pretty much deprecated, I removed that
+#       documentation.
+#
+# 1.4.1 Copy .sty files along with the other class and package files.
+#
+# 1.4.0 Added a MANGLE_TARGET_NAMES option that will mangle the target names.
+#
+#       Fixed problem with copying bib files that became apparent with
+#       CMake 2.4.
+#
+# 1.3.0 Added a LATEX_OUTPUT_PATH variable that allows you or the user to
+#       specify where the built latex documents to go.  This is especially
+#       handy if you want to do in-source builds.
+#
+#       Removed the ADD_LATEX_IMAGES macro and absorbed the functionality
+#       into ADD_LATEX_DOCUMENT.  The old interface was always kind of
+#       clunky anyway since you had to specify the image directory in both
+#       places.  It also made supporting LATEX_OUTPUT_PATH problematic.
+#
+#       Added support for jpeg files.
+#
+# 1.2.0 Changed the configuration options yet again.  Removed the NO_CONFIGURE
+#       Replaced it with a CONFIGURE option that lists input files for which
+#       configure should be run.
+#
+#       The pdf target no longer depends on the dvi target.  This allows you
+#       to build latex documents that require pdflatex.  Also added an option
+#       to make the pdf target the default one.
+#
+# 1.1.1 Added the NO_CONFIGURE option.  The @ character can be used when
+#       specifying table column separators.  If two or more are used, then
+#       will incorrectly substitute them.
+#
+# 1.1.0 Added ability include multiple bib files.  Added ability to do copy
+#       sub-tex files for multipart tex files.
+#
+# 1.0.0 If both ps and pdf type images exist, just copy the one that
+#       matches the current render mode.  Replaced a bunch of STRING
+#       commands with GET_FILENAME_COMPONENT commands that were made to do
+#       the desired function.
+#
+# 0.4.0 First version posted to CMake Wiki.
+#
+
+#############################################################################
+# Find the location of myself while originally executing.  If you do this
+# inside of a macro, it will recode where the macro was invoked.
+#############################################################################
+SET(LATEX_USE_LATEX_LOCATION ${CMAKE_CURRENT_LIST_FILE}
+  CACHE INTERNAL "Location of UseLATEX.cmake file." FORCE
+  )
+
+#############################################################################
+# Generic helper macros
+#############################################################################
+
+# Helpful list macros.
+MACRO(LATEX_CAR var)
+  SET(${var} ${ARGV1})
+ENDMACRO(LATEX_CAR)
+MACRO(LATEX_CDR var junk)
+  SET(${var} ${ARGN})
+ENDMACRO(LATEX_CDR)
+
+MACRO(LATEX_LIST_CONTAINS var value)
+  SET(${var})
+  FOREACH (value2 ${ARGN})
+    IF (${value} STREQUAL ${value2})
+      SET(${var} TRUE)
+    ENDIF (${value} STREQUAL ${value2})
+  ENDFOREACH (value2)
+ENDMACRO(LATEX_LIST_CONTAINS)
+
+# Parse macro arguments.
+MACRO(LATEX_PARSE_ARGUMENTS prefix arg_names option_names)
+  SET(DEFAULT_ARGS)
+  FOREACH(arg_name ${arg_names})
+    SET(${prefix}_${arg_name})
+  ENDFOREACH(arg_name)
+  FOREACH(option ${option_names})
+    SET(${prefix}_${option})
+  ENDFOREACH(option)
+
+  SET(current_arg_name DEFAULT_ARGS)
+  SET(current_arg_list)
+  FOREACH(arg ${ARGN})
+    LATEX_LIST_CONTAINS(is_arg_name ${arg} ${arg_names})
+    IF (is_arg_name)
+      SET(${prefix}_${current_arg_name} ${current_arg_list})
+      SET(current_arg_name ${arg})
+      SET(current_arg_list)
+    ELSE (is_arg_name)
+      LATEX_LIST_CONTAINS(is_option ${arg} ${option_names})
+      IF (is_option)
+        SET(${prefix}_${arg} TRUE)
+      ELSE (is_option)
+        SET(current_arg_list ${current_arg_list} ${arg})
+      ENDIF (is_option)
+    ENDIF (is_arg_name)
+  ENDFOREACH(arg)
+  SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(LATEX_PARSE_ARGUMENTS)
+
+# Match the contents of a file to a regular expression.
+MACRO(LATEX_FILE_MATCH variable filename regexp default)
+  # The FILE STRINGS command would be a bit better, but it's not supported on
+  # older versions of CMake.
+  FILE(READ ${filename} file_contents)
+  STRING(REGEX MATCHALL "${regexp}"
+    ${variable} ${file_contents}
+    )
+  IF (NOT ${variable})
+    SET(${variable} "${default}")
+  ENDIF (NOT ${variable})
+ENDMACRO(LATEX_FILE_MATCH)
+
+#############################################################################
+# Macros that perform processing during a LaTeX build.
+#############################################################################
+MACRO(LATEX_MAKEGLOSSARIES)
+  MESSAGE("**************************** In makeglossaries")
+  IF (NOT LATEX_TARGET)
+    MESSAGE(SEND_ERROR "Need to define LATEX_TARGET")
+  ENDIF (NOT LATEX_TARGET)
+
+  IF (NOT MAKEINDEX_COMPILER)
+    MESSAGE(SEND_ERROR "Need to define MAKEINDEX_COMPILER")
+  ENDIF (NOT MAKEINDEX_COMPILER)
+
+  SET(aux_file ${LATEX_TARGET}.aux)
+
+  IF (NOT EXISTS ${aux_file})
+    MESSAGE(SEND_ERROR "${aux_file} does not exist.  Run latex on your target file.")
+  ENDIF (NOT EXISTS ${aux_file})
+
+  LATEX_FILE_MATCH(newglossary_lines ${aux_file}
+    "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
+    "@newglossary{main}{glg}{gls}{glo}"
+    )
+
+  LATEX_FILE_MATCH(istfile_line ${aux_file}
+    "@istfilename[ \t]*{([^}]*)}"
+    "@istfilename{${LATEX_TARGET}.ist}"
+    )
+  STRING(REGEX REPLACE "@istfilename[ \t]*{([^}]*)}" "\\1"
+    istfile ${istfile_line}
+    )
+
+  FOREACH(newglossary ${newglossary_lines})
+    STRING(REGEX REPLACE
+      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
+      "\\1" glossary_name ${newglossary}
+      )
+    STRING(REGEX REPLACE
+      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
+      "${LATEX_TARGET}.\\2" glossary_log ${newglossary}
+      )
+    STRING(REGEX REPLACE
+      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
+      "${LATEX_TARGET}.\\3" glossary_out ${newglossary}
+      )
+    STRING(REGEX REPLACE
+      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
+      "${LATEX_TARGET}.\\4" glossary_in ${newglossary}
+      )
+    MESSAGE("${MAKEINDEX_COMPILER} ${MAKEGLOSSARIES_COMPILER_FLAGS} -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}")
+    EXEC_PROGRAM(${MAKEINDEX_COMPILER} ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
+      -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}
+      )
+  ENDFOREACH(newglossary)
+ENDMACRO(LATEX_MAKEGLOSSARIES)
+
+#############################################################################
+# Helper macros for establishing LaTeX build.
+#############################################################################
+
+MACRO(LATEX_NEEDIT VAR NAME)
+  IF (NOT ${VAR})
+    MESSAGE(SEND_ERROR "I need the ${NAME} command.")
+  ENDIF(NOT ${VAR})
+ENDMACRO(LATEX_NEEDIT)
+
+MACRO(LATEX_WANTIT VAR NAME)
+  IF (NOT ${VAR})
+    MESSAGE(STATUS "I could not find the ${NAME} command.")
+  ENDIF(NOT ${VAR})
+ENDMACRO(LATEX_WANTIT)
+
+MACRO(LATEX_SETUP_VARIABLES)
+  SET(LATEX_OUTPUT_PATH "${LATEX_OUTPUT_PATH}"
+    CACHE PATH "If non empty, specifies the location to place LaTeX output."
+    )
+
+  FIND_PACKAGE(LATEX)
+
+  MARK_AS_ADVANCED(CLEAR
+    LATEX_COMPILER
+    PDFLATEX_COMPILER
+    BIBTEX_COMPILER
+    MAKEINDEX_COMPILER
+    DVIPS_CONVERTER
+    PS2PDF_CONVERTER
+    LATEX2HTML_CONVERTER
+    )
+
+  LATEX_NEEDIT(LATEX_COMPILER latex)
+  LATEX_WANTIT(PDFLATEX_COMPILER pdflatex)
+  LATEX_NEEDIT(BIBTEX_COMPILER bibtex)
+  LATEX_NEEDIT(MAKEINDEX_COMPILER makeindex)
+  LATEX_WANTIT(DVIPS_CONVERTER dvips)
+  LATEX_WANTIT(PS2PDF_CONVERTER ps2pdf)
+  LATEX_WANTIT(LATEX2HTML_CONVERTER latex2html)
+
+  SET(LATEX_COMPILER_FLAGS "-interaction=nonstopmode"
+    CACHE STRING "Flags passed to latex.")
+  SET(PDFLATEX_COMPILER_FLAGS ${LATEX_COMPILER_FLAGS}
+    CACHE STRING "Flags passed to pdflatex.")
+  SET(BIBTEX_COMPILER_FLAGS ""
+    CACHE STRING "Flags passed to bibtex.")
+  SET(MAKEINDEX_COMPILER_FLAGS ""
+    CACHE STRING "Flags passed to makeindex.")
+  SET(MAKEGLOSSARIES_COMPILER_FLAGS ""
+    CACHE STRING "Flags passed to makeglossaries.")
+  SET(DVIPS_CONVERTER_FLAGS "-Ppdf -G0 -t letter"
+    CACHE STRING "Flags passed to dvips.")
+  SET(PS2PDF_CONVERTER_FLAGS "-dMaxSubsetPct=100 -dCompatibilityLevel=1.3 -dSubsetFonts=true -dEmbedAllFonts=true -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dMonoImageFilter=/FlateEncode"
+    CACHE STRING "Flags passed to ps2pdf.")
+  SET(LATEX2HTML_CONVERTER_FLAGS ""
+    CACHE STRING "Flags passed to latex2html.")
+  MARK_AS_ADVANCED(
+    LATEX_COMPILER_FLAGS
+    PDFLATEX_COMPILER_FLAGS
+    BIBTEX_COMPILER_FLAGS
+    MAKEINDEX_COMPILER_FLAGS
+    MAKEGLOSSARIES_COMPILER_FLAGS
+    DVIPS_CONVERTER_FLAGS
+    PS2PDF_CONVERTER_FLAGS
+    LATEX2HTML_CONVERTER_FLAGS
+    )
+  SEPARATE_ARGUMENTS(LATEX_COMPILER_FLAGS)
+  SEPARATE_ARGUMENTS(PDFLATEX_COMPILER_FLAGS)
+  SEPARATE_ARGUMENTS(BIBTEX_COMPILER_FLAGS)
+  SEPARATE_ARGUMENTS(MAKEINDEX_COMPILER_FLAGS)
+  SEPARATE_ARGUMENTS(MAKEGLOSSARIES_COMPILER_FLAGS)
+  SEPARATE_ARGUMENTS(DVIPS_CONVERTER_FLAGS)
+  SEPARATE_ARGUMENTS(PS2PDF_CONVERTER_FLAGS)
+  SEPARATE_ARGUMENTS(LATEX2HTML_CONVERTER_FLAGS)
+
+  FIND_PROGRAM(IMAGEMAGICK_CONVERT convert
+    DOC "The convert program that comes with ImageMagick (available at http://www.imagemagick.org)."
+    )
+  IF (NOT IMAGEMAGICK_CONVERT)
+    MESSAGE(SEND_ERROR "Could not find convert program.  Please download ImageMagick from http://www.imagemagick.org and install.")
+  ENDIF (NOT IMAGEMAGICK_CONVERT)
+
+  OPTION(LATEX_SMALL_IMAGES
+    "If on, the raster images will be converted to 1/6 the original size.  This is because papers usually require 600 dpi images whereas most monitors only require at most 96 dpi.  Thus, smaller images make smaller files for web distributation and can make it faster to read dvi files."
+    OFF)
+  IF (LATEX_SMALL_IMAGES)
+    SET(LATEX_RASTER_SCALE 16)
+    SET(LATEX_OPPOSITE_RASTER_SCALE 100)
+  ELSE (LATEX_SMALL_IMAGES)
+    SET(LATEX_RASTER_SCALE 100)
+    SET(LATEX_OPPOSITE_RASTER_SCALE 16)
+  ENDIF (LATEX_SMALL_IMAGES)
+
+  # Just holds extensions for known image types.  They should all be lower case.
+  SET(LATEX_DVI_VECTOR_IMAGE_EXTENSIONS .eps)
+  SET(LATEX_DVI_RASTER_IMAGE_EXTENSIONS)
+  SET(LATEX_DVI_IMAGE_EXTENSIONS
+    ${LATEX_DVI_VECTOR_IMAGE_EXTENSIONS} ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS})
+  SET(LATEX_PDF_VECTOR_IMAGE_EXTENSIONS .pdf)
+  SET(LATEX_PDF_RASTER_IMAGE_EXTENSIONS .png .jpeg .jpg)
+  SET(LATEX_PDF_IMAGE_EXTENSIONS
+    ${LATEX_PDF_VECTOR_IMAGE_EXTENSIONS} ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS})
+  SET(LATEX_IMAGE_EXTENSIONS
+    ${LATEX_DVI_IMAGE_EXTENSIONS} ${LATEX_PDF_IMAGE_EXTENSIONS})
+ENDMACRO(LATEX_SETUP_VARIABLES)
+
+MACRO(LATEX_GET_OUTPUT_PATH var)
+  SET(${var})
+  IF (LATEX_OUTPUT_PATH)
+    IF ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+      MESSAGE(SEND_ERROR "You cannot set LATEX_OUTPUT_PATH to the same directory that contains LaTeX input files.")
+    ELSE ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+      SET(${var} "${LATEX_OUTPUT_PATH}")
+    ENDIF ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+  ELSE (LATEX_OUTPUT_PATH)
+    IF ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+      MESSAGE(SEND_ERROR "LaTeX files must be built out of source or you must set LATEX_OUTPUT_PATH.")
+    ELSE ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+      SET(${var} "${CMAKE_CURRENT_BINARY_DIR}")
+    ENDIF ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+  ENDIF (LATEX_OUTPUT_PATH)
+ENDMACRO(LATEX_GET_OUTPUT_PATH)
+
+MACRO(LATEX_ADD_CONVERT_COMMAND output_path input_path output_extension
+        input_extension flags)
+  SET (converter ${IMAGEMAGICK_CONVERT})
+  SET (convert_flags "")
+  # ImageMagick has broken eps to pdf conversion
+  # use ps2pdf instead
+  IF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf")
+    IF (PS2PDF_CONVERTER)
+      SET (converter ${PS2PDF_CONVERTER})
+      SET (convert_flags "-dEPSCrop ${flags}")
+    ELSE (PS2PDF_CONVERTER)
+      MESSAGE(SEND_ERROR "Using postscript files with pdflatex requires ps2pdf for conversion.")
+    ENDIF (PS2PDF_CONVERTER)
+  ELSE (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf")
+    SET (convert_flags ${flags})
+  ENDIF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf")
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${output_path}
+    COMMAND ${converter}
+      ARGS ${convert_flags} ${input_path} ${output_path}
+    DEPENDS ${input_path}
+    )
+ENDMACRO(LATEX_ADD_CONVERT_COMMAND)
+
+# Makes custom commands to convert a file to a particular type.
+MACRO(LATEX_CONVERT_IMAGE output_files input_file output_extension convert_flags
+    output_extensions other_files)
+  SET(input_dir ${CMAKE_CURRENT_SOURCE_DIR})
+  LATEX_GET_OUTPUT_PATH(output_dir)
+
+  GET_FILENAME_COMPONENT(extension "${input_file}" EXT)
+
+  STRING(REGEX REPLACE "\\.[^.]*\$" ${output_extension} output_file
+    "${input_file}")
+
+  LATEX_LIST_CONTAINS(is_type ${extension} ${output_extensions})
+  IF (is_type)
+    IF (convert_flags)
+      LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file}
+        ${input_dir}/${input_file} ${output_extension} ${extension}
+        "${convert_flags}")
+      SET(${output_files} ${${output_files}} ${output_dir}/${output_file})
+    ELSE (convert_flags)
+      # As a shortcut, we can just copy the file.
+      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${input_file}
+        COMMAND ${CMAKE_COMMAND}
+        ARGS -E copy ${input_dir}/${input_file} ${output_dir}/${input_file}
+        DEPENDS ${input_dir}/${input_file}
+        )
+      SET(${output_files} ${${output_files}} ${output_dir}/${input_file})
+    ENDIF (convert_flags)
+  ELSE (is_type)
+    SET(do_convert TRUE)
+    # Check to see if there is another input file of the appropriate type.
+    FOREACH(valid_extension ${output_extensions})
+      STRING(REGEX REPLACE "\\.[^.]*\$" ${output_extension} try_file
+        "${input_file}")
+      LATEX_LIST_CONTAINS(has_native_file "${try_file}" ${other_files})
+      IF (has_native_file)
+        SET(do_convert FALSE)
+      ENDIF (has_native_file)
+    ENDFOREACH(valid_extension)
+
+    # If we still need to convert, do it.
+    IF (do_convert)
+      LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file}
+        ${input_dir}/${input_file} ${output_extension} ${extension}
+        "${convert_flags}")
+      SET(${output_files} ${${output_files}} ${output_dir}/${output_file})
+    ENDIF (do_convert)
+  ENDIF (is_type)
+ENDMACRO(LATEX_CONVERT_IMAGE)
+
+# Adds custom commands to process the given files for dvi and pdf builds.
+# Adds the output files to the given variables (does not replace).
+MACRO(LATEX_PROCESS_IMAGES dvi_outputs pdf_outputs)
+  LATEX_GET_OUTPUT_PATH(output_dir)
+  FOREACH(file ${ARGN})
+    IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+      GET_FILENAME_COMPONENT(extension "${file}" EXT)
+      SET(convert_flags)
+
+      # Check to see if we need to downsample the image.
+      LATEX_LIST_CONTAINS(is_raster extension
+        ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS}
+        ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS})
+      IF (LATEX_SMALL_IMAGES)
+        IF (is_raster)
+          SET(convert_flags -resize ${LATEX_RASTER_SCALE}%)
+        ENDIF (is_raster)
+      ENDIF (LATEX_SMALL_IMAGES)
+
+      # Make sure the output directory exists.
+      GET_FILENAME_COMPONENT(path "${output_dir}/${file}" PATH)
+      MAKE_DIRECTORY("${path}")
+
+      # Do conversions for dvi.
+      LATEX_CONVERT_IMAGE(${dvi_outputs} "${file}" .eps "${convert_flags}"
+        "${LATEX_DVI_IMAGE_EXTENSIONS}" "${ARGN}")
+
+      # Do conversions for pdf.
+      IF (is_raster)
+        LATEX_CONVERT_IMAGE(${pdf_outputs} "${file}" .png "${convert_flags}"
+          "${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}")
+      ELSE (is_raster)
+        LATEX_CONVERT_IMAGE(${pdf_outputs} "${file}" .pdf "${convert_flags}"
+          "${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}")
+      ENDIF (is_raster)
+    ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+      MESSAGE("Could not find file \"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"")
+    ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+  ENDFOREACH(file)
+ENDMACRO(LATEX_PROCESS_IMAGES)
+
+MACRO(ADD_LATEX_IMAGES)
+  MESSAGE("The ADD_LATEX_IMAGES macro is deprecated.  Image directories are specified with LATEX_ADD_DOCUMENT.")
+ENDMACRO(ADD_LATEX_IMAGES)
+
+MACRO(LATEX_COPY_GLOBBED_FILES pattern dest)
+  FILE(GLOB file_list ${pattern})
+  FOREACH(in_file ${file_list})
+    GET_FILENAME_COMPONENT(out_file ${in_file} NAME)
+    CONFIGURE_FILE(${in_file} ${dest}/${out_file} COPYONLY)
+  ENDFOREACH(in_file)
+ENDMACRO(LATEX_COPY_GLOBBED_FILES)
+
+MACRO(LATEX_COPY_INPUT_FILE file)
+  LATEX_GET_OUTPUT_PATH(output_dir)
+
+  IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+    GET_FILENAME_COMPONENT(path ${file} PATH)
+    FILE(MAKE_DIRECTORY ${output_dir}/${path})
+
+    LATEX_LIST_CONTAINS(use_config ${file} ${LATEX_CONFIGURE})
+    IF (use_config)
+      CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}
+        ${output_dir}/${file}
+        @ONLY
+        )
+      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file}
+        COMMAND ${CMAKE_COMMAND}
+        ARGS ${CMAKE_BINARY_DIR}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
+        )
+    ELSE (use_config)
+      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file}
+        COMMAND ${CMAKE_COMMAND}
+        ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${output_dir}/${file}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
+        )
+    ENDIF (use_config)
+  ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+    IF (EXISTS ${output_dir}/${file})
+      # Special case: output exists but input does not.  Assume that it was
+      # created elsewhere and skip the input file copy.
+    ELSE (EXISTS ${output_dir}/${file})
+      MESSAGE("Could not find input file ${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+    ENDIF (EXISTS ${output_dir}/${file})
+  ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+ENDMACRO(LATEX_COPY_INPUT_FILE)
+
+#############################################################################
+# Commands provided by the UseLATEX.cmake "package"
+#############################################################################
+
+MACRO(LATEX_USAGE command message)
+  MESSAGE(SEND_ERROR
+    "${message}\nUsage: ${command}(<tex_file>\n           [BIBFILES <bib_file> <bib_file> ...]\n           [INPUTS <tex_file> <tex_file> ...]\n           [IMAGE_DIRS <directory1> <directory2> ...]\n           [IMAGES <image_file1> <image_file2>\n           [CONFIGURE <tex_file> <tex_file> ...]\n           [DEPENDS <tex_file> <tex_file> ...]\n           [USE_INDEX] [USE_GLOSSARY] [DEFAULT_PDF] [MANGLE_TARGET_NAMES])"
+    )
+ENDMACRO(LATEX_USAGE command message)
+
+# Parses arguments to ADD_LATEX_DOCUMENT and ADD_LATEX_TARGETS and sets the
+# variables LATEX_TARGET, LATEX_IMAGE_DIR, LATEX_BIBFILES, LATEX_DEPENDS, and
+# LATEX_INPUTS.
+MACRO(PARSE_ADD_LATEX_ARGUMENTS command)
+  LATEX_PARSE_ARGUMENTS(
+    LATEX
+    "BIBFILES;INPUTS;IMAGE_DIRS;IMAGES;CONFIGURE;DEPENDS"
+    "USE_INDEX;USE_GLOSSARY;USE_GLOSSARIES;DEFAULT_PDF;MANGLE_TARGET_NAMES"
+    ${ARGN}
+    )
+
+  # The first argument is the target latex file.
+  IF (LATEX_DEFAULT_ARGS)
+    LATEX_CAR(LATEX_MAIN_INPUT ${LATEX_DEFAULT_ARGS})
+    LATEX_CDR(LATEX_DEFAULT_ARGS ${LATEX_DEFAULT_ARGS})
+    GET_FILENAME_COMPONENT(LATEX_TARGET ${LATEX_MAIN_INPUT} NAME_WE)
+  ELSE (LATEX_DEFAULT_ARGS)
+    LATEX_USAGE(${command} "No tex file target given to ${command}.")
+  ENDIF (LATEX_DEFAULT_ARGS)
+
+  IF (LATEX_DEFAULT_ARGS)
+    LATEX_USAGE(${command} "Invalid or depricated arguments: ${LATEX_DEFAULT_ARGS}")
+  ENDIF (LATEX_DEFAULT_ARGS)
+
+  # Backward compatibility between 1.6.0 and 1.6.1.
+  IF (LATEX_USE_GLOSSARIES)
+    SET(LATEX_USE_GLOSSARY TRUE)
+  ENDIF (LATEX_USE_GLOSSARIES)
+ENDMACRO(PARSE_ADD_LATEX_ARGUMENTS)
+
+MACRO(ADD_LATEX_TARGETS)
+  LATEX_GET_OUTPUT_PATH(output_dir)
+  PARSE_ADD_LATEX_ARGUMENTS(ADD_LATEX_TARGETS ${ARGV})
+
+  # Set up target names.
+  IF (LATEX_MANGLE_TARGET_NAMES)
+    SET(dvi_target      ${LATEX_TARGET}_dvi)
+    SET(pdf_target      ${LATEX_TARGET}_pdf)
+    SET(ps_target       ${LATEX_TARGET}_ps)
+    SET(safepdf_target  ${LATEX_TARGET}_safepdf)
+    SET(html_target     ${LATEX_TARGET}_html)
+    SET(auxclean_target ${LATEX_TARGET}_auxclean)
+  ELSE (LATEX_MANGLE_TARGET_NAMES)
+    SET(dvi_target      dvi)
+    SET(pdf_target      pdf)
+    SET(ps_target       ps)
+    SET(safepdf_target  safepdf)
+    SET(html_target     html)
+    SET(auxclean_target auxclean)
+  ENDIF (LATEX_MANGLE_TARGET_NAMES)
+
+  # For each directory in LATEX_IMAGE_DIRS, glob all the image files and
+  # place them in LATEX_IMAGES.
+  FOREACH(dir ${LATEX_IMAGE_DIRS})
+    FOREACH(extension ${LATEX_IMAGE_EXTENSIONS})
+      FILE(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*${extension})
+      FOREACH(file ${files})
+        GET_FILENAME_COMPONENT(filename ${file} NAME)
+        SET(LATEX_IMAGES ${LATEX_IMAGES} ${dir}/${filename})
+      ENDFOREACH(file)
+    ENDFOREACH(extension)
+  ENDFOREACH(dir)
+
+  SET(dvi_images)
+  SET(pdf_images)
+  LATEX_PROCESS_IMAGES(dvi_images pdf_images ${LATEX_IMAGES})
+
+  SET(make_dvi_command
+    ${CMAKE_COMMAND} -E chdir ${output_dir}
+    ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT})
+  SET(make_pdf_command
+    ${CMAKE_COMMAND} -E chdir ${output_dir}
+    ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT})
+
+  SET(make_dvi_depends ${LATEX_DEPENDS} ${dvi_images})
+  SET(make_pdf_depends ${LATEX_DEPENDS} ${pdf_images})
+  FOREACH(input ${LATEX_MAIN_INPUT} ${LATEX_INPUTS})
+    SET(make_dvi_depends ${make_dvi_depends} ${output_dir}/${input})
+    SET(make_pdf_depends ${make_pdf_depends} ${output_dir}/${input})
+  ENDFOREACH(input)
+
+  IF (LATEX_BIBFILES)
+    SET(make_dvi_command ${make_dvi_command}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${LATEX_TARGET})
+    SET(make_pdf_command ${make_pdf_command}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${LATEX_TARGET})
+    FOREACH (bibfile ${LATEX_BIBFILES})
+      SET(make_dvi_depends ${make_dvi_depends} ${output_dir}/${bibfile})
+      SET(make_pdf_depends ${make_pdf_depends} ${output_dir}/${bibfile})
+    ENDFOREACH (bibfile ${LATEX_BIBFILES})
+  ENDIF (LATEX_BIBFILES)
+
+  IF (LATEX_USE_INDEX)
+    SET(make_dvi_command ${make_dvi_command}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${LATEX_TARGET}.idx)
+    SET(make_pdf_command ${make_pdf_command}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${LATEX_TARGET}.idx)
+  ENDIF (LATEX_USE_INDEX)
+
+  IF (LATEX_USE_GLOSSARY)
+    SET(make_dvi_command ${make_dvi_command}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${CMAKE_COMMAND}
+      -D LATEX_BUILD_COMMAND=makeglossaries
+      -D LATEX_TARGET=${LATEX_TARGET}
+      -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
+      -D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS}
+      -P ${LATEX_USE_LATEX_LOCATION}
+      )
+    SET(make_pdf_command ${make_pdf_command}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${CMAKE_COMMAND}
+      -D LATEX_BUILD_COMMAND=makeglossaries
+      -D LATEX_TARGET=${LATEX_TARGET}
+      -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
+      -D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS}
+      -P ${LATEX_USE_LATEX_LOCATION}
+      )
+  ENDIF (LATEX_USE_GLOSSARY)
+
+  SET(make_dvi_command ${make_dvi_command}
+    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+    ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}
+    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+    ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT})
+  SET(make_pdf_command ${make_pdf_command}
+    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+    ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}
+    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+    ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT})
+
+  # Add commands and targets for building dvi outputs.
+  ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.dvi
+    COMMAND ${make_dvi_command}
+    DEPENDS ${make_dvi_depends}
+    )
+  IF (LATEX_DEFAULT_PDF)
+    ADD_CUSTOM_TARGET(${dvi_target}
+      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
+  ELSE (LATEX_DEFAULT_PDF)
+    ADD_CUSTOM_TARGET(${dvi_target} ALL
+      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
+  ENDIF (LATEX_DEFAULT_PDF)
+
+  # Add commands and targets for building pdf outputs (with pdflatex).
+  IF (PDFLATEX_COMPILER)
+    ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.pdf
+      COMMAND ${make_pdf_command}
+      DEPENDS ${make_pdf_depends}
+      )
+    IF (LATEX_DEFAULT_PDF)
+      ADD_CUSTOM_TARGET(${pdf_target} ALL
+        DEPENDS ${output_dir}/${LATEX_TARGET}.pdf)
+    ELSE (LATEX_DEFAULT_PDF)
+      ADD_CUSTOM_TARGET(${pdf_target}
+        DEPENDS ${output_dir}/${LATEX_TARGET}.pdf)
+    ENDIF (LATEX_DEFAULT_PDF)
+  ENDIF (PDFLATEX_COMPILER)
+
+  IF (DVIPS_CONVERTER)
+    ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.ps
+      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
+        ${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi
+      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
+    ADD_CUSTOM_TARGET(${ps_target}
+      DEPENDS ${output_dir}/${LATEX_TARGET}.ps)
+    IF (PS2PDF_CONVERTER)
+      # Since both the pdf and safepdf targets have the same output, we
+      # cannot properly do the dependencies for both.  When selecting safepdf,
+      # simply force a recompile every time.
+      ADD_CUSTOM_TARGET(${safepdf_target}
+        ${CMAKE_COMMAND} -E chdir ${output_dir}
+        ${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf
+        )
+      ADD_DEPENDENCIES(${safepdf_target} ${ps_target})
+    ENDIF (PS2PDF_CONVERTER)
+  ENDIF (DVIPS_CONVERTER)
+
+  IF (LATEX2HTML_CONVERTER)
+    ADD_CUSTOM_TARGET(${html_target}
+      ${CMAKE_COMMAND} -E chdir ${output_dir}
+      ${LATEX2HTML_CONVERTER} ${LATEX2HTML_CONVERTER_FLAGS} ${LATEX_MAIN_INPUT}
+      )
+    ADD_DEPENDENCIES(${html_target} ${LATEX_MAIN_INPUT} ${LATEX_INPUTS})
+  ENDIF (LATEX2HTML_CONVERTER)
+
+  ADD_CUSTOM_TARGET(${auxclean_target}
+    ${CMAKE_COMMAND} -E remove ${output_dir}/${LATEX_TARGET}.aux ${output_dir}/${LATEX_TARGET}.idx ${output_dir}/${LATEX_TARGET}.ind
+    )
+ENDMACRO(ADD_LATEX_TARGETS)
+
+MACRO(ADD_LATEX_DOCUMENT)
+  LATEX_GET_OUTPUT_PATH(output_dir)
+  IF (output_dir)
+    PARSE_ADD_LATEX_ARGUMENTS(ADD_LATEX_DOCUMENT ${ARGV})
+
+    LATEX_COPY_INPUT_FILE(${LATEX_MAIN_INPUT})
+
+    FOREACH (bib_file ${LATEX_BIBFILES})
+      CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${bib_file}
+        ${output_dir}/${bib_file}
+        COPYONLY)
+      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${bib_file}
+        COMMAND ${CMAKE_COMMAND}
+        ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${bib_file} ${output_dir}/${bib_file}
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${bib_file}
+        )
+    ENDFOREACH (bib_file)
+
+    FOREACH (input ${LATEX_INPUTS})
+      LATEX_COPY_INPUT_FILE(${input})
+    ENDFOREACH(input)
+
+    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.cls ${output_dir})
+    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.bst ${output_dir})
+    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.clo ${output_dir})
+    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.sty ${output_dir})
+
+    ADD_LATEX_TARGETS(${ARGV})
+  ENDIF (output_dir)
+ENDMACRO(ADD_LATEX_DOCUMENT)
+
+#############################################################################
+# Actually do stuff
+#############################################################################
+
+IF (LATEX_BUILD_COMMAND)
+  SET(command_handled)
+
+  IF ("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries)
+    LATEX_MAKEGLOSSARIES()
+    SET(command_handled TRUE)
+  ENDIF ("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries)
+
+  IF (NOT command_handled)
+    MESSAGE(SEND_ERROR "Unknown command: ${LATEX_BUILD_COMMAND}")
+  ENDIF (NOT command_handled)
+
+ELSE (LATEX_BUILD_COMMAND)
+  # Must be part of the actual configure (included from CMakeLists.txt).
+  LATEX_SETUP_VARIABLES()
+ENDIF (LATEX_BUILD_COMMAND)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/dynmake/Makefile.base.M	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,82 @@
+#include "../../dyncall/dyncall_macros.h"
+
+#if defined(DC_WINDOWS) && defined(MAKE_CMD_nmake)
+
+/* Abstractions */
+#define _(X)      $(X)         /* Standard variables */
+#define _L(X)     X.lib
+#define _O(X)     X.obj
+
+#define TARGET   @
+#define PREREQS  **
+
+/* Makefile internal vars for platform abstraction */
+MAKEFLAGS_USER = /NOLOGO
+MAKEFLAG_FILE = /f
+MAKE_DEFAULT_FILE = dynMakefile
+SHELL_COMMAND_SEPARATOR = &&
+
+AR = lib
+ARFLAGS_USER = /NOLOGO
+ARFLAGS = 
+ARFLAG_OUT_PREFIX = /OUT:
+
+CFLAGS_USER      = /nologo /I..\dyncall /I..\dyncallback
+CFLAGS           = _(CFLAGS) _(CFLAGS_USER)
+
+LDFLAGS_USER      = /nologo /L..\dyncall /L..\dyncallback
+LDFLAGS           = _(LDFLAGS) _(LDFLAGS_USER)
+LDFLAG_IN_PREFIX  =
+LDFLAG_OUT_PREFIX = /OUT:
+
+ASFLAGS_USER = /nologo
+AFLAGS       = _(AFLAGS) _(ASFLAGS_USER)  /* Set AFLAGS (without 'S'), which is the standard nmake predefined macro for MASM */
+ASFLAGS      = _(AFLAGS)
+
+RM = del
+
+.SUFFIXES : .S
+
+.S.obj:
+	cl /nologo /EP $< > $*.asm
+	_(AS) _(ASFLAGS) /c $*.asm
+	del $*.asm
+
+
+#else
+
+/* Abstractions */
+#define _(X)      ${X}         /* Standard variables */
+#define _L(X)     lib##X.a
+#define _O(X)     X.o
+
+#define TARGET   @
+#if defined(MAKE_CMD_gmake) || (defined(DC__OS_Linux) && !defined(MAKE_CMD_bsdmake)) || (defined(DC__OS_Darwin) && !defined(MAKE_CMD_bsdmake)) || (defined(DC__OS_SunOS) && !defined(MAKE_CMD_bsdmake))
+#  define PREREQS  ^
+#else
+#  define PREREQS  >
+#endif
+
+
+/* Makefile internal vars for platform abstraction */
+MAKEFLAGS_USER = 
+MAKEFLAG_FILE = -f
+MAKE_DEFAULT_FILE = dynMakefile
+SHELL_COMMAND_SEPARATOR = ;
+
+ARFLAG_OUT_PREFIX = 
+
+CFLAGS_USER = -I ../dyncall -I ../dyncallback
+CFLAGS     += _(CFLAGS_USER)
+
+LDFLAGS_USER      = -L../../dyncall -L../../dyncallback
+LDFLAGS          += _(LDFLAGS_USER)
+LDFLAG_IN_PREFIX  = -l
+LDFLAG_OUT_PREFIX = -o
+
+ASFLAGS_USER = 
+
+RM = rm -f
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/dynmake/dynmake.bat	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,2 @@
+cl /nologo /DMAKE_CMD_%~n2 /EP Makefile.M 1> Makefile.dynmake
+%2 /NOLOGO /f Makefile.dynmake %1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/dynmake/dynmake.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,4 @@
+#!/bin/sh
+#cpp -D MAKE_CMD_$2 -P Makefile.M | sed "s/^  */	/" > Makefile.dynmake
+gcc -D MAKE_CMD_$2 -E -P -x c Makefile.M | sed "s/^  */	/" > Makefile.dynmake
+$2 -f Makefile.dynmake $1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/lua/Makefile	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,10 @@
+DL=wget
+all: lua-5.1.4
+
+lua-5.1.4.tar.gz: 
+	${DL} http://www.lua.org/ftp/lua-5.1.4.tar.gz
+lua-5.1.4: lua-5.1.4.tar.gz
+	gunzip -c $? | tar xf -
+
+clean:
+	rm -rf lua-5.1.4.tar.gz lua-5.1.4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/lua/README.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,4 @@
+This helper folder is used to bootstrap lua on platforms where there
+is no lua at all.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/lua/bootstrap.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,34 @@
+#!/bin/sh
+if [ -z "${DL}" ]; then
+  DL=wget
+fi
+case `uname -s` in
+  Darwin)
+    LPLAF=macosx
+    ;;
+  Linux)
+    LPLAF=linux
+    ;;
+  FreeBSD)
+    LPLAF=freebsd
+    ;;
+  SunOS)
+    LPLAF=solaris
+    ;;
+  AIX)
+    LPLAF=aix
+    ;;
+  DragonFly)
+    LPLAF=bsd
+    ;;
+  *BSD)
+    LPLAF=bsd
+    ;;
+  *)
+    LPLAF=posix
+    ;;
+esac
+DL="${DL}" make -f `dirname $0`/Makefile lua-5.1.4
+(cd lua-5.1.4; make ${LPLAF})
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/lua/cleanup.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ -d lua-5.1.4 ]; then
+  (cd lua-5.1.4;make clean)
+fi
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/lua/mkfile	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,34 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2013 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+
+VER = 5.1.4
+LUA = lua-$VER
+TGZ = $LUA.tar.gz
+
+all:V:
+	hget http://www.lua.org/ftp/$TGZ > $TGZ
+	tar -xf $TGZ
+	cd $LUA/src
+	rm luac.c
+	pcc *.c
+	mv 8.out ../../lua
+	cd ../..
+	rm -rf $LUA $TGZ
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/lua/setenv.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,4 @@
+#
+PATH=$PWD/lua-5.1.4/src:$PATH
+export PATH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/mk/app.mk	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,30 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+
+# Set Plan9's mk variables.
+TARG   = ${APPLICATION}
+OFILES = `{echo $UNITS | sed 's/ |$/.$O /g'}
+LIB    = $LIBS
+
+# Add some targets to create a local copy of the bin, named as desired.
+all:V: $TARG
+
+$TARG: $O.out
+	cp $O.out $TARG
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/mk/dirs.mk	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,27 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+all: dirs
+
+dirs:VQ: $DIRS
+	for (i in $DIRS) @{
+		 echo Handling sub-directory $i...
+		 cd $i && rfork && rm /env/DIRS && $MK -f mkfile $MKFLAGS
+	 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/mk/epilog.mk	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,30 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+
+# If we have subdirectories, handle them.
+<|if(! ~ x$DIRS x)        { cat $TOP/buildsys/mk/dirs.mk }; echo
+
+# If we have a library to build, include lib.mk, if it is an application,
+# include app.mk, etc..
+<|if(! ~ x$LIBRARY x)     { cat $TOP/buildsys/mk/lib.mk /sys/src/cmd/mklib }; echo
+<|if(! ~ x$APPLICATION x) { cat $TOP/buildsys/mk/app.mk /sys/src/cmd/mkone }; echo
+
+# Overrides.
+<$TOP/buildsys/mk/pcc.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/mk/lib.mk	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,23 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+
+# Set Plan9's mk variables.
+LIB = lib${LIBRARY}_s.a$O
+OFILES = `{echo $UNITS | sed 's/ |$/.$O /g'}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/mk/pcc.mk	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,60 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+
+#@@@ add stuff for crosscompiling here.
+
+CC = pcc
+LD = pcc
+
+#@@@.if $(BUILD_CONFIG) == "debug"
+#@@@ add -g option or similar
+#@@@.endif
+CPPFLAGS = -D__Plan9__ -D__${objtype}__
+CFLAGS   = -D__Plan9__ -D__${objtype}__ -I$TOP/dyncall -I$TOP/dyncallback -c
+#CXXFLAGS = $CXXFLAGS -D__Plan9__
+#ASFLAGS  = -D__Plan9__
+
+# JUST TEMPORARY AS LONG AS I'M WORKING ON IT - Plan9's sed doesn't support sed comments
+#        /^$/d                                                               # Remove empty lines.
+#        /^#.*/d                                                             # Remove comments.
+#        s/^\.(globl|intel_syntax|file|section).*//                          # Remove some GAS directives.
+#        s/(.*):/TEXT \1(SB), $0/g                                           # Reformat function names.
+#        s/%//g                                                              # Remove % register prefixes.
+#        /^[  ]+/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/    # Convert everything to uppercase.
+#        s/([A-Z]+)[  ]*E(..)[,   ]*E(..)/\1L \3, \2/                        # Convert 32bit instructions with 2 register operands.
+#        s/([A-Z]+)[  ]*E(..)[,   ]*([0-9]+)/\1L $\3, \2/                    # Convert 32bit instructions with register and constant as
+#        s/([A-Z]+)[  ]*E(..)[,   ]*\[E(..)\+([0-9]+)\]/\1L \4(\3), \2/      # Convert 32bit instructions with register and address as 
+#        s/([A-Z]+)[  ]*E(..)[,   ]*\[E(..)\]/\1L 0(\3), \2/                 # Convert 32bit instructions with register and address as 
+#        s/(CALL)[    ]*E(..)[    ]*$/\1 \2/                                 # Convert CALL instructions.
+#        s/(CALL)[    ]*\[E(..)\+([0-9]+)\]/\1 \3(\2)/                       # Convert CALL instructions with addressing mode.
+#        s/([A-Z]+)[  ]*E(..)[    ]*$/\1L \2/                                # Convert 32bit instructions with register operand.
+#        s/([A-Z]+)[  ]*\[E(..)\+([0-9]+)\]/\1L \3(\2)/                      # Convert 32bit instructions with address operand.
+#        s/([A-Z]+)[  ]*\[E(..)\]/\1L 0(\2)/                                 # Convert 32bit instructions with address operand.
+#        s/(REP)[     ]*(MOV)SB[  ]*$/\1; \2B SI, DI/                        # Convert repeater prefix stuff.
+#        s/(REP)[     ]*(MOV)SD[  ]*$/\1; \2L SI, DI/                        # Convert repeater prefix stuff.
+
+# Step to transform .S into object files.
+%.$O: %.S
+	cp $prereq $prereq.c
+	pcc -E $CPPFLAGS $prereq.c > $stem.s # replace with cpp? pcc requires .c suffix
+	rm $prereq.c
+	$AS $AFLAGS $stem.s
+	rm $stem.s
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/mk/prolog.mk	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,35 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                    Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+# 'all' is always our default target.
+all:
+
+
+</$objtype/mkfile
+
+# Include config rules.
+<$TOP/ConfigVars
+
+BUILD_HOST   = $CONFIG_HOST
+BUILD_OS     = $CONFIG_OS
+BUILD_ARCH   = $CONFIG_ARCH
+BUILD_TOOL   = $CONFIG_TOOL
+BUILD_ASM    = $CONFIG_ASM
+BUILD_CONFIG = $CONFIG_CONFIG
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/nmake/common.nmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,61 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	common nmake rules
+#	common.nmake
+#
+#///////////////////////////////////////////////////
+
+
+build: dirs $(TARGETS)
+
+
+dirs: $(DIRS)
+!IF DEFINED(DIRS) && "$(DIRS)" != ""
+	!echo Handling sub-directory $** ... && cd $** && $(MAKE) /NOLOGO /F Nmakefile && cd ..
+#	!echo Handling sub-directory $** ... && cd $** && $(MAKE) /NOLOGO /F Nmakefile $** && cd ..
+!ENDIF
+
+
+clean: $(DIRS)
+!IF DEFINED(DIRS) && "$(DIRS)" != ""
+	!echo Handling sub-directory $** ... && cd $** && $(MAKE) /NOLOGO /F Nmakefile $@ && cd ..
+!ENDIF
+!IF (DEFINED(TARGETS) && "$(TARGETS)" != "") || (DEFINED(OBJS) && "$(OBJS)" != "")
+	echo Cleaning $(MAKEDIR) ...
+	del $(TARGETS) *.exp *.lib $(OBJS)
+#	del $(TARGETS) $(TARGETS:.exe=.lib) $(TARGETS:.dll=.lib) $(TARGETS:.exe=.exp) $(TARGETS:.dll=.exp) $(OBJS)
+!ENDIF
+
+
+distclean: $(DIRS)
+!IF DEFINED(DIRS) && "$(DIRS)" != ""
+	!echo Handling sub-directory $** ... && cd $** && $(MAKE) /NOLOGO /F Nmakefile $@ && cd ..
+!ENDIF
+!IF DEFINED(AUTOS) && "$(AUTOS)" != ""
+	echo Cleaning auto-generated files in $(MAKEDIR) ...
+	del $(AUTOS)
+!ENDIF
+!IF (DEFINED(TARGETS) && "$(TARGETS)" != "") || (DEFINED(OBJS) && "$(OBJS)" != "")
+	echo Cleaning $(MAKEDIR) ...
+	del $(TARGETS) *.exp *.lib $(OBJS)
+#	del $(TARGETS) $(TARGETS:.exe=.lib) $(TARGETS:.dll=.lib) $(TARGETS:.exe=.exp) $(TARGETS:.dll=.exp) $(OBJS)
+!ENDIF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/nmake/epilog.nmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,28 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	nmake rules
+#	epilog.nmake
+#
+#///////////////////////////////////////////////////
+
+
+!INCLUDE common.nmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/nmake/prolog.nmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,76 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	nmake rules
+#	prolog.nmake
+#
+#///////////////////////////////////////////////////
+
+
+.SILENT:
+
+# Default "build all" target.
+all: configure build
+
+
+# Check if library has been 'configured' properly. If not, tell the user and abort.
+!IF !DEFINED(CONFIG_OS) || !DEFINED(CONFIG_ARCH)
+configure: $(TOP)\ConfigVars
+$(TOP)\ConfigVars:
+	echo "Library not configured properly! Run configure.bat from the library's root directory first!"
+!ELSE
+configure:
+!ENDIF
+
+
+# Include config rules.
+!IF EXISTS($(TOP)\ConfigVars)
+!  INCLUDE $(TOP)\ConfigVars
+!ENDIF
+
+# Include site rules.
+!IF EXISTS($(TOP)\SiteVars)
+!  INCLUDE $(TOP)\SiteVars
+!ENDIF
+
+# set BUILD_* from CONFIG_* variables
+!IF !DEFINED(BUILD_HOST)
+BUILD_HOST = $(CONFIG_HOST)
+!ENDIF
+!IF !DEFINED(BUILD_OS)
+BUILD_OS = $(CONFIG_OS)
+!ENDIF
+!IF !DEFINED(BUILD_ARCH)
+BUILD_ARCH = $(CONFIG_ARCH)
+!ENDIF
+!IF !DEFINED(BUILD_TOOL)
+BUILD_TOOL = $(CONFIG_TOOL)
+!ENDIF
+!IF !DEFINED(BUILD_ASM)
+BUILD_ASM = $(CONFIG_ASM)
+!ENDIF
+!IF !DEFINED(BUILD_CONFIG)
+BUILD_CONFIG = $(CONFIG_CONFIG)
+!ENDIF
+
+!IF "$(BUILD_TOOL)" != ""
+!  INCLUDE tool_$(BUILD_TOOL).nmake
+!ENDIF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/nmake/tool_gcc.nmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,82 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	GCC nmake rules
+#	tool_gcc.nmake
+#
+#///////////////////////////////////////////////////
+
+
+CC  =arm-eabi-gcc
+CXX =arm-eabi-g++
+AR  =arm-eabi-ar
+AS  =arm-eabi-as
+LD  =arm-eabi-g++#arm-eabi-ld
+OCP =arm-eabi-objcopy
+
+!IF "$(BUILD_ARCH)" == "arm32_thumb"
+
+ASFLAGS  = -g -mthumb -mthumb-interwork
+CFLAGS   = -g -Wall -O2 -I$(TOP)\dyncall -I$(TOP)\dyncallback -fomit-frame-pointer -ffast-math -fno-strict-aliasing -mthumb -mthumb-interwork
+CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
+LDFLAGS  = -g -mno-fpu -mthumb -mthumb-interwork
+ARFLAGS  =
+
+!ELSE IF "$(BUILD_ARCH)" == "arm32_arm"
+
+ASFLAGS  = -g
+CFLAGS   = -g -Wall -O2 -I$(TOP)\dyncall -I$(TOP)\dyncallback -fomit-frame-pointer -ffast-math -fno-strict-aliasing
+CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
+LDFLAGS  = -g -mno-fpu
+ARFLAGS  =
+
+!ENDIF
+
+
+!IF "$(BUILD_OS)" == "nds"
+CFLAGS   = $(CFLAGS) -DARM9 -mcpu=arm9tdmi -mtune=arm9tdmi -D__nds__ -I"$(DEVKITPRO_PATH)/libnds/include"
+CXXFLAGS = $(CXXFLAGS) -D__nds__ -I"$(DEVKITPRO_PATH)/libnds/include"
+LDFLAGS  = $(LDFLAGS) -specs=ds_arm9.specs
+!ENDIF
+
+
+.SUFFIXES:
+.SUFFIXES: .o .so .a .arm9 .nds .pdf .c .cpp .S .tex .cc
+
+
+.S.o:
+	echo .S.o: Assembling $< ...
+	$(CC) $(ASFLAGS) $(CFLAGS) -o $@ -c $<
+
+.c.o:
+	echo .c.o: Compiling $< ...
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+.cpp.o:
+	echo .cpp.o: Compiling $< ...
+	$(CXX) $(CXXFLAGS) -o $@ -c $<
+
+.cc.o:
+	echo .cc.o: Compiling $< ...
+	$(CXX) $(CXXFLAGS) -o $@ -c $<
+
+.tex.pdf:
+	pdflatex $<
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/nmake/tool_msvc.nmake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,67 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	MSVC nmake rules
+#	tool_MSVC.nmake
+#
+#///////////////////////////////////////////////////
+
+
+
+CC  =cl
+CXX =cl
+AR  =lib
+!IF "$(BUILD_ARCH)" == "x64"
+AS  =ml64
+!ELSE IF "$(BUILD_ARCH)" == "x86"
+AS  =ml
+!ENDIF
+LD  =link
+
+ASFLAGS  = /c /nologo
+CFLAGS   = /EHsc /GR- /GS- /Ox /c /nologo /I$(TOP)\dyncall /I$(TOP)\dyncallback
+CXXFLAGS = $(CFLAGS)
+LDFLAGS  = /OPT:REF /OPT:ICF /NOLOGO
+ARFLAGS  = /NOLOGO
+
+
+.SUFFIXES:
+.SUFFIXES: .obj .exe .dll .lib .pdf .c .cpp .asm .tex .cc
+
+
+.asm.obj:
+	echo .asm.obj: Assembling $< ...
+	$(AS) $(ASFLAGS) /Fo$@ $<
+
+.c.obj:
+	echo .c.obj: Compiling $< ...
+	$(CC) $(CFLAGS) /Fo$@ $<
+
+.cpp.obj:
+	echo .cpp.obj: Compiling $< ...
+	$(CXX) $(CXXFLAGS) /Fo$@ $<
+
+.cc.obj:
+	echo .cc.obj: Compiling $< ...
+	$(CXX) $(CXXFLAGS) /Fo$@ $<
+
+.tex.pdf:
+	pdflatex $<
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/batch-build-linux.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+cd `dirname $0`/../../
+
+# Build libraries.
+
+make -f Makefile.generic clean all
+
+# Build tests: dynload tests need '-ldl'.
+
+( cd test ; make -f Makefile.generic clean )
+( cd test ; LDLIBS=-ldl make -f Makefile.generic all-dynload )
+( cd test ; make -f Makefile.generic all )
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/batch-build-minix.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+cd `dirname $0`/../../
+
+# ---------------------------------------------------------- #
+# DynCall build script using Makefile.generic on Minix 3.1.8 #
+# ---------------------------------------------------------- #
+
+# build libs and tests, but exclude dynload
+
+./configure
+make libdyncall libdyncallback tests-libdyncallback tests-libdyncall
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/batch-build-psp.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+cd `dirname $0`/../../
+
+# ------------------------------------------------------------- #
+# DynCall build script using Makefile.generic for PSP toolchain #
+# ------------------------------------------------------------- #
+
+# build libs and tests, but exclude dynload
+
+./configure --target=PSP
+#no callback for mips, yet, but build 'empty' libdyncallback to make linker happy
+make libdyncall libdyncallback tests-libdyncall # tests-libdyncallback
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/conf-nds.bat	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,41 @@
+@ECHO OFF
+REM ///////////////////////////////////////////////////////////////////////////
+REM
+REM Copyright (c) 2007-2009 Daniel Adler <dadler@uni-goettingen.de>, 
+REM                         Tassilo Philipp <tphilipp@potion-studios.com>
+REM
+REM Permission to use, copy, modify, and distribute this software for any
+REM purpose with or without fee is hereby granted, provided that the above
+REM copyright notice and this permission notice appear in all copies.
+REM
+REM THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+REM WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+REM MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+REM ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+REM WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+REM ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+REM OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+REM
+REM ///////////////////////////////////////////////////////////////////////////
+
+REM We need at least 2 characters in the path.
+IF [%DEVKITPRO:~0,1%]==[%DEVKITPRO%] (
+	GOTO END_ABORT
+)
+
+REM Extract devkitPro path.
+IF [%DEVKITPRO:~0,1%]==[/] (
+	ECHO DEVKITPRO_PATH=%DEVKITPRO:~1,1%:%DEVKITPRO:~2%#>>ConfigVars
+) ELSE IF [%DEVKITPRO:~1,1%]==[:] (
+	ECHO DEVKITPRO_PATH=%DEVKITPRO%#>>ConfigVars
+) ELSE (
+	GOTO END_ABORT
+)
+
+GOTO END
+
+:END_ABORT
+ECHO ERROR: Environment variable DEVKITPRO must be set to absolute devkitPro path.
+DEL ConfigVars
+
+:END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/elf-to-psp-eboot.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if ! [ -x "$1" ]; then
+	echo Usage: $0 \<elf\>
+	exit 1
+fi
+
+TITLE=`basename $1`
+SFO=/tmp/${TITLE}.sfo
+FIXED_ELF=/tmp/${TITLE}.fixed
+STRIPPED_ELF=/tmp/${TITLE}.stripped
+
+mksfo             dyncall_${TITLE} $SFO
+psp-fixup-imports -o $FIXED_ELF $1
+psp-strip         $FIXED_ELF -o $STRIPPED_ELF
+pack-pbp          EBOOT.PBP $SFO NULL NULL NULL NULL NULL $STRIPPED_ELF NULL
+rm $SFO
+rm $FIXED_ELF
+rm $STRIPPED_ELF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/setenv-cross-ios.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,8 @@
+
+IOS_ARCH="armv6"
+IOS_SDK_VERSION="4.3" 
+
+export TARGET_MACH="-arch ${IOS_ARCH}" 
+export TARGET_ARCH="-arch ${IOS_ARCH} -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk" 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/scripts/setenv-sdk-ios.sh	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,22 @@
+#!/bin/sh
+#export PATH=`xcode-select -print-path`/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:${PATH}
+DEVELOPER=`xcode-select -print-path`
+# WORKS: P="${DEVELOPER}/Platforms/iPhoneOS.platform/Developer"
+P="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain"
+export MANPATH="$P/usr/share/man:${MANPATH}"
+export PATH="$P/usr/bin:${PATH}"
+
+#if [ -z "${DEVELOPER}" ]; then
+#DEVELOPER=/Developer
+#fi
+#export PATH="${DEVELOPER}/Platforms/iPhoneOS.platform/Developer/usr/bin:${PATH}"
+# export CPATH="$P/usr/include:${CPATH}"
+#if [ `exec sw_vers -productVersion` ]; then
+#  case `sw_vers -productVersion` in
+#    10.*)
+#       
+#      ;;
+#  esac
+#export PATH=${DEVELOPER}/Platforms/iPhoneOS.platform/Developer/usr/bin:${PATH}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/vs2005/dyncall/dyncall.vcproj	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="dyncall"
+	ProjectGUID="{DF67B85F-C8F8-4FB1-A701-867A9C835ABA}"
+	RootNamespace="dyncall"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+		<DefaultToolFile
+			FileName="masm.rules"
+		/>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="MASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="MASM"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_api.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_call_x86_generic_masm.asm"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_callf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_callvm.c"
+				>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_callvm_base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_vector.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_alloc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_call_x86.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_callf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_callvm.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_callvm_x86.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_config.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_macros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_signature.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_types.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_value.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dyncall\dyncall_vector.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/vs2005/test_plain/test_plain.vcproj	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="test_plain"
+	ProjectGUID="{65E1A63C-079D-4F72-8307-E070A499D2EA}"
+	RootNamespace="test_plain"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../../dyncall"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\test\plain\test_main.cc"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\test\plain\test_framework.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/vs2005/vs2005.sln	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dyncall", "dyncall\dyncall.vcproj", "{DF67B85F-C8F8-4FB1-A701-867A9C835ABA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_plain", "test_plain\test_plain.vcproj", "{65E1A63C-079D-4F72-8307-E070A499D2EA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{DF67B85F-C8F8-4FB1-A701-867A9C835ABA} = {DF67B85F-C8F8-4FB1-A701-867A9C835ABA}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DF67B85F-C8F8-4FB1-A701-867A9C835ABA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DF67B85F-C8F8-4FB1-A701-867A9C835ABA}.Debug|Win32.Build.0 = Debug|Win32
+		{DF67B85F-C8F8-4FB1-A701-867A9C835ABA}.Release|Win32.ActiveCfg = Release|Win32
+		{DF67B85F-C8F8-4FB1-A701-867A9C835ABA}.Release|Win32.Build.0 = Release|Win32
+		{65E1A63C-079D-4F72-8307-E070A499D2EA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{65E1A63C-079D-4F72-8307-E070A499D2EA}.Debug|Win32.Build.0 = Debug|Win32
+		{65E1A63C-079D-4F72-8307-E070A499D2EA}.Release|Win32.ActiveCfg = Release|Win32
+		{65E1A63C-079D-4F72-8307-E070A499D2EA}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,203 @@
+#!/bin/sh
+C=Makefile.config
+
+# get full path
+case $0 in
+  /*)
+    FULL=$0
+    ;;
+  *)
+    FULL=$PWD/$0
+    ;;
+esac
+
+printf "# auto-generated by $0\n" >$C
+while [ $# -gt 0 ]; do
+  X=$1
+  shift 1
+# Shell common:
+  case $X in
+    --help|-h|-?)
+cat <<EOF
+usage: $0 --<option>=<value> <var>=<value> ..
+
+  --prefix=<dir>
+  --target=<platform>       uname/special targets: MacOSX,iOS,iPhoneSimulator
+  --sdk=<version>           Mac OS X/iOS SDK version (e.g. '6.1' or '10.9.3')
+                            Tested iOS SDK versions: 4.3, 6.1, 8.1 
+  --sdkroot=<dir>
+
+Useful variables CC, CXX, CFLAGS, CXXFLAGS, etc..
+
+EOF
+      exit 1
+      ;;
+# GNU Compatibility:
+    --prefix=*)
+      PREFIX=`printf -- "${X}" | cut -c 10-`
+      ;;
+    --target=*)
+      TARGET=`printf -- "${X}" | cut -c 10-`
+      ;;
+    --sdk=*)
+      SDK=`printf -- "${X}" | cut -c 7-`
+      ;;
+    --sdkroot=*)
+      SDKROOT=`printf -- "${X}" | cut -c 11-`
+      ;;
+# Environment variables:
+    [A-Za-z_]*=*)
+      printf "${X}\n" >>$C
+      k=`printf "${X}" | cut -d = -f 1`
+      v=`printf "${X}" | cut -d = -f 2`
+      export $k="$v"
+      ;;
+# Others fail:
+    *)
+      printf "error: invalid option ${X}\n" >&2
+      exit 1
+      ;;
+  esac
+done
+printf "PREFIX=${PREFIX:=/usr/local}\n" >>$C
+case ${TARGET:=`uname`} in
+  Linux)
+    if [ -z "${CFLAGS}" ]; then
+      printf "CFLAGS=-fPIC\n" >>$C
+    fi
+    printf "LDLIBS=-lm -ldl\n" >>$C
+    ;;
+  OpenBSD)
+    printf "LDLIBS=-lm\n" >>$C
+    ;;
+  DragonFly|NetBSD)
+    if [ -z "${CFLAGS}" ]; then
+      printf "CFLAGS=-fPIC\n" >>$C
+    fi
+    printf "LDLIBS=-lm\n" >>$C
+    ;;
+  FreeBSD)
+    if [ -z "${CFLAGS}" ]; then
+      printf "CFLAGS=-fPIC\n" >>$C
+    fi
+    printf "LDLIBS=-lm\n" >>$C
+    printf "RM=rm -f\n" >>$C
+    ;;
+  MacOSX|Darwin)
+    # if Apple's libtool (not to be confused with GNU's) is available, which is according to libtool(1) "with -static [...] intended
+    # to replace ar(5) and ranlib", use it - if it is shadowed by some install of GNU's libtool assume that a foreign environment is
+    # intentionally used, and fall back to using 'ar rs' (the equivalent to 'libtool -static'), for compatibility:
+    if libtool -V >/dev/null 2>/dev/null; then # Apple's libtool has -V for version, which GNU does not.
+      printf "AR=libtool\n" >>$C
+      printf "ARFLAGS=-static -o\n" >>$C
+    else
+      printf "AR=ar\n" >>$C
+      printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives
+    fi
+    if [ `uname -n` = 'iPhone' ]; then # building on iPhone itself, uname yields Darwin (gcc setup for current/correct arch)
+      printf "CC=gcc\n" >>$C
+    elif [ -z ${SDK} ]; then
+      case `sw_vers -productVersion` in
+        10.4.*)
+          ARCHS="-arch ppc -arch i386 -arch x86_64" 
+          ;;
+        10.[56].*)
+          ARCHS="-arch i386 -arch x86_64 -arch ppc"
+          ;;
+        10.6.*)
+          ARCHS="-arch i386 -arch x86_64"
+          ;;
+        10.10.*)
+          ARCHS="-arch x86_64 -arch i386"
+          ;;
+        10.[789].*)
+          ARCHS="-arch x86_64 -arch i386"
+          ;;
+      esac
+      printf "ASFLAGS=${ARCHS}\n" >>$C
+      printf "CFLAGS=${ARCHS}\n" >>$C
+      printf "CXXFLAGS=${ARCHS}\n" >>$C
+    else
+      if [ -z ${SDKROOT} ]; then
+        SDKROOT="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK}.sdk"
+      fi
+      printf "CFLAGS=-isysroot ${SDKROOT}\n" >>$C
+      printf "CXXFLAGS=-isysroot ${SDKROOT}\n" >>$C
+    fi
+    ;;
+  iPhoneOS|iOS)
+    if [ -z ${SDKROOT} ]; then
+      SDKROOT="`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK}.sdk"
+    fi
+    if [ -z "${ARCHS}" ]; then
+      case "${SDK}" in
+        [45].*)
+          ARCHS="-arch armv6"
+          ;;
+        [67].*)
+          ARCHS="-arch armv7"
+          ;;
+        8.*)
+          ARCHS="-arch armv7 -arch arm64"
+          ;;
+      esac
+    fi
+    printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives
+    printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
+    printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
+    printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
+    printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C
+    ;;
+  iPhoneSimulator)
+    if [ -z ${SDKROOT} ]; then
+      SDKROOT="`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK}.sdk"
+    fi
+    ARCHS="-arch i386"
+    printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
+    printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
+    printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
+    printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C
+    ;;
+  SunOS)
+    # open distributions often don't come with default cc and CC, check for common alternatives.
+    printf "CC=` (which cc || which gcc || which clang  ) | grep -v '^no '`\n" >>$C
+    printf "CXX=`(which CC || which g++ || which clang++) | grep -v '^no '`\n" >>$C # C++ compiler traditionally named CC
+    printf "CCC=${CXX}\n" >>$C # Sun make's rules use CCC for c++ compiler
+    printf "LDLIBS=-lm\n" >>$C
+    ;;
+  Minix)
+    printf "CC=gcc\n" >>$C
+    printf "CXX=g++\n">>$C
+    printf "AR=ar\n"  >>$C
+    ;;
+  PSP)
+    SDKROOT="`psp-config --pspsdk-path`"
+    printf "CC=psp-gcc\n" >>$C
+    printf "CXX=psp-gcc\n">>$C # don't use psp-g++, buggy
+    printf "AR=psp-ar\n"  >>$C
+    printf "CFLAGS=-I${SDKROOT}/include/\n" >>$C
+    printf "CXXFLAGS=-I${SDKROOT}/include/\n" >>$C
+    # Pulling in dyncall libs below is a hack, for some reason psp-ld is super-picky about order.
+    # Use your C lib of choice, from the PSPSDK, or...
+    #printf "LDLIBS=-L${SDKROOT}/lib/ -L`dirname ${FULL}`/dyncall -L`dirname ${FULL}`/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lpsplibc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C
+    # ... newlib.
+    printf "LDLIBS=-L${SDKROOT}/lib/ -L`dirname ${FULL}`/dyncall -L`dirname ${FULL}`/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lc       -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C
+    ;;
+esac
+
+BLDTOP="$PWD"
+SRCTOP=`dirname ${FULL}`
+
+FILES=`( cd $SRCTOP ; find . -name "Makefile.generic" )`
+for FILE in $FILES ; do
+  SRCFILE="$SRCTOP/$FILE"
+  BLDFILE="$BLDTOP/$FILE"
+  SRCDIR=`dirname $SRCFILE`
+  BLDDIR=`dirname $BLDFILE`
+  mkdir -p "$BLDDIR"
+  cat <<EOF >$BLDDIR/Makefile
+VPATH = $SRCDIR
+include $BLDTOP/Makefile.config
+include \${VPATH}/Makefile.generic
+EOF
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure.bat	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,157 @@
+@ECHO OFF
+REM ///////////////////////////////////////////////////////////////////////////
+REM
+REM Copyright (c) 2007-2009 Daniel Adler <dadler@uni-goettingen.de>, 
+REM                         Tassilo Philipp <tphilipp@potion-studios.com>
+REM
+REM Permission to use, copy, modify, and distribute this software for any
+REM purpose with or without fee is hereby granted, provided that the above
+REM copyright notice and this permission notice appear in all copies.
+REM
+REM THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+REM WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+REM MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+REM ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+REM WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+REM ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+REM OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+REM
+REM ///////////////////////////////////////////////////////////////////////////
+
+
+SETLOCAL
+
+REM Set default values.
+SET PACKAGE=dyncall
+SET CONFIG_HOST=windows
+SET CONFIG_OS=windows
+SET CONFIG_TOOL=msvc
+SET CONFIG_ASM=ml
+SET CONFIG_CONFIG=release
+IF [%PROCESSOR_ARCHITECTURE%] == [AMD64] (
+	SET CONFIG_ARCH=x64
+) ELSE IF [%PROCESSOR_ARCHITEW6432%] == [AMD64] (
+	SET CONFIG_ARCH=x64
+) ELSE (
+	SET CONFIG_ARCH=x86
+)
+
+REM Scan arguments.
+:MAIN_LOOP
+
+
+REM Help.
+IF [%1]==[] (
+	GOTO DONE
+) ELSE IF [%1]==[/?] (
+	ECHO.
+	ECHO.dyncall configuration shell-script
+	ECHO.Usage:
+	ECHO.  configure.bat [ options ]
+	ECHO.
+	ECHO.Options:
+	ECHO.  /?                print this page
+	ECHO.
+	ECHO.  /prefix PATH      set installation prefix ^(GNU make only^)
+	ECHO.  /prefix-bd PATH   set build directory prefix ^(GNU make only^)
+	ECHO.                    ^(only for use with gmake^)
+	ECHO.
+	ECHO.  /target-x86       build for x86 architecture ^(default^)
+	ECHO.  /target-x64       build for x64 architecture
+	ECHO.  /target-psp       build for PlayStation Portable ^(homebrew SDK^)
+	ECHO.  /target-nds-arm   build for Nintendo DS ^(devkitPro, ARM mode^)
+	ECHO.  /target-nds-thumb build for Nintendo DS ^(devkitPro, THUMB mode^)
+	ECHO.
+	ECHO.  /tool-msvc        use Microsoft Visual C++ compiler ^(default^)
+	ECHO.  /tool-gcc         use GNU Compiler Collection
+	ECHO.
+	ECHO.  /asm-ml           use Microsoft Macro Assembler ^(default^)
+	ECHO.  /asm-as           use the GNU Assembler
+	ECHO.  /asm-nasm         use NASM Assembler
+	ECHO.
+	ECHO.  /config-release   build release version ^(default^)
+	ECHO.  /config-debug     build debug version
+	GOTO:EOF
+) ELSE IF [%1]==[/prefix] (
+	SET CONFIG_PREFIX=%2
+	SHIFT
+) ELSE IF [%1]==[/prefix-bd] (
+	SET CONFIG_BUILDPREFIX=%2
+	SHIFT
+) ELSE IF [%1]==[/target-x86] (
+	SET CONFIG_ARCH=x86
+) ELSE IF [%1]==[/target-x64] (
+	SET CONFIG_ARCH=x64
+) ELSE IF [%1]==[/target-psp] (
+	SET CONFIG_ARCH=mips32
+	SET CONFIG_OS=psp
+) ELSE IF [%1]==[/target-nds-arm] (
+	SET CONFIG_ARCH=arm32_arm
+	SET CONFIG_OS=nds
+) ELSE IF [%1]==[/target-nds-thumb] (
+	SET CONFIG_ARCH=arm32_thumb
+	SET CONFIG_OS=nds
+) ELSE IF [%1]==[/tool-gcc] (
+	SET CONFIG_TOOL=gcc
+	SET CONFIG_ASM=as
+) ELSE IF [%1]==[/tool-msvc] (
+	SET CONFIG_TOOL=msvc
+	SET CONFIG_ASM=ml
+) ELSE IF [%1]==[/asm-as] (
+	SET CONFIG_ASM=as
+) ELSE IF [%1]==[/asm-nasm] (
+	SET CONFIG_ASM=nasm
+) ELSE IF [%1]==[/asm-ml] (
+	SET CONFIG_ASM=ml
+) ELSE IF [%1]==[/config-release] (
+	SET CONFIG_CONFIG=release
+) ELSE IF [%1]==[/config-debug] (
+	SET CONFIG_CONFIG=debug
+) ELSE (
+	ECHO Unknown parameter '%1'.
+	GOTO DONE
+)
+
+SHIFT
+GOTO MAIN_LOOP
+:DONE
+
+IF [%CONFIG_PREFIX%]==[] (
+	SET CONFIG_PREFIX=%CD%\install_%CONFIG_OS%_%CONFIG_ARCH%_%CONFIG_TOOL%_%CONFIG_CONFIG%
+)
+IF [%CONFIG_BUILDPREFIX%]==[] (
+	SET CONFIG_BUILDPREFIX=%CD%\build_out\%CONFIG_OS%_%CONFIG_ARCH%_%CONFIG_TOOL%_%CONFIG_CONFIG%
+)
+
+ECHO # auto-generated by configure.bat >ConfigVars
+ECHO CONFIG_PACKAGE=%PACKAGE%#>>ConfigVars
+ECHO CONFIG_HOST=%CONFIG_HOST%#>>ConfigVars
+ECHO CONFIG_OS=%CONFIG_OS%#>>ConfigVars
+ECHO CONFIG_ARCH=%CONFIG_ARCH%#>>ConfigVars
+ECHO CONFIG_TOOL=%CONFIG_TOOL%#>>ConfigVars
+ECHO CONFIG_ASM=%CONFIG_ASM%#>>ConfigVars
+ECHO CONFIG_CONFIG=%CONFIG_CONFIG%#>>ConfigVars
+ECHO CONFIG_PREFIX=%CONFIG_PREFIX%#>>ConfigVars
+ECHO CONFIG_BUILDPREFIX=%CONFIG_BUILDPREFIX%#>>ConfigVars
+
+ECHO Writing following configuration to ConfigVars:
+ECHO.
+ECHO Host OS:             %CONFIG_HOST%
+ECHO Target OS:           %CONFIG_OS%
+ECHO Target Architecture: %CONFIG_ARCH%
+ECHO Compiler:            %CONFIG_TOOL%
+ECHO Assembler:           %CONFIG_ASM%
+ECHO Build configuration: %CONFIG_CONFIG%
+ECHO Install prefix:      %CONFIG_PREFIX%
+ECHO Build prefix:        %CONFIG_BUILDPREFIX%
+
+
+REM We have to transform some pathes for the nds/devkitPro build.
+IF [%CONFIG_OS%]==[nds] (
+	REM Check if DEVKITPRO is set.
+	IF [%DEVKITPRO%]==[] (
+		ECHO ERROR: Environment variable DEVKITPRO must be set to absolute devkitPro path.
+	) ELSE (
+		buildsys\scripts\conf-nds.bat
+	)
+)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure.rc	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,234 @@
+#!/bin/rc
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007-2010 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+# --- configure settings ------------------------------------------------------
+
+PACKAGE=dyncall
+CONFIG_PREFIX=/usr/local #@@@
+
+# --- output error message ----------------------------------------------------
+fn error {
+  echo error: $*
+  exit 1
+}
+
+# --- output warning message --------------------------------------------------
+
+fn warning {
+  echo warning: $*
+}
+
+# --- output info message -----------------------------------------------------
+
+fn info {
+  echo $*
+}
+
+# --- print usage -------------------------------------------------------------
+
+fn usage {
+  echo $PACKAGE' configuration shell-script'
+  echo 'Usage:'
+  echo '  configure [ options ]'
+  echo
+  echo 'Options:'
+  echo '  --help'
+  echo '   -h                print this page'
+  #echo
+  #echo '  --target-x86       build for x86 architecture platform'
+  #echo '  --target-x64       build for x64 architecture platform'
+  #echo '  --target-ppc32     build for ppc32 architecture platform'
+  #echo '  --target-arm-arm   build for ARM architecture platform (ARM mode)'
+  #echo '  --target-arm-thumb build for ARM architecture platform (THUMB mode)'
+  #echo
+  #echo '  --tool-pcc         use Portable C Compiler'
+  #echo 
+  #echo '  --asm-xa           use Plan9 Assemblers (0a, 1a, 2a, etc.)'
+  #echo
+  #echo '  --config-release   build release version (default)'
+  #echo '  --config-debug     build debug version'
+  echo
+  exit 0
+}
+
+# --- guess operating system -------------------------------------------------
+
+CONFIG_OS=()
+fn guess_os {
+  CONFIG_OS='plan9'
+  info 'guess os '$CONFIG_OS
+}
+
+# --- guess architecture -----------------------------------------------------
+
+CONFIG_ARCH=()
+fn guess_arch {
+  CONFIG_ARCH='x86'
+  switch($cputype) {
+    case 386
+      CONFIG_ARCH='x86'
+    case amd64
+      CONFIG_ARCH='x64'
+    case arm
+      CONFIG_ARCH='arm32_arm'
+    case power
+      CONFIG_ARCH='ppc32'
+    case mips
+      CONFIG_ARCH='mips32'
+    case *
+      warning 'unknown architecture '$cputype' - using default (x86)'
+  }
+  info 'guess arch '$CONFIG_ARCH
+}
+
+# --- guess tool chain -------------------------------------------------------
+
+CONFIG_TOOL=()
+fn guess_tool {
+  #CONFIG_TOOL=`{grep CC /$objtype/mkfile | sed s/CC.//}
+  CONFIG_TOOL='pcc'
+  info 'guess tool '$CONFIG_TOOL
+}
+
+# --- guess assembler --------------------------------------------------------
+
+CONFIG_ASM=()
+fn guess_asm {
+  CONFIG_ASM=`{grep AS /$objtype/mkfile | sed s/AS.//}
+  info 'guess assembler '$CONFIG_ASM
+}
+
+# --- process arguments ------------------------------------------------------
+
+fn args {
+  while(! ~ $#* 0 && ~ $1 -*) {
+    OPT=$1
+    shift
+
+    switch($OPT) {
+      case --help -h
+        usage
+      #case --target-x86
+        #CONFIG_ARCH='x86'
+      #case --target-x64
+        #CONFIG_ARCH='x64'
+      #case --target-ppc32
+        #CONFIG_ARCH='ppc32'
+      #case --target-arm-arm
+        #CONFIG_ARCH='arm32_arm'
+      #case --target-arm-thumb
+        #CONFIG_ARCH='arm32_thumb'
+      #case --tool-pcc
+        #CONFIG_TOOL=pcc
+        #CONFIG_ASM=2a
+      #case --tool-xa
+        #CONFIG_ASM=2a
+      #case --config-release
+        #CONFIG_CONFIG=release
+      #case --config-debug
+        #CONFIG_CONFIG=debug
+      case *
+        warning 'unknown option '$OPT
+    }
+  }
+}
+
+# --- guess variables --------------------------------------------------------
+
+fn guess {
+  if(~ $#CONFIG_OS 0) {
+    guess_os
+    if(~ $#CONFIG_OS 0) {
+      error 'unsupported operating system '$OS
+    }
+  }
+
+  if(~ $#CONFIG_ARCH 0) {
+    guess_arch 
+    if(~ $#CONFIG_ARCH 0) {
+      error 'unsupported architecture '$ARCH
+    }
+  }
+
+  if(~ $#CONFIG_TOOL 0) {
+    guess_tool
+    if(~ $#CONFIG_TOOL 0) {
+      error 'no tool'
+    }
+  }
+
+  if(~ $#CONFIG_ASM 0) {
+    guess_asm
+    if(~ $#CONFIG_ASM 0) {
+      error 'no assembler tool'
+    }
+  }
+
+  if(~ $#CONFIG_CONFIG 0) {
+    CONFIG_CONFIG=release
+  }
+}
+  
+# --- set default variables --------------------------------------------------
+
+fn set_defaults {
+  CONFIG_HOST=$CONFIG_OS
+}
+
+# --- derive variables -------------------------------------------------------
+
+fn derive_vars {
+  BUILD_HOST=$CONFIG_HOST
+  if(! ~ $CONFIG_HOST $CONFIG_OS) {
+    BUILD_HOST=$CONFIG_HOST'_'$CONFIG_OS
+  }
+}
+
+# --- write ConfigVars files ------------------------------------------------
+
+fn output {
+  echo '#auto-generated by '$PACKAGE'/configure' >$1
+  echo 'CONFIG_PACKAGE='$PACKAGE >>$1
+  echo 'CONFIG_HOST='$CONFIG_HOST >>$1
+  echo 'CONFIG_OS='$CONFIG_OS >>$1
+  echo 'CONFIG_ARCH='$CONFIG_ARCH >>$1
+  echo 'CONFIG_TOOL='$CONFIG_TOOL >>$1
+  echo 'CONFIG_ASM='$CONFIG_ASM >>$1
+  echo 'CONFIG_CONFIG='$CONFIG_CONFIG >>$1
+  echo 'CONFIG_PREFIX='$CONFIG_PREFIX >>$1
+  if(! ~ $#CONFIG_BUILDPREFIX 0) {
+    echo 'CONFIG_BUILDPREFIX='$CONFIG_BUILDPREFIX >>$1
+  }
+  echo '' >>$1
+}
+
+# --- main -------------------------------------------------------------------
+
+fn main {
+  args $*
+  info '* configure package '$PACKAGE
+  guess
+  set_defaults
+  derive_vars
+  output ConfigVars 
+}
+
+main $*
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/Description.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,7 @@
+DynCall Project
+
+The dyncall library encapsulates architecture-, OS- and compiler-specific function call semantics in a virtual "bind argument parameters from left to right and then call" interface allowing programmers to call C functions in a completely dynamic manner. In other words, instead of calling a function directly, the dyncall library provides a mechanism to push the function parameters manually and to issue the call afterwards.
+This means, that a program can determine at runtime what function to call, and what parameters to pass to it. The library is written in C and assembly and provides a very simple C interface to program against.
+
+The library comes in very handy to power flexible message systems, dynamic function call dispatch mechanisms, closure implementations or even to bridge different programming languages.
+When it comes to language bindings, the dyncall library provides a clean and portable C interface to dynamically issue calls to foreign code using small call kernels written in assembly. Instead of providing code for every bridged function call, which unnecessarily results in code bloat, only a couple of instructions are used to invoke every possible call.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/License.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,15 @@
+Copyright (c) 2007-2012 Daniel Adler <dadler@uni-goettingen.de>, 
+                        Tassilo Philipp <tphilipp@potion-studios.com>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/Makefile.generic	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,3 @@
+.PHONY: all
+all clean:
+	cd manual && ${MAKE} $@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README-Cross.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,21 @@
+Cross-compilation of dyncall with gcc
+=====================================
+
+Make sure cross-compile tools are installed and in your path, and set the
+CC, AR and LD envvars, explicitly (where $PREFIX is arm-eabi, etc., depending
+on the toolchain to be used):
+
+  $ export CC=$PREFIX-gcc
+  $ export AR=$PREFIX-ar
+  $ export LD=$PREFIX-ld
+
+Also set CXX if you want to build the tests:
+
+  $ export CXX=$PREFIX-g++
+
+
+Then, build dyncall - one way would be to simply use Makefile.embedded:
+
+  $ make -f Makefile.embedded sun
+  $ (cd test; make -f Makefile.embedded)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.CMake	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,82 @@
+Notes on building DynCall with CMake
+====================================
+
+
+Build with CMake (in-source)
+----------------------------
+
+cd <dyncall-source-dir>
+
+On Unix:
+  cmake .
+  make
+
+On Windows:
+  cmake . -G "NMake Makefiles"
+  nmake /f Makefile
+
+  NOTE: Assembly Support is broken for Visual Studio Generators in CMake
+        So we support NMake for now only.
+
+Install in a specific location
+------------------------------
+cmake -DCMAKE_INSTALL_PREFIX=<absolute-path>
+
+
+Tested settings
+---------------
+- CMake Unix Makefile generators on Mac OS X and Linux.
+
+
+Using from other CMake-based projects
+-------------------------------------
+Under buildsys/cmake/Modules you find some Find*() scripts
+which you might find useful.
+
+
+Make Universal Binary
+---------------------
+cmake -DCMAKE_OSX_ARCHITECTURES="i386;x86_64;ppc"
+
+
+CMake Framework
+---------------
+The project name is "DynCall".
+Each library in the source tree represents a target (not a sub-project!).
+Support scripts for 'find_package' are at buildsys/cmake/Modules.
+
+find_package( [DynLoad | DynCall | DynCallback] ) 
+
+will set the variables:
+
+	Dyn*_INCLUDE_DIRS
+	Dyn*_LIBRARIES
+
+
+Using dyncall libraries in other CMake projects
+-----------------------------------------------
+find_package(DynLoad REQUIRED)
+add_includes(${DynLoad_INCLUDE_DIRS})
+target_link_libraries( ... ${DynLoad_LIBRARIES})
+
+
+Use as sub-project within CMake top-level project
+-------------------------------------------------
+
+add_subdirectory(path/to/dyncall/project/tree)
+set(DynLoad_DIR ${DynCall_SOURCE_DIR}/dynload)
+set(DynCall_DIR ${DynCall_SOURCE_DIR}/dyncall)
+set(DynCallback_DIR ${DynCall_SOURCE_DIR}/dyncallback)
+
+has the effect, that the 'find_package' works from within the project source 
+tree.
+
+
+Building for SPARC64 Architectures
+----------------------------------
+
+Supported Compilers: GCC, SunPro
+Add -m64 to C, C++ and ASM flags, e.g.
+
+$ cmake -DCMAKE_C_FLAGS=-m64 -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_ASM_CXX_FLAGS=-m64
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.Generic	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,168 @@
+Building DynCall with generic makefiles
+=======================================
+
+
+Description
+-----------
+
+Makefile.generic is a simple and _hybrid_ make-based build system setup for dyncall, 
+designed to work with with GNU and BSD make.
+
+This build-flavour supports two operating modes: Embedded and Configure.
+
+Project files are specified in Makefile.generic.
+
+
+History
+-------
+During the integration of dyncall into the R package rdyncall, there
+was a need for a clean simple build system that could be launched from R
+and works with various make's such as GNU, BSD and sun make.
+
+
+Generic Usage
+-------------
+
+[g|bsd]make [-f Makefile.generic] [all|clean|install|...] [INSTALL_TOP=<path>]
+
+
+Embedded Mode
+-------------
+Makefile.generic makefiles are taken "as-is" without the need for extra configuration.
+
+<VAR1>=<VALUE1> ... bsdmake -f Makefile.generic
+<VAR1>=<VALUE1> ... gmake -f Makefile.generic
+
+(Note that setting an env var as above (<VAR1>=<VALUE1>) before running a command is
+shell specific. If your shell doesn't support this, set it according to the shell's
+style.)
+
+Example:
+  dyncall libraries should compile fine on most platforms:
+  
+  BSDmake:
+  $ bsdmake -f Makefile.generic
+
+  GNUmake:
+  $ make -f Makefile.generic
+
+  The tests sometimes require special attention to additional 'usual' libraries
+  such as math and dynamic linker run-time libs.
+  $ LDLIBS="-lm -ldl" make -f Makefile.generic
+
+
+Configure Mode
+--------------
+
+Usage:
+
+  cd <build-dir> # build-dir can be arbitrary
+  ../<path-to-source>/configure [--prefix=<path>]
+  make
+  make install [DESTDIR=<path>]
+
+The configure script 'configure' writes 'Makefile' files that 
+include 'Makefile.generic' and setup variables such as 
+VPATH, {SRC,BLD}{TOP,DIR}.
+
+Two build types are supported: In-source and out-of-Source.
+
+in-source builds:
+Makefile's are created in parallel to the Makefile.generic files.
+
+out-of-source builds:
+the configure script is executed from a (possible empty) build directory. 
+The source directory tree is duplicated into that directory.
+
+
+Useful Variables
+----------------
+
+For libraries:
+  CC, CFLAGS, CPPFLAGS
+For tests:
+  CXX, LDLIBS
+
+MAKE_CMD - The make tool (including -f flag) to run sub-directories.
+SRCTOP   - Source top-level directory (defaults to relative top).
+BLDTOP   - Build  top-level directory (defaults to SRCTOP).
+SRCDIR   - Source directory (defaults to '.').
+BLDDIR   - Build  directory (defaults to SRCDIR).
+
+e.g. Makefile.generic in source-tree:
+
+SRCTOP ?= ../../../ # relative path to source-top
+BLDTOP ?= ${SRCTOP} # defaults for in-source builds
+SRCDIR ?= .         # relative path to current directory
+BLDDIR ?= ${BLDDIR} # relative path to current directory
+
+
+Include Directories
+-------------------
+Use -I${SRCTOP}/... to refer to other include directories.
+
+
+Link Directories
+----------------
+Use -L${BLDTOP}/... to refer to other build directories.
+
+
+Plaform Notes:
+--------------
+Linux: 
+- all: ok.
+  make -f Makefile.generic all
+- tests: need 'm' and 'dl' libs. 
+  ( cd tests ; LDLIBS="-lm -ldl" make -f Makefile.generic )
+- see batch script: buildsys/scripts/batch-build-linux.sh
+
+Minix: No dynload support. No '-fPIC' is allowed.
+- dynload: unsupport, no dynamic linker present in Minix 3.
+- dyn{call,callback}: ok, without '-fPIC'!
+  ( cd dyncall ; CFLAGS= make -f Makefile.generic dyncall dyncallback )
+- tests: ok
+  ( cd test ; make -f Makefile.generic all-dyncall all-dyncallback )
+- see batch script: buildsys/scripts/batch-build-minix.sh
+
+NetBSD/FreeBSD:
+- all: ok.
+  make -f Makefile.generic all
+- tests: need math lib:
+  ( cd tests ; LDLIBS="-lm" make -f Makefile.generic )
+
+OpenBSD:
+- all: ok.
+  make -f Makefile.generic all
+- tests: *.cpp implicit rule not set, therefore only c tests work:
+  ( cd tests ; LDLIBS="-lm" make -f Makefile.generic all-c )
+- install: ok.
+
+Haiku Alpha 2:
+- dynload: elf.h header found, install system source for dynload support
+- dyn{call,callback}: ok.
+  make -f Makefile.generic dyncall dyncallback
+- tests: ok
+  ( cd test ; make -f Makefile.generic all-dyncall all-dyncallback )
+
+
+Build notes related to dyncall:
+-------------------------------
+
+CFLAGS
+  Use '-fPIC' for at least 64-bit systems and when you want the code to be 
+  included as a shared library or module image.
+LDLIBS
+  Use '-lm' for test/suite - it uses pow function.
+  Use '-ldl' for dynload examples such as test/nm and test/resolve_self on Linux.
+
+
+Feature:
+--------
+configure --prefix=<prefix> -> Makefile DESTDIR=variable
+make -f Makefile.generic DESTDIR=<prefix>
+
+
+Todo: 
+-----
+- sun's make: CXX does not exist.. no rule for *.cpp files but *.cc.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.MacOSX	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,31 @@
+Building DynCall on Mac OS X
+============================
+
+
+The build system supports universal binaries (including static libraries) by
+default (i386, x86_64).
+In addition, the desired SDK can be choosen.
+
+Optional configure switches for Mac OS X:
+
+  Operating System:
+    --target=MacOSX (optional, auto-detect)
+
+  SDK:
+    --sdk=<version> (optional, auto-detect)
+
+  Architecture:
+    not specified, builds universal binaries depending on SDK version
+
+
+Configure and build for host platform:
+
+  ./configure
+  make
+  sudo make install
+
+
+Compile for Mac OS X 10.4u:
+
+  configure --target=MacOSX --sdk=10.4u
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.Minix	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,37 @@
+Building DynCall on Minix 3
+===========================
+
+
+Status:
+-------
+- Compiles under GNU tool-chain on Minix 3.1.8 using script for Makefile.generic
+  or by building specific make targets
+- dyncall: tests run ok.
+- dyncallback: minor bugs on dyncallback (some cases fail)
+- dynload: unsupported due to missing dynamic linker.
+- Integration of ACK tool-chain is in progress but not functional at the moment...
+
+
+Building:
+---------
+
+1) using configure and make:
+$ ./configure
+$ make libdyncall libdyncallback
+
+2) or using build script for gcc (using Makefile.generic):
+$ sh buildsys/scripts/batch-build-minix.sh
+
+
+Minix facts:
+------------
+- posix make
+- ACK (Amsterdam Compiler Kit) compiler for C, Modula-2 and Pascal
+  using own Assembly format
+- ACK Assembler:
+   if very first character is '#' - C preprocessor is run..
+
+- Minix 32-bit: 
+- ACK 32-bit compiler: long long is not supported
+- Minix 16-bit: not yet reviewed...
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.NDS	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,25 @@
+Build instructions for DynCall on Nintendo DS
+   using devkitPro and NMake under Windows
+=============================================
+
+
+To build the library, you have to configure it first.
+Since the NDS build uses devkitPro and NMake, assure
+to have them in your %PATH%.
+
+To configure the library, call one of the following,
+depending if you want to use the processor in ARM or
+THUMB mode:
+
+  configure.bat /tool-gcc /target-nds-arm
+  configure.bat /tool-gcc /target-nds-thumb
+
+Note that the /tool-gcc flag is needed, because we're
+using devkitARM (via devkitPro) which is based on the
+GCC toolchain. The /target-nds-* flags don't imply
+this.
+
+Then, call:
+
+  nmake /F Nmakefile
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.PSP	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,30 @@
+Cross-compile DynCall for PSP using PSP-SDK
+===========================================
+
+
+Make sure the PSP SDK's is installed and that the build tools (e.g. psp-gcc) are
+in your PATH. Also make sure that your PSP SDK's include files are in your CPATH
+
+
+Status:
+-------
+
+- dyncall: tests run ok.
+- dyncallback: all good.
+- dynload: unsupported due to missing dynamic linker and ELF headers.
+  
+
+
+There are currently two ways to build dyncall for PSP.
+
+Build using configure and make:
+-------------------------------
+
+  $ ./configure --target=PSP
+  $ make libdyncall libdyncallback
+
+
+Build using build script for gcc (using Makefile.generic):
+----------------------------------------------------------
+  $ sh buildsys/scripts/batch-build-psp.sh
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.SunOS	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,91 @@
+Building DynCall on Solaris and other SunOS distributions
+=========================================================
+
+
+Current Status of Solaris Architectures:
+
+i386      : ok.
+AMD64     : ok.
+SPARC     : no dyncallback support.
+SPARC64   : bugs in dyncall (see BUGS), no dyncallback support.
+
+Supported Compilers: SunPro C/C++ compiler and GCC.
+Supported Build-Systems: configure/make, Makefile.embedded and CMake.
+
+
+Details
+=======
+It has been ported and tested for x86 and sparc32/64 on Solaris 10/X86 
+using the SunPro compiler suite and sun's make. The same goes for
+OpenSolaris distributions - the library builds and runs fine on Nexenta
+x86 and x64.
+On Solaris, it also cross-builds for amd64 just fine, but the we don't
+have access to a x64 Solaris to run the tests.
+
+
+Building DynCall:
+-----------------
+
+  $ ./configure
+  $ make
+
+
+
+It is also possible to use 'Makefile.embedded' for sun make, GNU make and
+BSD make:
+
+
+Build with SUN make and compilers from sun using Makefile.embedded:
+-------------------------------------------------------------------
+
+  $ make -f Makefile.embedded sun
+  $ (cd test; make -f Makefile.embedded sun)
+
+
+Build for sparc64 with SUN make and compilers from sun using Makefile.embedded:
+-------------------------------------------------------------------------------
+
+  $ make -f Makefile.embedded sun-64bit
+  $ (cd test; make -f Makefile.embedded sun-64bit)
+
+
+Build with SUN make and GNU C compiler using Makefile.embedded:
+---------------------------------------------------------------
+
+  $ make -f Makefile.embedded sun-gcc
+  $ (cd test; make -f Makefile.embedded sun-gcc)
+ 
+
+Build for sparc64 with SUN make and GNU C compiler using Makefile.embedded:
+---------------------------------------------------------------------------
+
+  $ make -f Makefile.embedded sun-gcc-64bit
+  $ (cd test; make -f Makefile.embedded sun-gcc-64bit)
+
+
+NOTE: There are still issues with the sparc64 port on Solaris.
+
+
+Build with CMake, Sun make and SunPro for sparc64:
+--------------------------------------------------
+
+  $ cmake -DCMAKE_C_FLAGS=-m64 -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 .
+  $ make
+
+Installation
+------------
+
+  $ make -f Makefile.embedded PREFIX=<some/prefix> install
+
+
+Tested Platforms
+----------------
+
+x86/amd64: 
+  - using Solaris 10 using SunPro Tools
+  - using Nexenta (SunOS 5.11 kernel) using GNU tools
+
+sparc 32/64 bit:
+  - SunOS 5.1 using SunPro and GCC on a Sun Fire V440 via developer account
+    thanks to gwdg.de!
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.Windows	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,64 @@
+Bulding DynCall on Windows
+==========================
+
+
+Build using buildsys/nmake and MS Visual Studio Tools:
+------------------------------------------------------
+
+  32-bit:
+    vcvarsall.bat x86
+    .\configure.bat /target-x86
+    nmake /f Nmakefile
+
+  64-bit:
+    vcvarsall.bat amd64
+    .\configure.bat /target-x64
+    nmake /f Nmakefile
+
+  Build/run tests:
+    cd test
+    nmake /f Nmakefile
+    
+    NOTE: if you encounter 'python'/'lua' not found messages (which is 
+     executed mistakenly for re-generation of test C code)
+     timestamps are wrong; workaround: run "svn revert -R ." several times.
+
+Build using buildsys/gmake and MinGW or Cygwin:
+-----------------------------------------------
+
+  32-bit:
+    .\configure.bat /target-x86 /tool-gcc
+    make
+
+  64-bit:
+    .\configure.bat /target-x64 /tool-gcc
+    make
+
+
+Build using Makefile.embedded and MinGW or Cygwin:
+--------------------------------------------------
+
+    > mingw32-make -f Makefile.embedded
+    $ make -f Makefile.embedded CC=gcc
+
+
+Build using CMake and Nmake:
+----------------------------
+
+  Put the appropriate tool-chain in path (32 or 64-bit version of MSVC), then:
+  
+    cmake -G "NMake Makefiles" %DYNCALL_SOURCE_DIR%
+    nmake
+
+
+Build using CMake and Visual Studio:
+------------------------------------
+ 
+  32-bit:
+    cmake .
+    open DynCall.sln
+
+  BROKEN: SAFE EH.
+
+  BROKEN: Rules to assemble MASM files are still missing.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.embedded	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,84 @@
+Makefile.embedded - hybrid DynCall makefiles for GNU, BSD and SUN make
+======================================================================
+
+
+Brief overview
+--------------
+This is one of the latest build systems designed for DynCall.
+It was designed for being embeddable in bigger 'make' based systems.
+It uses a very simple structure and it does not require any 'configure' phase.
+Instead the user can specify the CFLAGS and LDFLAGS by himself.
+For a couple of platforms, the make system supports phony targets of popular
+operating-systems such as 'bsd'.
+
+Building the library:
+---------------------
+$ make -f Makefile.embedded <variant>
+
+Building the tests:
+-------------------
+$ cd test ; make -f Makefile.embedded <variant>
+
+Installation:
+-------------
+$ make -f Makefile.embedded PREFIX=/usr/local install
+
+Installation with support for DESTDIR:
+--------------------------------------
+$ make -f Makefile.embedded DESTDIR=/tmp/staging PREFIX=/usr/local install
+
+
+Available variants:
+-------------------
+bsd                   Free/Net/Open/DragonFly/Mir BSD     
+linux                 Linux
+osx                   Mac OS X
+osx-universal         Mac OS X universal binaries (i386,x86_64 and ppc)
+sun                   SunOS and Sun Pro compiler
+sun-64bit             SunOS and Sun Pro compiler for sparc64(? amd64) 
+sun-gcc               SunOS and GCC compiler
+sun-gcc-64bit         SunOS and GCC compiler for sparc64 (? amd64)
+ios61                 iOS SDK 6.1 armv7  (untested!)
+ios61-nothumb         iOS SDK 6.1 armv7 -mno-thumb (untested!)
+
+Tweaking the build:
+-------------------
+$ VAR1=<VALUE1> VAR2=<VALUE2> .. make -f Makefile.embedded <variant>
+
+Adding a variant
+-----------------
+Currently we deal with two files to specify a custom target.
+
+The top-level Makefile.embedded controls for building the libraries.
+Useful variables are AR, CC, CFLAGS and ASFLAGS.
+
+The test/Makefile.embedded file controls for building the tests.
+The tests currently involve sometimes C++ and some platforms need
+to link with the math library. Others need the dynamic linker.
+Useful variables are CXX, CC, CCC (Sun), CFLAGS, CCFLAGS (Sun), 
+CXXFLAGS andLDFLAGS.
+
+Background
+----------
+During the preparation for the public release of the R package 'rdyncall' I was 
+looking for a way to get DynCall integrated into an existing Make system such 
+as offered by R for build R packages. 
+
+It was inspired by the make files of Lua which are damn simple and
+don't need a configure but a user that knows the target platform name.
+
+The source package can be configured automatically during compilation and
+does not require explicit configuration anymore using "*.S" files that
+are Assembly files which are preprocessed by the C Preprocessor.
+
+This feature is available by GCC and SunPro compilers.
+
+Limitations
+-----------
+
+Mac OS X universal static libraries require to use 
+
+'libtool -static -o libname.a obj1.o obj2.o ...' instead of 'ar cru libname.a obj1.o obj2.o'.
+We use predefined variables AR and ARFLAGS. 
+The variant osx-universal uses AR=libtool.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.iOS	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,77 @@
+Building DynCall for apple's iOS platforms (iPhone, iPod touch, iPad)
+=====================================================================
+
+
+Environment Setup for Cross-Compilation using iPhone SDK:
+
+  $ source ./buildsys/scripts/setenv-sdk-ios.sh
+
+
+Package Configuration
+
+  $ ./configure --target=iOS --sdk=<MAJOR>.<MINOR>
+
+
+Building
+
+  $ make 
+  
+
+
+Details:
+
+This builds by default universal binaries (armv7,arm64).
+
+Required configure switches:
+
+  --target=[iOS|iPhoneSimulator]
+  
+  --sdk=<version> (tested versions 2.0..4.0, 6.1, 8.3)
+
+
+Supported Tool-chains
+
+  gcc, clang
+
+
+
+
+
+Other ways to build
+-------------------
+
+Building directly with Makefile.embedded ..
+
+  ARMv7 for iOS 6.1
+
+  $ make -f Makefile.embedded ios61-os
+  $ cd test && make -f Makefile.embedded ios61-os
+
+  ARMv7 (no thumb) for iOS 6.1
+
+  $ make -f Makefile.embedded ios61-os-nothumb
+  $ cd test && make -f Makefile.embedded ios61-os-nothumb
+
+  Simulator for iOS 6.1
+
+  $ make -f Makefile.embedded ios61-sim
+  $ cd test && make -f Makefile.embedded ios61-sim
+
+  ARMv7/ARM64 Universal build for iOS 8.3
+
+  $ make -f Makefile.embedded ios83-os-universal
+  $ cd test && make -f Makefile.embedded ios83-os-universal
+
+  Tested Mac OS X platforms: 10.[7,8,10]
+  Tested Xcode toolchains: 4.6, 6.3
+
+
+Building directly with Makefile.generic ..
+
+  $ source buildsys/scripts/setenv-sdk-ios.sh
+  $ source buildsys/scripts/setenv-cross-ios.sh
+
+  make -f Makefile.generic ...
+
+  uses armv6 and sdk 4.3 as default, can be changed in 'setenv-cross-ios.sh'.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/CMakeLists.txt	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,13 @@
+find_package(LATEX)
+if(PDFLATEX_COMPILER)
+  add_custom_command(
+    OUTPUT  manual.pdf
+    COMMAND ${PDFLATEX_COMPILER}
+    ARGS manual.tex
+    DEPENDS manual.tex
+  )
+  file(GLOB CLEAN_FILES *.aux *.log *.lof *.lol *.lot *.out *.toc)
+  set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_FILES}")
+endif()
+add_custom_target(manual ALL echo DEPENDS manual.pdf)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/Makefile.generic	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,21 @@
+all: manual.pdf
+
+sources: *.tex callconvs/*.tex dyncall_logo.* dyncall_watermark.*
+
+manual.pdf: sources
+	# run twice for toc on some tex installs
+	cd ${VPATH} && pdflatex -output-directory=${PWD} manual.tex
+	cd ${VPATH} && pdflatex -output-directory=${PWD} manual.tex
+
+manual.html: manual_tex4ht.cfg sources
+	# Create tex4ht.env from default one, but with better bitmaps
+	cp $$(dirname $$(which tex4ht))/../share/texmf-dist/tex4ht/base/unix/tex4ht.env ${VPATH}/
+	cd ${VPATH} && sed -E -i '' 's/(Text|Graphics)(AlphaBits)=[1,2,3]([^0-9])/\1\2=4\3/g' tex4ht.env
+	cd ${VPATH} && htlatex manual.tex manual_tex4ht " -cunihtf"
+
+clean:
+	# pdf
+	for i in pdf aux lof log lol lot out toc; do rm -f manual.$$i || true; done
+	# html
+	for i in 4ct 4tc css dvi html idv lg tmp xref; do rm -f manual.$$i || true; done
+	for i in manual*x.png manual*.html texput.log manual_*.log zzmanual.eps zzmanual.ps tex4ht.env; do rm -f $$i || true; done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/Nmakefile	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,31 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+#                         Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+TOP   = ..  
+
+!INCLUDE $(TOP)/buildsys/nmake/prolog.nmake
+
+TARGETS=manual.pdf
+manual.pdf: dummy
+
+# Pseudo-targets are always out of date...
+dummy:
+
+!INCLUDE $(TOP)/buildsys/nmake/epilog.nmake
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_arm32.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,322 @@
+%
+% Copyright (c) 2007,2010 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+
+% ==================================================
+% ARM32
+% ==================================================
+\subsection{ARM32 Calling Convention}
+
+\paragraph{Overview}
+
+The ARM32 family of processors is based on 
+the Advanced RISC Machines (ARM) processor architecture (32 bit RISC). 
+The word size is 32 bits (and the programming model is LLP64).\\
+Basically, this family of microprocessors can be run in 2 major modes:\\
+\\
+\begin{tabular}{2 B}
+\hline
+Mode          & Description\\
+\hline
+{\bf ARM}     & 32bit instruction set\\
+{\bf THUMB}   & compressed instruction set using 16bit wide instruction encoding\\
+\hline
+\end{tabular}
+\\
+\\
+For more details, take a look at the ARM-THUMB Procedure Call Standard (ATPCS) \cite{ATPCS}, the Procedure Call Standard for the ARM Architecture (AAPCS) \cite{AAPCS}, as well as the Debian ARM EABI port wiki \cite{armeabi}.
+
+
+\paragraph{\product{dyncall} support}
+
+Currently, the \product{dyncall} library supports the ARM and THUMB mode of the ARM32 family (ATPCS \cite{ATPCS} and EABI \cite{armeabi}), excluding manually triggered ARM-THUMB interworking calls. Although it's quite possible that the current implementation runs on other ARM processor families as well, please note that only the ARMv4t family has been thoroughly tested at the time of writing. Please report if the code runs on other ARM families, too.\\
+It is important to note, that dyncall supports the ARM architecture calling convention variant {\bf with floating point hardware disabled} (meaning that the FPA and the VFP (scalar mode) procedure call standards are not supported).
+This processor family features some instruction sets accelerating DSP and multimedia application like the ARM Jazelle Technology (direct Java bytecode execution, providing acceleration for some bytecodes while calling software code for others), etc. that are not supported by the dyncall library.\\
+
+
+\subsubsection{ATPCS ARM mode}
+
+
+\paragraph{Registers and register usage}
+
+In ARM mode, the ARM32 processor has sixteen 32 bit general purpose registers, namely r0-r15:\\
+\\
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name         & Brief description\\
+\hline
+{\bf r0}     & parameter 0, scratch, return value\\
+{\bf r1}     & parameter 1, scratch, return value\\
+{\bf r2-r3}  & parameters 2 and 3, scratch\\
+{\bf r4-r10} & permanent\\
+{\bf r11}    & frame pointer, permanent\\
+{\bf r12}    & scratch\\
+{\bf r13}    & stack pointer, permanent\\
+{\bf r14}    & link register, permanent\\
+{\bf r15}    & program counter (note: due to pipeline, r15 points to 2 instructions ahead)\\
+\hline
+\end{tabular}
+\caption{Register usage on arm32}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item first four words are passed using r0-r3
+\item subsequent parameters are pushed onto the stack (in right to left order, such that the stack pointer points to the first of the remaining parameters)
+\item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first four words to a reserved stack area adjacent to the other parameters on the stack
+\item parameters \textless=\ 32 bits are passed as 32 bit words
+\item 64 bit parameters are passed as two 32 bit parts (even partly via the register and partly via the stack), although this doesn't seem to be specified in the ATPCS), with the loword coming first
+\item structures and unions are passed by value, with the first four words of the parameters in r0-r3
+\item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc... (see {\bf return values})
+\item keeping the stack eight-byte aligned can improve memory access performance and is required by LDRD and STRD on ARMv5TE processors which are part of the ARM32 family, so, in order to avoid problems one should always align the stack (tests have shown, that GCC does care about the alignment when using the ellipsis)
+\end{itemize}
+
+\paragraph{Return values}
+\begin{itemize}
+\item return values \textless=\ 32 bits use r0
+\item 64 bit return values use r0 and r1
+\item if return value is a structure, the caller allocates space for the return value on the stack in its frame and passes a pointer to it in r0
+\end{itemize}
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                         & \vdots &                                      &                              \\
+\hhline{~=~~}
+register save area                       &        &                                      & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+local data                               &        &                                      &                              \\
+\hhline{~-~~}
+\mrlbrace{7}{parameter area}             & \ldots & \mrrbrace{3}{stack parameters}       &                              \\
+                                         & \ldots &                                      &                              \\
+                                         & \ldots &                                      &                              \\
+\hhline{~=~~}
+                                         & r3     & \mrrbrace{4}{spill area (if needed)} & \mrrbrace{7}{current frame}  \\
+                                         & r2     &                                      &                              \\
+                                         & r1     &                                      &                              \\
+                                         & r0     &                                      &                              \\
+\hhline{~-~~}
+register save area (with return address) &        &                                      &                              \\
+\hhline{~-~~}
+local data                               &        &                                      &                              \\
+\hhline{~-~~}
+parameter area                           & \vdots &                                      &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on arm32}
+\end{figure}
+
+
+\newpage
+
+\subsubsection{ATPCS THUMB mode}
+
+
+\paragraph{Status}
+
+\begin{itemize}
+\item The ATPCS THUMB mode is untested.
+\item Ellipse calls may not work.
+\item C++ this calls do not work.
+\end{itemize}
+
+\paragraph{Registers and register usage}
+
+In THUMB mode, the ARM32 processor family supports eight 32 bit general purpose registers r0-r7 and access to high order registers r8-r15:\\
+\\
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name         & Brief description\\
+\hline
+{\bf r0}     & parameter 0, scratch, return value\\
+{\bf r1}     & parameter 1, scratch, return value\\
+{\bf r2-r3}  & parameters 2 and 3, scratch\\
+{\bf r4-r6}  & permanent\\
+{\bf r7}     & frame pointer, permanent\\
+{\bf r8-r11} & permanent\\
+{\bf r12}    & scratch\\
+{\bf r13}    & stack pointer, permanent\\
+{\bf r14}    & link register, permanent\\
+{\bf r15}    & program counter (note: due to pipeline, r15 points to 2 instructions ahead)\\
+\hline
+\end{tabular}
+\caption{Register usage on arm32 thumb mode}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item first four words are passed using r0-r3
+\item subsequent parameters are pushed onto the stack (in right to left order, such that the stack pointer points to the first of the remaining parameters)
+\item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first four words to a reserved stack area adjacent to the other parameters on the stack
+\item parameters \textless=\ 32 bits are passed as 32 bit words
+\item 64 bit parameters are passed as two 32 bit parts (even partly via the register and partly via the stack), although this doesn't seem to be specified in the ATPCS), with the loword coming first
+\item structures and unions are passed by value, with the first four words of the parameters in r0-r3
+\item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc. (see {\bf return values})
+\item keeping the stack eight-byte aligned can improve memory access performance and is required by LDRD and STRD on ARMv5TE processors which are part of the ARM32 family, so, in order to avoid problems one should always align the stack (tests have shown, that GCC does care about the alignment when using the ellipsis)
+\end{itemize}
+
+
+\paragraph{Return values}
+\begin{itemize}
+\item return values \textless=\ 32 bits use r0
+\item 64 bit return values use r0 and r1
+\item if return value is a structure, the caller allocates space for the return value on the stack in its frame and passes a pointer to it in r0
+\end{itemize}
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                         & \vdots &                                      &                              \\
+\hhline{~=~~}
+register save area                       &        &                                      & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+local data                               &        &                                      &                              \\
+\hhline{~-~~}
+\mrlbrace{7}{parameter area}             & \ldots & \mrrbrace{3}{stack parameters}       &                              \\
+                                         & \ldots &                                      &                              \\
+                                         & \ldots &                                      &                              \\
+\hhline{~=~~}
+                                         & r3     & \mrrbrace{4}{spill area (if needed)} & \mrrbrace{7}{current frame}  \\
+                                         & r2     &                                      &                              \\
+                                         & r1     &                                      &                              \\
+                                         & r0     &                                      &                              \\
+\hhline{~-~~}
+register save area (with return address) &        &                                      &                              \\
+\hhline{~-~~}
+local data                               &        &                                      &                              \\
+\hhline{~-~~}
+parameter area                           & \vdots &                                      &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on arm32 thumb mode}
+\end{figure}
+
+
+
+\newpage
+
+\subsubsection{EABI (ARM and THUMB mode)}
+
+
+The ARM EABI is very similar to the ABI outlined in ARM-THUMB procedure call
+standard (ATPCS) \cite{ATPCS} - however, the EABI requires the stack to be
+8-byte aligned at function entries, as well as 64 bit parameters. The latter
+are aligned on 8-byte boundaries on the stack and 2-registers for parameters
+passed via register. In order to achieve such an alignment, a register might
+have to be skipped for parameters passed via registers, or 4-bytes on the stack
+for parameters passed via the stack. Refer to the Debian ARM EABI port wiki for more information \cite{armeabi}.
+
+
+\paragraph{Status}
+
+\begin{itemize}
+\item The EABI THUMB mode is tested and works fine (contrary to the ATPCS).
+\item Ellipse calls do not work.
+\item C++ this calls do not work.
+\end{itemize}
+
+\newpage
+
+\subsubsection{ARM on Apple's iOS (Darwin) Platform}
+
+
+The iOS runs on ARMv6 (iOS 2.0) and ARMv7 (iOS 3.0) architectures.
+Typically code is compiled in Thumb mode.
+
+\paragraph{Register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name         & Brief description\\
+\hline
+{\bf R0}     & parameter 0, scratch, return value\\
+{\bf R1}     & parameter 1, scratch, return value\\
+{\bf R2-R3}  & parameters 2 and 3, scratch\\
+{\bf R4-R6}  & permanent\\
+{\bf R7}     & frame pointer, permanent\\
+{\bf R8}     & permanent\\
+{\bf R9}     & permanent(iOS 2.0) and scratch (since iOS 3.0)\\
+{\bf R10-R11}& permanent\\
+{\bf R12}    & scratch, intra-procedure scratch register (IP) used by dynamic linker\\
+{\bf R13}    & stack pointer, permanent\\
+{\bf R14}    & link register, permanent\\
+{\bf R15}    & program counter (note: due to pipeline, r15 points to 2 instructions ahead)\\
+{\bf CPSR}   & Program status register\\
+{\bf D0-D7}  & scratch. aliases S0-S15, on ARMv7 alsa as Q0-Q3. Not accessible from Thumb mode on ARMv6.\\
+{\bf D8-D15} & permanent, aliases S16-S31, on ARMv7 alsa as Q4-A7. Not accesible from Thumb mode on ARMv6.\\
+{\bf D16-D31}& Only available in ARMv7, aliases Q8-Q15.\\
+{\bf FPSCR}  & VFP status register.\\
+\hline
+\end{tabular}
+\caption{Register usage on ARM Apple iOS}
+\end{table}
+
+The ABI is based on the AAPCS but with some important differences listed below:
+
+\begin{itemize}
+\item R7 instead of R11 is used as frame pointer
+\item R9 is scratch since iOS 3.0, was preserved before.
+\end{itemize}
+
+\subsubsection{Architectures}
+
+The ARM architecture family contains several revisions with capabilities and
+extensions (such as thumb-interworking and more vector registers) 
+The following table summaries important properties of the various 
+architecture standards.
+
+% iPhone 3GS : ARM Cortex-A8
+% Nintendo DS: ARM 7 and ARM 9
+% ARM 7: ARMv4T
+% ARM 9: ARMv4T, HTC Wizard
+
+\begin{table}[h]
+\begin{tabular}{lll}
+Arch   & Platforms & Details \\
+\hline
+ARMv4  & & \\
+\hline
+ARMv4T & ARM 7, ARM 9, Neo FreeRunner (OpenMoko) & \\
+\hline
+ARMv5  & & BLX instruction available \\
+\hline
+ARMv6  & & No vector registers available in thumb \\
+\hline
+ARMv7  & iPod touch, iPhone 3GS/4 & \\ 
+\hline
+\end{tabular}
+\caption{Overview of ARM Architecture, Platforms and Details}
+\end{table}
+
+\newpage
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_arm64.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,138 @@
+%
+% Copyright (c) 2014,2015 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+
+% ==================================================
+% ARM64
+% ==================================================
+\subsection{ARM64 Calling Convention}
+
+\paragraph{Overview}
+
+ARMv8 introduced the AArch64 calling convention. ARM64 chips can be run in 64 or 32bit mode, but not by the same process. Interworking is only intre-process.\\
+The word size is defined to be 32 bits, a dword 64 bits. Note that this is due to historical reasons (terminology
+didn't change from ARM32).\\
+For more details, take a look at the Procedure Call Standard for the ARM 64-bit Architecture \cite{AAPCS64}.
+
+
+\paragraph{\product{dyncall} support}
+
+The \product{dyncall} library supports the ARM 64-bit AArch64 PCS ABI, for calls and callbacks.
+
+\subsubsection{AAPCS64 Calling Convention}
+
+\paragraph{Registers and register usage}
+
+ARM64 features thirty-one 64 bit general purpose registers, namely x0-x30. Also, there is SP, a register with restricted use, used for the stack pointer, and PC dedicated as program counter. Additionally, there are thirty-two 128 bit registers v0-v31, to be used as SIMD and floating point registers, referred to as q0-q31, d0-d31 and s0-s31, respectively, depending on their use:\\
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline        
+{\bf x0-x7}   & parameters, scratch, return value\\
+{\bf x8}      & indirect result location pointer\\
+{\bf x9-x15}  & scratch\\
+{\bf x16}     & permanent in some cases, can have special function (IP0), see doc\\
+{\bf x17}     & permanent in some cases, can have special function (IP1), see doc\\
+{\bf x18}     & reserved as platform register, advised not to be used for handwritten, portable asm, see doc \\
+{\bf x19-x28} & permanent\\
+{\bf x29}     & permanent, frame pointer\\
+{\bf x30}     & permanent, link register\\
+{\bf SP}      & permanent, stack pointer\\
+{\bf PC}      & program counter\\
+\hline
+\end{tabular}
+\caption{Register usage on arm64}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item first 8 integer arguments are passed using x0-x7
+\item first 8 floating point arguments are passed using d0-d7
+\item subsequent parameters are pushed onto the stack
+\item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first 8 integer and 8 floating-point registers to a reserved stack area adjacent to the other parameters on the stack (only the unnamed parameters require saving, though)
+\item structures and unions are passed by value, with the first four words of the parameters in r0-r3
+\item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc... (see {\bf return values})
+\item stack is required to be throughout eight-byte aligned
+\end{itemize}
+
+\paragraph{Return values}
+\begin{itemize}
+\item integer return values use x0
+\item floating-point return values use d0
+\item otherwise, the caller allocates space, passes pointer to it to the callee through x8, and callee writes return value to this space
+\end{itemize}
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                   & \vdots &                                       &                              \\
+\hhline{~=~~}                                                                       
+register save area                 &        &                                       & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}                                                                       
+local data                         &        &                                       &                              \\
+\hhline{~-~~}                                                                       
+\mrlbrace{13}{parameter area}      & \ldots & \mrrbrace{3}{stack parameters}        &                              \\
+                                   & \ldots &                                       &                              \\
+                                   & \ldots &                                       &                              \\
+\hhline{~=~~}
+                                   & x0     & \mrrbrace{10}{spill area (if needed)} & \mrrbrace{15}{current frame} \\
+                                   & x1     &                                       &                              \\
+                                   & \ldots &                                       &                              \\
+                                   & x2     &                                       &                              \\
+                                   & x7     &                                       &                              \\
+                                   & d0     &                                       &                              \\
+                                   & d1     &                                       &                              \\
+                                   & \ldots &                                       &                              \\
+                                   & d2     &                                       &                              \\
+                                   & d7     &                                       &                              \\
+\hhline{~-~~}                                                                       
+register save area                 &        &                                       &                              \\
+\hhline{~-~~}                                                                       
+local data                         &        &                                       &                              \\
+\hhline{~-~~}                                                                       
+link and frame register            & x30    &                                       &                              \\
+                                   & x29    &                                       &                              \\
+\hhline{~-~~}                                                                       
+parameter area                     & \vdots &                                       &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on arm64}
+\end{figure}
+
+\newpage
+
+
+\subsubsection{Apple's ARM64 Function Calling Conventions}
+
+\paragraph{Overview}
+
+Apple's ARM64 calling convention is based on the AAPCS64 standard, however, diverges in some ways.
+Only the differences are listed here, for more details, take a look at Apple's official documentation \cite{AppleARM64}.
+
+\begin{itemize}
+\item arguments passed via stack use only the space they need, but are subject to the type alignment requirements (which is 1 byte for char and bool, 2 for short, 4 for int and 8 for every other type)
+\item caller is required to sign and zero-extend arguments smaller than 32bits
+\end{itemize}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_mips.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,117 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+\subsection{MIPS Calling Convention}
+
+\paragraph{Overview}
+
+The MIPS family of processors is based on the MIPS processor architecture.
+Multiple revisions of the MIPS Instruction set exist, namely MIPS I, MIPS II, MIPS III, MIPS IV, MIPS32 and MIPS64.
+Today, MIPS32 and MIPS64 for 32-bit and 64-bit respectively.\\
+Several add-on extensions exist for the MIPS family: 
+
+\begin{description}
+\item [MIPS-3D] simple floating-point SIMD instructions dedicated to common 3D tasks.
+\item [MDMX] (MaDMaX) more extensive integer SIMD instruction set using 64 bit floating-point registers.
+\item [MIPS16e] adds compression to the instruction stream to make programs take up less room (allegedly a response to the THUMB instruction set of the ARM architecture).
+\item [MIPS MT] multithreading additions to the system similar to HyperThreading.
+\end{description}
+
+Unfortunately, there is actually no such thing as "The MIPS Calling Convention".  Many possible conventions are used
+by many different environments such as \emph{32}, \emph{O64}, \emph{N32}, \emph{64} and \emph{EABI}.
+
+\paragraph{\product{dyncall} support}
+
+Currently, dyncall supports the EABI calling convention which is used on the Homebrew SDK for the Playstation Portable.
+As documentation for this EABI is unofficial, this port is currently experimental.
+
+\subsubsection{MIPS EABI 32-bit Calling Convention}
+
+\paragraph{Register usage}
+
+\begin{table}[h]
+\begin{tabular}{lll}
+\hline
+Name                                   & Alias                     & Brief description\\
+\hline                                                             
+{\bf \$0}                              & {\bf \$zero}              & Hardware zero \\
+{\bf \$1}                              & {\bf \$at}                & Assembler temporary \\
+{\bf \$2-\$3}                          & {\bf \$v0-\$v1}           & Integer results \\
+{\bf \$4-\$11}                         & {\bf \$a0-\$a7}           & Integer arguments\\
+{\bf \$12-\$15,\$24,\$25}              & {\bf \$t4-\$t7,\$t8,\$t9} & Integer temporaries \\
+{\bf \$25}                             & {\bf \$t9}                & Integer temporary, hold the address of the called function for all PIC calls (by convention) \\
+{\bf \$16-\$23}                        & {\bf \$s0-\$s7}           & Preserved \\
+{\bf \$26,\$27}                        & {\bf \$kt0,\$kt1}         & Reserved for kernel \\
+{\bf \$28}                             & {\bf \$gp}                & Global pointer \\
+{\bf \$29}                             & {\bf \$sp}                & Stack pointer \\
+{\bf \$30}                             & {\bf \$s8}                & Frame pointer \\
+{\bf \$31}                             & {\bf \$ra}                & Return address \\
+{\bf hi, lo}                           &                           & Multiply/divide special registers \\
+{\bf \$f0,\$f2}                        &                           & Float results \\
+{\bf \$f1,\$f3,\$f4-\$f11,\$f20-\$f23} &                           & Float temporaries \\
+{\bf \$f12-\$f19}                      &                           & Float arguments \\
+\end{tabular}
+\caption{Register usage on mips32 eabi calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item Stack parameter order: right-to-left
+\item Caller cleans up the stack
+\item Stack always aligned to 8 bytes.
+\item first 8 integers and floats are passed independently in registers using \$a0-\$a7 and \$f12-\$f19, respectively.
+\item if either integer or float registers are consumed up, the stack is used.
+\item 64-bit floats and integers are passed on two integer registers starting at an even register number, probably skipping one odd register.
+\item \$a0-\$a7 and \$f12-\$f19 are not required to be preserved.
+\item results are returned in \$v0 (32-bit integer), \$v0 and \$v1 (64-bit integer/float), \$f0 (32 bit float) and \$f0 and \$f2 (2 $\times$ 32 bit float e.g. complex).
+\end{itemize}
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+register save area                &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+local data                        &                            &                                &   \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~=~~}
+register save area (with return address) &                            &                                & \mrrbrace{5}{current frame}  \\
+\hhline{~-~~}
+local data                         &                            &                                &                              \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\\
+\\
+\\
+\caption{Stack layout on mips32 eabi calling convention}
+\end{figure}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_mips64.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,33 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+\subsection{MIPS64 Calling Convention}
+
+\paragraph{Overview}
+
+TBC.
+
+\paragraph{\product{dyncall} support}
+
+We are currently working on that.
+
+Our test machine is a Loongson-CPU 2F subnotebook with OpenBSD.
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_ppc32.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,249 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+% ==================================================
+% PowerPC 32
+% ==================================================
+\subsection{PowerPC (32bit) Calling Convention}
+
+\paragraph{Overview}
+
+\begin{itemize}
+\item Word size is 32 bits
+\item Big endian (MSB) and litte endian (LSB) operating modes.
+\item Processor operates on floats in double precision floating point arithmetc (IEEE-754) values directly (single precision is converted on the fly)
+\item Apple Mac OS X/Darwin PPC is specified in "Mac OS X ABI Function Call Guide"\cite{ppcMacOSX}. It uses Big Endian (MSB).
+\item Linux PPC 32-bit ABI is specified in "LSB for PPC"\cite{ppc32LSB} which is based on "System V ABI". It uses Big Endian (MSB).
+\item PowerPC EABI is defined in the "PowerPC Embedded Application Binary Interface 32-Bit Implementation".
+\end{itemize}
+
+
+\paragraph{\product{dyncall} support}
+
+\product{Dyncall} and \product{dyncallback} are supported for PowerPC (32bit) Big Endian (MSB) on Darwin (tested on Apple Mac OS X) and Linux, however, fail for *BSD.
+
+
+\subsubsection{Mac OS X/Darwin}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name                & Brief description\\
+\hline
+{\bf gpr0}          & scratch\\
+{\bf gpr1}          & stack pointer\\
+{\bf gpr2}          & scratch\\
+{\bf gpr3}          & return value, parameter 0 if integer or pointer\\
+{\bf gpr4-gpr10}    & return value, parameter 1-7 for integer or pointer parameters\\
+{\bf gpr11}         & permanent\\
+{\bf gpr12}         & branch target for dynamic code generation\\
+{\bf gpr13-31}      & permanent\\
+{\bf fpr0}          & scratch\\
+{\bf fpr1-fpr13}    & parameter 0-12 for floating point (always double precision)\\
+{\bf fpr14-fpr31}   & permanent\\
+{\bf v0-v1}         & scratch\\
+{\bf v2-v13}        & vector parameters\\
+{\bf v14-v19}       & scratch\\
+{\bf v20-v31}       & permanent\\
+{\bf lr}            & scratch, link-register\\
+{\bf ctr}           & scratch, count-register\\
+{\bf cr0-cr1}       & scratch\\
+{\bf cr2-cr4}       & permanent\\
+{\bf cr5-cr7}       & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on Darwin PowerPC 32-Bit}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left@@@?
+\item caller cleans up the stack@@@?
+\item the first 8 integer parameters are passed in registers gpr3-gpr10
+\item the first 12 floating point parameters are passed in registers fpr1-fpr13
+\item if a float parameter is passed via a register, gpr registers are skipped for subsequent integer parameters (based on the size of
+the float - 1 register for single precision and 2 for double precision floating point values)
+\item the caller pushes subsequent parameters onto the stack
+\item for every parameter passed via a register, space is reserved in the stack parameter area (in order to spill the parameters if
+needed - e.g. varargs)
+\item ellipsis calls take floating point values in int and float registers (single precision floats are promoted to double precision
+as defined for ellipsis calls)
+\item all nonvector parameters are aligned on 4-byte boundaries
+\item vector parameters are aligned on 16-byte boundaries
+\item integer parameters \textless\ 32 bit occupy high-order bytes of their 4-byte area
+\item composite parameters with size of 1 or 2 bytes occupy low-order bytes of their 4-byte area. INCONSISTENT with other 32-bit PPC
+binary interfaces. In AIX and OS 9, padding bytes always follow the data structure
+\item composite parameters 3 bytes or larger in size occupy high-order bytes
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of integer \textless=\ 32bit or pointer type use gpr3
+\item 64 bit integers use gpr3 and gpr4 (hiword in gpr3, loword in gpr4)
+\item floating point values are returned via fpr1
+\item structures \textless=\ 64 bits use gpr3 and gpr4
+\item for types \textgreater\ 64 bits, a secret first parameter with an address to the return value is passed
+\end{itemize}
+
+\pagebreak
+
+\paragraph{Stack layout}
+
+Stack frame is always 16-byte aligned. Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots              &                                      &                               \\
+\hhline{~=~~}
+local data                        &                     &                                      & \mrrbrace{13}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{6}{parameter area}      & \ldots              & \mrrbrace{3}{stack parameters}       &                               \\
+                                  & \ldots              &                                      &                               \\
+                                  & \ldots              &                                      &                               \\
+                                  & \ldots              & \mrrbrace{3}{spill area (as needed)} &                               \\
+                                  & \ldots              &                                      &                               \\
+                                  & gpr3 or fpr1        &                                      &                               \\
+\hhline{~-~~}
+\mrlbrace{6}{linkage area}        & reserved            &                                      &                               \\
+                                  & reserved            &                                      &                               \\
+                                  & reserved            &                                      &                               \\
+                                  & return address      &                                      &                               \\
+                                  & reserved for callee &                                      &                               \\
+                                  & saved by callee     &                                      &                               \\
+\hhline{~=~~}
+local data                        &                     &                                      & \mrrbrace{3}{current frame}   \\
+\hhline{~-~~}
+parameter area                    &                     &                                      &                               \\
+\hhline{~-~~}
+linkage area                      & \vdots              &                                      &                               \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on ppc32 Darwin}
+\end{figure}
+
+\subsubsection{System V PPC 32-bit}
+
+\paragraph{Status}
+
+\begin{itemize}
+\item C++ this calls do not work.
+\item Callbacks don't work on *BSD.
+\end{itemize}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name                & Brief description\\
+\hline
+{\bf r0}          & scratch\\
+{\bf r1}          & stack pointer\\
+{\bf r2}          & system-reserved\\
+{\bf r3-r4}       & parameter passing and return value\\
+{\bf r5-r10}      & parameter passing\\
+{\bf r11-r12}     & scratch\\
+{\bf r13}         & Small data area pointer register\\
+{\bf r14-r30}     & Local variables\\
+{\bf r31}         & Used for local variables or \emph{environment pointer}\\
+{\bf f0}          & scratch\\
+{\bf f1}          & parameter passing and return value\\
+{\bf f2-f8}       & parameter passing\\
+{\bf f9-13}       & scratch\\
+{\bf f14-f31}     & Local variables\\
+{\bf cr0-cr7}     & Conditional register fields, each 4-bit wide (cr0-cr1 and   cr5-cr7 are scratch)\\
+{\bf lr}          & Link register (scratch)\\
+{\bf ctr}         & Count register (scratch) \\
+{\bf xer}         & Fixed-point exception register (scratch)\\
+{\bf fpscr}       & Floating-point Status and Control Register\\
+
+% {\bf v0-v1}         & scratch\\
+% {\bf v2-v13}        & vector parameters\\
+% {\bf v14-v19}       & scratch\\
+% {\bf v20-v31}       & permanent\\
+% {\bf lr}            & scratch, link-register\\
+% {\bf ctr}           & scratch, count-register\\
+% {\bf cr0-cr1}       & scratch\\
+% {\bf cr2-cr4}       & permanent\\
+% {\bf cr5-cr7}       & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on System V ABI PowerPC Processor}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item Stack pointer (r1) is always 16-byte aligned. The EABI differs here - it is 8-byte alignment.
+\item 8 general-purpose registers (r3-r10) for integer and pointer types.
+\item 8 floating-pointer registers (f1-f8) for float (promoted to double) and double types.
+\item Additional arguments are passed on the stack directly after the back-chain and saved return address (8 bytes structure) on the callers stack frame.
+\item 64-bit integer data types are passed in general-purpose registers as a whole in two
+ 32-bit general purpose registers (an odd and an even e.g. r3 and r4), probably skipping an even integer register.
+ or passed on the stack. They are never splitted into a register and stack part.
+\item Ellipse calls set CR bit 6 
+
+\end{itemize}
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item 32-bit integers use register r3, 64-bit use registers r3 and r4 (hiword in r3, loword in r4).
+\item floating-point values are returned using register f1.
+\end{itemize}
+
+\pagebreak
+
+\paragraph{Stack layout}
+
+Stack frame is always 16-byte aligned. Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{6}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & saved return address (for callee) &                                &                              \\
+\hhline{~-~~}
+                                  & parent stack frame pointer &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\\
+\\
+\\
+\caption{Stack layout on System V ABI for PowerPC 32-bit calling convention}
+\end{figure}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_ppc64.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,60 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+% ==================================================
+% PowerPC 64
+% ==================================================
+\subsection{PowerPC (64bit) Calling Convention}
+
+\paragraph{Overview}
+
+\begin{itemize}
+\item Word size is 64 bits
+\item Big endian (MSB) and litte endian (LSB) operating modes.
+\item Apple Mac OS X/Darwin PPC is specified in "Mac OS X ABI Function Call Guide"\cite{ppcMacOSX}. It uses Big Endian (MSB).
+\item Linux PPC 64-bit ABI is specified in "64-bit PowerPC ELF Application Binary Interface Supplement"\cite{ppcelf64abi} which is based on "System V ABI".
+\end{itemize}
+
+
+\paragraph{\product{dyncall} support}
+
+\product{Dyncall} supports PowerPC (64bit) Big Endian and Little Endian ELF ABIs on System V systems (Linux, etc.). Mac OS X is not supported.
+
+
+\subsubsection{PPC64 ELF ABI}
+
+\paragraph{Registers and register usage}
+
+@@@
+
+
+\paragraph{Parameter passing}
+
+@@@
+
+
+\paragraph{Return values}
+
+@@@
+
+
+\paragraph{Stack layout}
+
+@@@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_sparc.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,103 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2012 Daniel Adler <dadler@uni-goettingen.de>, 
+%                    Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+\subsection{SPARC Calling Convention}
+
+\paragraph{Overview}
+
+The SPARC family of processors is based on the SPARC instruction set architecture, which comes in basically tree revisions,
+V7, V8 and V9. The former two are 32-bit whereas the latter refers to the 64-bit SPARC architecture (see next chapter). SPARC is big endian.
+
+\paragraph{\product{dyncall} support}
+
+\product{dyncall} fully supports the SPARC 32-bit instruction set (V7 and V8), \product{dyncallback} support is missing, though.
+
+\subsubsection{SPARC (32-bit) Calling Convention}
+
+\paragraph{Register usage}
+
+\begin{itemize}
+\item 32 32-bit integer/pointer registers
+\item 32 floating point registers (usable as 8 quad precision, 16 double precision or 32 single precision registers)
+\item 32 registers are accessible at a time (8 are global ones (g*), whereas the rest forms a register window with 8 input (i*), 8 output (o*) and 8 local (l*) ones)
+\item invoking a function shifts the register window, the old output registers become the new input registers (old local and input ones are not accessible anymore)
+\end{itemize}
+
+\begin{table}[h]
+\begin{tabular}{lll}
+\hline
+Name                                 & Alias                   & Brief description\\
+\hline
+{\bf \%g0}                           &                         & Read-only, hardwired to 0 \\
+{\bf \%g1-\%g7}                      &                         & Global \\
+{\bf \%o0 and \%i0}                  &                         & Output and input argument 0, return value \\
+{\bf \%o1-\%o5 and \%i1-\%i5}        &                         & Output and input argument registers \\
+{\bf \%o6 and \%i6}                  &                         & Stack and frame pointer \\
+{\bf \%o7 and \%i7}                  &                         & Return address (caller writes to o7, callee uses i7) \\
+\end{tabular}
+\caption{Register usage on sparc calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+\begin{itemize}
+\item Stack parameter order: right-to-left @@@ really?
+\item Caller cleans up the stack @@@ really?
+\item Stack always aligned to 8 bytes.
+\item first 6 integers and floats are passed independently in registers using \%o0-\%o5
+\item for every other argument the stack is used
+\item @@@ what about floats, 64bit integers, etc.?
+\item results are returned in \%i0, and structs/unions pass a pointer to them as a hidden stack parameter (see below)
+\end{itemize}
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                   & \vdots                      &                                &                               \\
+\hhline{~=~~}
+local data                         &                             &                                & \mrrbrace{10}{caller's frame} \\
+\hhline{~-~~}
+padding                            &                             &                                &                               \\
+\hhline{~-~~}
+\mrlbrace{7}{parameter area}       & argument x                  & \mrrbrace{3}{stack parameters} &                               \\
+                                   & \ldots                      &                                &                               \\
+                                   & argument 6                  &                                &                               \\
+                                   & input argument 5 spill      & \mrrbrace{3}{spill area}       &                               \\
+                                   & \ldots                      &                                &                               \\
+                                   & input argument 0 spill      &                                &                               \\
+                                   & struct/union return pointer &                                &                               \\
+\hhline{~-~~}
+register save area (\%i* and \%l*) &                             &                                &                               \\
+\hhline{~=~~}
+local data and padding             &                             &                                & \mrrbrace{3}{current frame}   \\
+\hhline{~-~~}
+parameter area                     &                             &                                &                               \\
+\hhline{~-~~}
+                                   & \vdots                      &                                &                               \\
+\hhline{~-~~}
+\end{tabular}
+\\
+\\
+\\
+\caption{Stack layout on sparc calling convention}
+\end{figure}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_sparc64.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,33 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2012 Daniel Adler <dadler@uni-goettingen.de>, 
+%                    Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+\subsection{SPARC64 Calling Convention}
+
+\paragraph{Overview}
+
+The SPARC family of processors is based on the SPARC instruction set architecture, which comes in basically tree revisions,
+V7, V8 and V9. The former two are 32-bit (see previous chapter) whereas the latter refers to the 64-bit SPARC architecture. SPARC is big endian.
+
+\paragraph{\product{dyncall} support}
+
+\product{dyncall} fully supports the SPARC 64-bit instruction set (V9), \product{dyncallback} support is missing, though.
+
+\subsubsection{SPARC (64-bit) Calling Convention}
+
+@@@ finish
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_x64.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,239 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+% ==================================================
+% x64
+% ==================================================
+\subsection{x64 Calling Convention}
+
+
+\paragraph{Overview}
+
+The x64 (64bit) architecture designed by AMD is based on Intel's x86 (32bit)
+architecture, supporting it natively. It is sometimes referred to as x86-64,
+AMD64, or, cloned by Intel, EM64T or Intel64.\\
+On this processor, a word is defined to be 16 bits in size, a dword 32 bits
+and a qword 64 bits. Note that this is due to historical reasons (terminology
+didn't change with the introduction of 32 and 64 bit processors).\\
+The x64 calling convention for MS Windows \cite{x64Win} differs from the
+SystemV x64 calling convention \cite{x64SysV} used by Linux/*BSD/...
+Note that this is not the only difference between these operating systems. The
+64 bit programming model in use by 64 bit windows is LLP64, meaning that the C
+types int and long remain 32 bits in size, whereas long long becomes 64 bits.
+Under Linux/*BSD/... it's LP64.\\
+\\
+Compared to the x86 architecture, the 64 bit versions of the registers are
+called rax, rbx, etc.. Furthermore, there are eight new general purpose
+registers r8-r15.
+
+
+
+\paragraph{\product{dyncall} support}
+
+\product{dyncall} supports the MS Windows and System V calling convention.\\
+\\
+
+
+
+\subsubsection{MS Windows}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name                & Brief description\\
+\hline
+{\bf rax}           & scratch, return value\\
+{\bf rbx}           & permanent\\
+{\bf rcx}           & scratch, parameter 0 if integer or pointer\\
+{\bf rdx}           & scratch, parameter 1 if integer or pointer\\
+{\bf rdi}           & permanent\\
+{\bf rsi}           & permanent\\
+{\bf rbp}           & permanent, may be used ase frame pointer\\
+{\bf rsp}           & stack pointer\\
+{\bf r8-r9}         & scratch, parameter 2 and 3 if integer or pointer\\
+{\bf r10-r11}       & scratch, permanent if required by caller (used for syscall/sysret)\\
+{\bf r12-r15}       & permanent\\
+{\bf xmm0}          & scratch, floating point parameter 0, floating point return value\\
+{\bf xmm1-xmm3}     & scratch, floating point parameters 1-3\\
+{\bf xmm4-xmm5}     & scratch, permanent if required by caller\\
+{\bf xmm6-xmm15}    & permanent\\
+\hline
+\end{tabular}
+\caption{Register usage on x64 MS Windows platform}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item first 4 integer/pointer parameters are passed via rcx, rdx, r8, r9 (from left to right), others are pushed on stack (there is a
+preserve area for the first 4)
+\item float and double parameters are passed via xmm0l-xmm3l
+\item first 4 parameters are passed via the correct register depending on the parameter type - with mixed float and int parameters,
+some registers are left out (e.g. first parameter ends up in rcx or xmm0, second in rdx or xmm1, etc.)
+\item parameters in registers are right justified
+\item parameters \textless\ 64bits are not zero extended - zero the upper bits contiaining garbage if needed (but they are always
+passed as a qword)
+\item parameters \textgreater\ 64 bit are passed by reference
+\item if callee takes address of a parameter, first 4 parameters must be dumped (to the reserved space on the stack) - for
+floating point parameters, value must be stored in integer AND floating point register
+\item caller cleans up the stack, not the callee (like cdecl)
+\item stack is always 16byte aligned - since return address is 64 bits in size, stacks with an odd number of parameters are
+already aligned
+\item ellipsis calls take floating point values in int and float registers (single precision floats are promoted to double precision
+as defined for ellipsis calls)
+\item if size of parameters \textgreater\ 1 page of memory (usually between 4k and 64k), chkstk must be called
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 64 bits) are returned via the rax register
+\item floating point types are returned via the xmm0 register
+\item for types \textgreater\ 64 bits, a secret first parameter with an address to the return value is passed
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack frame is always 16-byte aligned. Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{9}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{7}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & r9 or xmm3                 & \mrrbrace{4}{spill area}       &                              \\
+                                  & r8 or xmm2                 &                                &                              \\
+                                  & rdx or xmm1                &                                &                              \\
+                                  & rcx or xmm0                &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x64 Microsoft platform}
+\end{figure}
+
+
+
+\newpage
+
+\subsubsection{System V (Linux / *BSD / MacOS X)}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name                & Brief description\\
+\hline
+{\bf rax}           & scratch, return value\\
+{\bf rbx}           & permanent\\
+{\bf rcx}           & scratch, parameter 3 if integer or pointer\\
+{\bf rdx}           & scratch, parameter 2 if integer or pointer, return value\\
+{\bf rdi}           & scratch, parameter 0 if integer or pointer\\
+{\bf rsi}           & scratch, parameter 1 if integer or pointer\\
+{\bf rbp}           & permanent, may be used ase frame pointer\\
+{\bf rsp}           & stack pointer\\
+{\bf r8-r9}         & scratch, parameter 4 and 5 if integer or pointer\\
+{\bf r10-r11}       & scratch\\
+{\bf r12-r15}       & permanent\\
+{\bf xmm0}          & scratch, floating point parameters 0, floating point return value\\
+{\bf xmm1-xmm7}     & scratch, floating point parameters 1-7\\
+{\bf xmm8-xmm15}    & scratch\\
+{\bf st0-st1}       & scratch, 16 byte floating point return value\\
+{\bf st2-st7}       & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x64 System V (Linux/*BSD)}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item first 6 integer/pointer parameters are passed via rdi, rsi, rdx, rcx, r8, r9
+\item first 8 floating point parameters \textless=\ 64 bits are passed via xmm0l-xmm7l
+\item parameters in registers are right justified
+\item parameters that are not passed via registers are pushed onto the stack
+\item parameters \textless\ 64bits are not zero extended - zero the upper bits contiaining garbage if needed (but they are always
+passed as a qword)
+\item integer/pointer parameters \textgreater\ 64 bit are passed via 2 registers
+\item if callee takes address of a parameter, number of used xmm registers is passed silently in al (passed number mustn't be
+exact but an upper bound on the number of used xmm registers)
+\item stack is always 16byte aligned - since return address is 64 bits in size, stacks with an odd number of parameters are
+already aligned
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 64 bits) are returned via the rax register
+\item floating point types are returned via the xmm0 register
+\item for types \textgreater\ 64 bits, a secret first parameter with an address to the return value is passed - the passed in address
+will be returned in rax
+\item floating point values \textgreater\ 64 bits are returned via st0 and st1
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack frame is always 16-byte aligned. Note that there is no spill area.
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x64 System V (Linux/*BSD)}
+\end{figure}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/callconvs/callconv_x86.tex	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,782 @@
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+% ==================================================
+% x86 
+% ==================================================
+\subsection{x86 Calling Conventions}
+
+
+\paragraph{Overview}
+
+There are numerous different calling conventions on the x86 processor
+architecture, like cdecl \cite{x86cdecl}, MS fastcall \cite{x86Winfastcall}, GNU
+fastcall \cite{x86GNUfastcall}, Borland fastcall \cite{x86Borlandfastcall}, Watcom
+fastcall \cite{x86Watcomfastcall}, Win32 stdcall \cite{x86Winstdcall}, MS thiscall
+\cite{x86Winthiscall}, GNU thiscall \cite{x86GNUthiscall}, the pascal calling
+convention \cite{x86Pascal} and a cdecl-like version for Plan9 \cite{x86Plan9}
+(dubbed plan9call by us), etc.
+
+
+\paragraph{\product{dyncall} support}
+
+Currently cdecl, stdcall, fastcall (MS and GNU), thiscall (MS and GNU) and
+plan9call are supported.\\
+\\
+
+
+\subsubsection{cdecl}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch\\
+{\bf edx}     & scratch, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 cdecl calling convention}
+\end{table}
+
+
+\pagebreak
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item all arguments are pushed onto the stack
+\end{itemize}
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers
+\item floating point types are returned via the st0 register
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 cdecl calling convention}
+\end{figure}
+
+
+\pagebreak
+
+\subsubsection{MS fastcall}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch, parameter 0\\
+{\bf edx}     & scratch, parameter 1, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 fastcall (MS) calling convention}
+\end{table}
+
+
+\pagebreak
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item called function cleans up the stack
+\item first two integers/pointers (\textless=\ 32bit) are passed via ecx and edx (even if preceded by other arguments)
+\item integer types 64 bits in size @@@ ? first in edx:eax ?
+\item if first argument is a 64 bit integer, it is passed via ecx and edx
+\item all other parameters are pushed onto the stack
+\end{itemize}
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers@@@verify
+\item floating point types are returned via the st0 register@@@ really ?
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 fastcall (MS) calling convention}
+\end{figure}
+
+
+\pagebreak
+
+\subsubsection{GNU fastcall}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch, parameter 0\\
+{\bf edx}     & scratch, parameter 1, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 fastcall (GNU) calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item called function cleans up the stack
+\item first two integers/pointers (\textless=\ 32bit) are passed via ecx and edx (even if preceded by other arguments)
+\item if first argument is a 64 bit integer, it is pushed on the stack and the two registers are skipped 
+\item all other parameters are pushed onto the stack
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register.
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers.
+\item floating point types are returned via the st0.
+\end{itemize}
+
+
+\pagebreak
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 fastcall (GNU) calling convention}
+\end{figure}
+
+
+\subsubsection{Borland fastcall}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, parameter 0, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch, parameter 2\\
+{\bf edx}     & scratch, parameter 1, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 fastcall (Borland) calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: left-to-right
+\item called function cleans up the stack
+\item first three integers/pointers (\textless=\ 32bit) are passed via eax, ecx and edx (even if preceded by other arguments@@@?)
+\item integer types 64 bits in size @@@ ?
+\item all other parameters are pushed onto the stack
+\end{itemize}
+
+
+\pagebreak
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers@@@ verify
+\item floating point types are returned via the st0 register@@@ really ?
+\end{itemize}
+
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 fastcall (Borland) calling convention}
+\end{figure}
+
+
+\subsubsection{Watcom fastcall}
+
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, parameter 0, return value@@@\\
+{\bf ebx}     & scratch when used for parameter, parameter 2\\
+{\bf ecx}     & scratch when used for parameter, parameter 3\\
+{\bf edx}     & scratch when used for parameter, parameter 1, return value@@@\\
+{\bf esi}     & scratch when used for return pointer @@@??\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 fastcall (Watcom) calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item called function cleans up the stack
+\item first four integers/pointers (\textless=\ 32bit) are passed via eax, edx, ebx and ecx (even if preceded by other arguments@@@?)
+\item integer types 64 bits in size @@@ ?
+\item all other parameters are pushed onto the stack
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register@@@verify, I thnik its esi?
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers@@@ verify
+\item floating point types are returned via the st0 register@@@ really ?
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 fastcall (Watcom) calling convention}
+\end{figure}
+
+
+
+\subsubsection{win32 stdcall}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch\\
+{\bf edx}     & scratch, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 stdcall calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item Stack parameter order: right-to-left
+\item Called function cleans up the stack
+\item All parameters are pushed onto the stack
+\item Stack is usually 4 byte aligned (GCC \textgreater=\ 3.x seems to use a 16byte alignement@@@)
+\item Function name is decorated by prepending an underscore character and appending a '@' character and the number of bytes of stack space required
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers
+\item floating point types are returned via the st0 register
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 stdcall calling convention}
+\end{figure}
+
+\subsubsection{MS thiscall}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch, parameter 0\\
+{\bf edx}     & scratch, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 thiscall (MS) calling convention}
+\end{table}
+
+\newpage
+
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item called function cleans up the stack
+\item first parameter (this pointer) is passed via ecx
+\item all other parameters are pushed onto the stack
+\item Function name is decorated by prepending a '@' character and appending a '@' character and the number of bytes (decimal) of stack space required
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers@@@verify
+\item floating point types are returned via the st0 register@@@ really ?
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 thiscall (MS) calling convention}
+\end{figure}
+
+
+
+\subsubsection{GNU thiscall}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch\\
+{\bf edx}     & scratch, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 thiscall (GNU) calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack
+\item all parameters are pushed onto the stack
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers@@@verify
+\item floating point types are returned via the st0 register@@@ really ?
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 thiscall (GNU) calling convention}
+\end{figure}
+
+
+
+\subsubsection{pascal}
+
+The best known uses of the pascal calling convention are the 16 bit OS/2 APIs, Microsoft Windows 3.x and Borland Delphi 1.x.
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & permanent\\
+{\bf ecx}     & scratch\\
+{\bf edx}     & scratch, return value\\
+{\bf esi}     & permanent\\
+{\bf edi}     & permanent\\
+{\bf ebp}     & permanent\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 pascal calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: left-to-right
+\item called function cleans up the stack
+\item all parameters are pushed onto the stack
+\end{itemize}
+
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits are returned via the eax and edx registers
+\item floating point types are returned via the st0 register
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\caption{Stack layout on x86 pascal calling convention}
+\end{figure}
+
+
+\newpage
+
+\subsubsection{plan9call}
+
+\paragraph{Registers and register usage}
+
+\begin{table}[h]
+\begin{tabular}{3 B}
+\hline
+Name          & Brief description\\
+\hline
+{\bf eax}     & scratch, return value\\
+{\bf ebx}     & scratch\\
+{\bf ecx}     & scratch\\
+{\bf edx}     & scratch\\
+{\bf esi}     & scratch\\
+{\bf edi}     & scratch\\
+{\bf ebp}     & scratch\\
+{\bf esp}     & stack pointer\\
+{\bf st0}     & scratch, floating point return value\\
+{\bf st1-st7} & scratch\\
+\hline
+\end{tabular}
+\caption{Register usage on x86 plan9call calling convention}
+\end{table}
+
+\paragraph{Parameter passing}
+
+\begin{itemize}
+\item stack parameter order: right-to-left
+\item caller cleans up the stack%@@@ doesn't belong to "parameter passing"
+\item all parameters are pushed onto the stack
+\end{itemize}
+
+\pagebreak
+
+\paragraph{Return values}
+
+\begin{itemize}
+\item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register
+\item integers \textgreater\ 32 bits or structures are returned by the caller allocating the space and
+passing a pointer to the callee as a new, implicit first parameter (this means, on the stack)
+\item floating point types are returned via the st0 register (called F0 in plan9 8a's terms)
+\end{itemize}
+
+
+\paragraph{Stack layout}
+
+Stack directly after function prolog:\\
+
+\begin{figure}[h]
+\begin{tabular}{5|3|1 1}
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{5}{caller's frame} \\
+\hhline{~-~~}
+\mrlbrace{3}{parameter area}      & \ldots                     & \mrrbrace{3}{stack parameters} &                              \\
+                                  & \ldots                     &                                &                              \\
+                                  & \ldots                     &                                &                              \\
+\hhline{~-~~}
+                                  & return address             &                                &                              \\
+\hhline{~=~~}
+local data                        &                            &                                & \mrrbrace{3}{current frame}  \\
+\hhline{~-~~}
+parameter area                    &                            &                                &                              \\
+\hhline{~-~~}
+                                  & \vdots                     &                                &                              \\
+\hhline{~-~~}
+\end{tabular}
+\\
+\\
+\\
+\caption{Stack layout on x86 plan9call calling convention}
+\end{figure}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/dyncall_logo.eps	Thu Mar 19 22:24:28 2015 +0100
@@ -0,0 +1,488 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%Creator: 0.45pre1
+%%Pages: 1
+%%Orientation: Portrait
+%%BoundingBox: 28 43 573 661
+%%HiResBoundingBox: 28.615222 43.973395 572.35188 660.44216
+%%EndComments
+%%Page: 1 1
+0 842 translate
+0.8 -0.8 scale
+0 0 0 setrgbcolor
+[] 0 setdash
+1 setlinewidth
+0 setlinejoin
+0 setlinecap
+gsave [1 0 0 1 0 0] concat
+gsave [2.2965446 0 0 2.2965446 -189.23706 135.3048] concat
+gsave
+0 0 0 setrgbcolor
+newpath
+247.59 265.078 moveto
+235.699 273.664 257.766 281.555 244.684 288.172 curveto
+231.598 294.793 238.313 272.344 224.352 276.836 curveto
+210.395 281.328 228.941 295.648 214.453 297.902 curveto
+199.961 300.152 213.285 280.879 198.621 280.836 curveto
+183.957 280.793 197.172 300.145 182.695 297.812 curveto
+168.219 295.477 186.848 281.262 172.914 276.687 curveto
+158.98 272.117 165.566 294.605 152.52 287.914 curveto
+139.473 281.219 161.582 273.453 149.742 264.801 curveto
+137.906 256.148 137.223 279.57 126.883 269.172 curveto
+116.543 258.773 139.969 258.223 131.383 246.336 curveto
+122.797 234.445 114.91 256.516 108.289 243.43 curveto
+101.668 230.344 124.117 237.059 119.625 223.102 curveto
+115.133 209.141 100.813 227.687 98.5586 213.199 curveto
+96.3086 198.707 115.586 212.031 115.625 197.367 curveto
+115.668 182.703 96.3164 195.918 98.6484 181.441 curveto
+100.984 166.965 115.199 185.594 119.773 171.66 curveto
+124.344 157.727 101.855 164.312 108.551 151.266 curveto
+115.242 138.219 123.008 160.332 131.66 148.492 curveto
+140.313 136.652 116.891 135.969 127.289 125.629 curveto
+137.688 115.289 138.238 138.715 150.125 130.129 curveto
+162.016 121.543 139.949 113.656 153.031 107.035 curveto
+166.117 100.414 159.402 122.867 173.363 118.375 curveto
+187.32 113.883 168.773 99.559 183.262 97.309 curveto
+197.754 95.055 184.43 114.332 199.094 114.371 curveto
+213.758 114.414 200.543 95.062 215.02 97.398 curveto
+229.496 99.73 210.867 113.949 224.801 118.52 curveto
+238.734 123.09 232.148 100.602 245.195 107.297 curveto
+258.242 113.992 236.129 121.754 247.969 130.406 curveto
+259.809 139.059 260.492 115.637 270.832 126.035 curveto
+281.172 136.434 257.746 136.984 266.332 148.871 curveto
+274.918 160.762 282.805 138.695 289.426 151.781 curveto
+296.047 164.863 273.598 158.148 278.086 172.109 curveto
+282.578 186.066 296.902 167.52 299.152 182.008 curveto
+301.406 196.5 282.129 183.176 282.09 197.84 curveto
+282.047 212.504 301.398 199.289 299.063 213.766 curveto
+296.73 228.242 282.512 209.613 277.941 223.547 curveto
+273.371 237.48 295.859 230.895 289.164 243.941 curveto
+282.473 256.988 274.707 234.879 266.055 246.719 curveto
+257.402 258.555 280.824 259.238 270.426 269.578 curveto
+260.027 279.922 259.477 256.492 247.59 265.078 curveto
+closepath
+fill
+grestore
+gsave
+0 0 0 setrgbcolor
+newpath
+247.59 265.078 moveto
+235.699 273.664 257.766 281.555 244.684 288.172 curveto
+231.598 294.793 238.313 272.344 224.352 276.836 curveto
+210.395 281.328 228.941 295.648 214.453 297.902 curveto
+199.961 300.152 213.285 280.879 198.621 280.836 curveto
+183.957 280.793 197.172 300.145 182.695 297.812 curveto
+168.219 295.477 186.848 281.262 172.914 276.687 curveto
+158.98 272.117 165.566 294.605 152.52 287.914 curveto
+139.473 281.219 161.582 273.453 149.742 264.801 curveto
+137.906 256.148 137.223 279.57 126.883 269.172 curveto
+116.543 258.773 139.969 258.223 131.383 246.336 curveto
+122.797 234.445 114.91 256.516 108.289 243.43 curveto
+101.668 230.344 124.117 237.059 119.625 223.102 curveto
+115.133 209.141 100.813 227.687 98.5586 213.199 curveto
+96.3086 198.707 115.586 212.031 115.625 197.367 curveto
+115.668 182.703 96.3164 195.918 98.6484 181.441 curveto
+100.984 166.965 115.199 185.594 119.773 171.66 curveto
+124.344 157.727 101.855 164.312 108.551 151.266 curveto
+115.242 138.219 123.008 160.332 131.66 148.492 curveto
+140.313 136.652 116.891 135.969 127.289 125.629 curveto
+137.688 115.289 138.238 138.715 150.125 130.129 curveto
+162.016 121.543 139.949 113.656 153.031 107.035 curveto
+166.117 100.414 159.402 122.867 173.363 118.375 curveto
+187.32 113.883 168.773 99.559 183.262 97.309 curveto
+197.754 95.055 184.43 114.332 199.094 114.371 curveto
+213.758 114.414 200.543 95.062 215.02 97.398 curveto
+229.496 99.73 210.867 113.949 224.801 118.52 curveto
+238.734 123.09 232.148 100.602 245.195 107.297 curveto
+258.242 113.992 236.129 121.754 247.969 130.406 curveto
+259.809 139.059 260.492 115.637 270.832 126.035 curveto
+281.172 136.434 257.746 136.984 266.332 148.871 curveto
+274.918 160.762 282.805 138.695 289.426 151.781 curveto
+296.047 164.863 273.598 158.148 278.086 172.109 curveto
+282.578 186.066 296.902 167.52 299.152 182.008 curveto
+301.406 196.5 282.129 183.176 282.09 197.84 curveto
+282.047 212.504 301.398 199.289 299.063 213.766 curveto
+296.73 228.242 282.512 209.613 277.941 223.547 curveto
+273.371 237.48 295.859 230.895 289.164 243.941 curveto
+282.473 256.988 274.707 234.879 266.055 246.719 curveto
+257.402 258.555 280.824 259.238 270.426 269.578 curveto
+260.027 279.922 259.477 256.492 247.59 265.078 curveto
+closepath
+fill
+grestore
+0 0 0 setrgbcolor
+[] 0 setdash
+0.80000001 setlinewidth
+0 setlinejoin
+0 setlinecap
+newpath
+247.59 265.078 moveto
+235.699 273.664 257.766 281.555 244.684 288.172 curveto
+231.598 294.793 238.313 272.344 224.352 276.836 curveto
+210.395 281.328 228.941 295.648 214.453 297.902 curveto
+199.961 300.152 213.285 280.879 198.621 280.836 curveto
+183.957 280.793 197.172 300.145 182.695 297.812 curveto
+168.219 295.477 186.848 281.262 172.914 276.687 curveto
+158.98 272.117 165.566 294.605 152.52 287.914 curveto
+1