OSDN Git Service

2006-01-31 Leif Ekblad <leif@rdos.net>
authorjjohnstn <jjohnstn>
Tue, 31 Jan 2006 19:33:56 +0000 (19:33 +0000)
committerjjohnstn <jjohnstn>
Tue, 31 Jan 2006 19:33:56 +0000 (19:33 +0000)
        * configure.host: RDOS support added
        * libc/include/sys/config.h: Ditto.
        * libc/sys/rdos/Makefile.am, libc/sys/rdos/Makefile.in: New files.
        * libc/sys/rdos/aclocal.m4, libc/sys/rdos/chown.c: Ditto.
        * libc/sys/rdos/close.c, libc/sys/rdos/config.h: Ditto.
        * libc/sys/rdos/configure, libc/sys/rdos/configure.in: Ditto.
        * libc/sys/rdos/crt0.S, libc/sys/rdos/execve.c: Ditto.
        * libc/sys/rdos/fork.c, libc/sys/rdos/fstat.c: Ditto.
        * libc/sys/rdos/getenv.c, libc/sys/rdos/getpid.c: Ditto.
        * libc/sys/rdos/gettod.c, libc/sys/rdos/isatty.c: Ditto.
        * libc/sys/rdos/kill.c, libc/sys/rdos/link.c: Ditto.
        * libc/sys/rdos/lseek.c, libc/sys/rdos/open.c: Ditto.
        * libc/sys/rdos/rdos.S, libc/sys/rdos/rdos.h: Ditto.
        * libc/sys/rdos/rdoshelp.c, libc/sys/rdos/read.c: Ditto.
        * libc/sys/rdos/readlink.c, libc/sys/rdos/sbrk.c: Ditto.
        * libc/sys/rdos/stat.c, libc/sys/rdos/symlink.c: Ditto.
        * libc/sys/rdos/times.c, libc/sys/rdos/unlink.c: Ditto.
        * libc/sys/rdos/user.def, libc/sys/rdos/wait.c: Ditto.
        * libc/sys/rdos/write.c: Ditto.

36 files changed:
newlib/ChangeLog
newlib/configure.host
newlib/libc/include/sys/config.h
newlib/libc/sys/rdos/Makefile.am [new file with mode: 0644]
newlib/libc/sys/rdos/Makefile.in [new file with mode: 0644]
newlib/libc/sys/rdos/aclocal.m4 [new file with mode: 0644]
newlib/libc/sys/rdos/chown.c [new file with mode: 0755]
newlib/libc/sys/rdos/close.c [new file with mode: 0644]
newlib/libc/sys/rdos/config.h [new file with mode: 0644]
newlib/libc/sys/rdos/configure [new file with mode: 0755]
newlib/libc/sys/rdos/configure.in [new file with mode: 0644]
newlib/libc/sys/rdos/crt0.S [new file with mode: 0644]
newlib/libc/sys/rdos/execve.c [new file with mode: 0644]
newlib/libc/sys/rdos/fork.c [new file with mode: 0755]
newlib/libc/sys/rdos/fstat.c [new file with mode: 0755]
newlib/libc/sys/rdos/getenv.c [new file with mode: 0644]
newlib/libc/sys/rdos/getpid.c [new file with mode: 0644]
newlib/libc/sys/rdos/gettod.c [new file with mode: 0644]
newlib/libc/sys/rdos/isatty.c [new file with mode: 0644]
newlib/libc/sys/rdos/kill.c [new file with mode: 0644]
newlib/libc/sys/rdos/link.c [new file with mode: 0644]
newlib/libc/sys/rdos/lseek.c [new file with mode: 0755]
newlib/libc/sys/rdos/open.c [new file with mode: 0755]
newlib/libc/sys/rdos/rdos.S [new file with mode: 0644]
newlib/libc/sys/rdos/rdos.h [new file with mode: 0755]
newlib/libc/sys/rdos/rdoshelp.c [new file with mode: 0644]
newlib/libc/sys/rdos/read.c [new file with mode: 0644]
newlib/libc/sys/rdos/readlink.c [new file with mode: 0755]
newlib/libc/sys/rdos/sbrk.c [new file with mode: 0644]
newlib/libc/sys/rdos/stat.c [new file with mode: 0755]
newlib/libc/sys/rdos/symlink.c [new file with mode: 0755]
newlib/libc/sys/rdos/times.c [new file with mode: 0644]
newlib/libc/sys/rdos/unlink.c [new file with mode: 0644]
newlib/libc/sys/rdos/user.def [new file with mode: 0644]
newlib/libc/sys/rdos/wait.c [new file with mode: 0644]
newlib/libc/sys/rdos/write.c [new file with mode: 0644]

index c4e14e0..584ec40 100644 (file)
@@ -1,3 +1,25 @@
+2006-01-31  Leif Ekblad  <leif@rdos.net>
+
+       * configure.host: RDOS support added
+       * libc/include/sys/config.h: Ditto.
+       * libc/sys/rdos/Makefile.am, libc/sys/rdos/Makefile.in: New files.
+       * libc/sys/rdos/aclocal.m4, libc/sys/rdos/chown.c: Ditto.
+       * libc/sys/rdos/close.c, libc/sys/rdos/config.h: Ditto.
+       * libc/sys/rdos/configure, libc/sys/rdos/configure.in: Ditto.
+       * libc/sys/rdos/crt0.S, libc/sys/rdos/execve.c: Ditto.
+       * libc/sys/rdos/fork.c, libc/sys/rdos/fstat.c: Ditto.
+       * libc/sys/rdos/getenv.c, libc/sys/rdos/getpid.c: Ditto.
+       * libc/sys/rdos/gettod.c, libc/sys/rdos/isatty.c: Ditto.
+       * libc/sys/rdos/kill.c, libc/sys/rdos/link.c: Ditto.
+       * libc/sys/rdos/lseek.c, libc/sys/rdos/open.c: Ditto.
+       * libc/sys/rdos/rdos.S, libc/sys/rdos/rdos.h: Ditto.
+       * libc/sys/rdos/rdoshelp.c, libc/sys/rdos/read.c: Ditto.
+       * libc/sys/rdos/readlink.c, libc/sys/rdos/sbrk.c: Ditto.
+       * libc/sys/rdos/stat.c, libc/sys/rdos/symlink.c: Ditto.
+       * libc/sys/rdos/times.c, libc/sys/rdos/unlink.c: Ditto.
+       * libc/sys/rdos/user.def, libc/sys/rdos/wait.c: Ditto.
+       * libc/sys/rdos/write.c: Ditto.
+
 2006-01-24  Jeff Johnston  <jjohnstn@redhat.com>
 
        * acinclude.m4: Add nodefine to AM_INIT_AUTOMAKE macro invocation
index 01438a2..d85e8ad 100644 (file)
@@ -362,6 +362,10 @@ case "${host}" in
   h8500-*-elf*)
        sys_dir=h8500hms
        ;;
+  i[34567]86-*-rdos*)
+       sys_dir=rdos
+       newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
+       ;;
   i[34567]86-*-sco*)
        sys_dir=sysvi386
        unix_dir=unix
index b287b5e..c4e4dba 100644 (file)
@@ -59,7 +59,7 @@
 /* in other words, go32 */
 #define _FLOAT_RET double
 #endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__RDOS__)
 /* we want the reentrancy structure to be returned by a function */
 #define __DYNAMIC_REENT__
 #define HAVE_GETDATE
diff --git a/newlib/libc/sys/rdos/Makefile.am b/newlib/libc/sys/rdos/Makefile.am
new file mode 100644 (file)
index 0000000..825ef56
--- /dev/null
@@ -0,0 +1,17 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+noinst_LIBRARIES = lib.a
+
+lib_a_SOURCES = chown.c close.c execve.c fork.c fstat.c getenv.c \
+       getpid.c gettod.c isatty.c kill.c link.c lseek.c open.c rdoshelp.c \
+       rdos.S read.c readlink.c sbrk.c stat.c symlink.c times.c unlink.c \
+       wait.c write.c
+
+all: crt0.o
+
+ACLOCAL_AMFLAGS = -I ../../..
+CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libc/sys/rdos/Makefile.in b/newlib/libc/sys/rdos/Makefile.in
new file mode 100644 (file)
index 0000000..5fb59e5
--- /dev/null
@@ -0,0 +1,376 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+aext = @aext@
+libm_machine_dir = @libm_machine_dir@
+machine_dir = @machine_dir@
+newlib_basedir = @newlib_basedir@
+oext = @oext@
+sys_dir = @sys_dir@
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+noinst_LIBRARIES = lib.a
+
+lib_a_SOURCES = chown.c close.c execve.c fork.c fstat.c getenv.c       getpid.c gettod.c isatty.c kill.c link.c lseek.c open.c rdoshelp.c      rdos.S read.c readlink.c sbrk.c stat.c symlink.c times.c unlink.c       wait.c write.c
+
+
+ACLOCAL_AMFLAGS = -I ../../..
+CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
+CONFIG_CLEAN_FILES = 
+LIBRARIES =  $(noinst_LIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) 
+CPPFLAGS = @CPPFLAGS@
+LIBS = @LIBS@
+lib_a_LIBADD = 
+lib_a_OBJECTS =  chown.$(OBJEXT) close.$(OBJEXT) execve.$(OBJEXT) \
+fork.$(OBJEXT) fstat.$(OBJEXT) getenv.$(OBJEXT) getpid.$(OBJEXT) \
+gettod.$(OBJEXT) isatty.$(OBJEXT) kill.$(OBJEXT) link.$(OBJEXT) \
+lseek.$(OBJEXT) open.$(OBJEXT) rdoshelp.$(OBJEXT) rdos.$(OBJEXT) \
+read.$(OBJEXT) readlink.$(OBJEXT) sbrk.$(OBJEXT) stat.$(OBJEXT) \
+symlink.$(OBJEXT) times.$(OBJEXT) unlink.$(OBJEXT) wait.$(OBJEXT) \
+write.$(OBJEXT)
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON =  Makefile.am Makefile.in aclocal.m4 configure configure.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(lib_a_SOURCES)
+OBJECTS = $(lib_a_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+       cd $(top_builddir) \
+         && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in  \
+               ../../../acinclude.m4 ../../../aclocal.m4 \
+               ../../../libtool.m4
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+       cd $(srcdir) && $(AUTOCONF)
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+       -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.c.o:
+       $(COMPILE) -c $<
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+       $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+       $(COMPILE) -c $<
+
+.S.o:
+       $(COMPILE) -c $<
+
+mostlyclean-compile:
+       -rm -f *.o core *.core
+       -rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+       -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.c.lo:
+       $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.s.lo:
+       $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+       $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
+       -rm -f lib.a
+       $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
+       $(RANLIB) lib.a
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+       list='$(SOURCES) $(HEADERS)'; \
+       unique=`for i in $$list; do echo $$i; done | \
+         awk '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       here=`pwd` && cd $(srcdir) \
+         && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)'; \
+       unique=`for i in $$list; do echo $$i; done | \
+         awk '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+         || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+       -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       -rm -rf $(distdir)
+       GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+       mkdir $(distdir)/=build
+       mkdir $(distdir)/=inst
+       dc_install_base=`cd $(distdir)/=inst && pwd`; \
+       cd $(distdir)/=build \
+         && ../configure --srcdir=.. --prefix=$$dc_install_base \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) dist
+       -rm -rf $(distdir)
+       @banner="$(distdir).tar.gz is ready for distribution"; \
+       dashes=`echo "$$banner" | sed s/./=/g`; \
+       echo "$$dashes"; \
+       echo "$$banner"; \
+       echo "$$dashes"
+dist: distdir
+       -chmod -R a+r $(distdir)
+       GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+       -rm -rf $(distdir)
+dist-all: distdir
+       -chmod -R a+r $(distdir)
+       GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+       -rm -rf $(distdir)
+distdir: $(DISTFILES)
+       -rm -rf $(distdir)
+       mkdir $(distdir)
+       -chmod 777 $(distdir)
+       @for file in $(DISTFILES); do \
+         if test -f $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
+       done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am:
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-info-am: 
+install-info: install-info-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
+       -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
+               mostlyclean-libtool mostlyclean-tags \
+               mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \
+               clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-noinstLIBRARIES distclean-compile \
+               distclean-libtool distclean-tags distclean-generic \
+               clean-am
+       -rm -f libtool
+
+distclean: distclean-am
+       -rm -f config.status
+
+maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
+               maintainer-clean-compile maintainer-clean-libtool \
+               maintainer-clean-tags maintainer-clean-generic \
+               distclean-am
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+       -rm -f config.status
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-info-am \
+install-info install-exec-am install-exec install-data-am install-data \
+install-am install uninstall-am uninstall all-redirect all-am all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+all: crt0.o
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/newlib/libc/sys/rdos/aclocal.m4 b/newlib/libc/sys/rdos/aclocal.m4
new file mode 100644 (file)
index 0000000..e6cbb29
--- /dev/null
@@ -0,0 +1,1226 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4-p6
+
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl This provides configure definitions used by all the newlib
+dnl configure.in files.
+
+dnl Basic newlib configury.  This calls basic introductory stuff,
+dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST.  It also runs
+dnl configure.host.  The only argument is the relative path to the top
+dnl newlib directory.
+
+AC_DEFUN(NEWLIB_CONFIGURE,
+[
+dnl Default to --enable-multilib
+AC_ARG_ENABLE(multilib,
+[  --enable-multilib         build many library versions (default)],
+[case "${enableval}" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+ esac], [multilib=yes])dnl
+
+dnl Support --enable-target-optspace
+AC_ARG_ENABLE(target-optspace,
+[  --enable-target-optspace  optimize for space],
+[case "${enableval}" in
+  yes) target_optspace=yes ;;
+  no)  target_optspace=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
+ esac], [target_optspace=])dnl
+
+dnl Support --enable-malloc-debugging - currently only supported for Cygwin
+AC_ARG_ENABLE(malloc-debugging,
+[  --enable-malloc-debugging indicate malloc debugging requested],
+[case "${enableval}" in
+  yes) malloc_debugging=yes ;;
+  no)  malloc_debugging=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
+ esac], [malloc_debugging=])dnl
+
+dnl Support --enable-newlib-multithread
+AC_ARG_ENABLE(newlib-multithread,
+[  --enable-newlib-multithread        enable support for multiple threads],
+[case "${enableval}" in
+  yes) newlib_multithread=yes ;;
+  no)  newlib_multithread=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
+ esac], [newlib_multithread=yes])dnl
+
+dnl Support --enable-newlib-iconv
+AC_ARG_ENABLE(newlib-iconv,
+[  --enable-newlib-iconv     enable iconv library support],
+[if test "${newlib_iconv+set}" != set; then
+   case "${enableval}" in
+     yes) newlib_iconv=yes ;;
+     no)  newlib_iconv=no ;;
+     *)   AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
+   esac
+ fi], [newlib_iconv=${newlib_iconv}])dnl
+
+dnl Support --enable-newlib-elix-level
+AC_ARG_ENABLE(newlib-elix-level,
+[  --enable-newlib-elix-level         supply desired elix library level (1-4)],
+[case "${enableval}" in
+  0)   newlib_elix_level=0 ;;
+  1)   newlib_elix_level=1 ;;
+  2)   newlib_elix_level=2 ;;
+  3)   newlib_elix_level=3 ;;
+  4)   newlib_elix_level=4 ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
+ esac], [newlib_elix_level=0])dnl
+
+dnl Support --disable-newlib-io-float
+AC_ARG_ENABLE(newlib-io-float,
+[  --disable-newlib-io-float disable printf/scanf family float support],
+[case "${enableval}" in
+  yes) newlib_io_float=yes ;;
+  no)  newlib_io_float=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
+ esac], [newlib_io_float=yes])dnl
+
+dnl Support --disable-newlib-supplied-syscalls
+AC_ARG_ENABLE(newlib-supplied-syscalls,
+[  --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
+[case "${enableval}" in
+  yes) newlib_may_supply_syscalls=yes ;;
+  no)  newlib_may_supply_syscalls=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
+ esac], [newlib_may_supply_syscalls=yes])dnl
+
+AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
+
+dnl We may get other options which we don't document:
+dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+
+test -z "[$]{with_target_subdir}" && with_target_subdir=.
+
+if test "[$]{srcdir}" = "."; then
+  if test "[$]{with_target_subdir}" != "."; then
+    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
+  else
+    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
+  fi
+else
+  newlib_basedir="[$]{srcdir}/$1"
+fi
+AC_SUBST(newlib_basedir)
+
+AC_CANONICAL_SYSTEM
+
+AM_INIT_AUTOMAKE(newlib, 1.14.0, nodefine)
+
+# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable.  This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+  ac_test_CFLAGS="${CFLAGS+set}"
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=
+  AC_PROG_CC_G
+  if test "$ac_test_CFLAGS" = set; then
+    CFLAGS="$ac_save_CFLAGS"
+  elif test $ac_cv_prog_cc_g = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-O2"
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CC
+
+AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_PROG_INSTALL
+
+# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13.  */
+ac_given_INSTALL=$INSTALL
+
+AM_MAINTAINER_MODE
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which can't create executables.  So we include AC_EXEEXT to keep
+# automake happy, but we don't execute it, since we don't care about
+# the result.
+if false; then
+  AC_EXEEXT
+fi
+
+. [$]{newlib_basedir}/configure.host
+
+newlib_cflags="[$]{newlib_cflags} -fno-builtin"
+
+NEWLIB_CFLAGS=${newlib_cflags}
+AC_SUBST(NEWLIB_CFLAGS)
+
+LDFLAGS=${ldflags}
+AC_SUBST(LDFLAGS)
+
+AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
+AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
+AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
+AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
+AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
+
+AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
+
+# Hard-code OBJEXT.  Normally it is set by AC_OBJEXT, but we
+# use oext, which is set in configure.host based on the target platform.
+OBJEXT=${oext}
+
+AC_SUBST(OBJEXT)
+AC_SUBST(oext)
+AC_SUBST(aext)
+
+AC_SUBST(libm_machine_dir)
+AC_SUBST(machine_dir)
+AC_SUBST(sys_dir)
+])
+
+# Do all the work for Automake.  This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+# Copyright 2002  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.4-p6])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+   if test "[$]*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftestfile`
+   fi
+   if test "[$]*" != "X $srcdir/configure conftestfile" \
+      && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "[$]2" = conftestfile
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN([AM_MISSING_PROG],
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+   $1=$2
+   AC_MSG_RESULT(found)
+else
+   $1="$3/missing $2"
+   AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Define a conditional.
+
+AC_DEFUN([AM_CONDITIONAL],
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT($USE_MAINTAINER_MODE)
+  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
+
+# serial 46 AC_PROG_LIBTOOL
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+        [AC_LIBTOOL_GCJ],
+       [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+         [AC_LIBTOOL_GCJ],
+       [ifdef([AC_PROG_GCJ],
+              [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+        ifdef([A][M_PROG_GCJ],
+              [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+        ifdef([LT_AC_PROG_GCJ],
+              [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])])])])])
+
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool.  ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+AC_ARG_WITH(pic,
+  [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
+     pic_mode="$withval", pic_mode=default)
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case "`/usr/bin/file conftest.o`" in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_SAVE
+     AC_LANG_C
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_RESTORE])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+    [AC_TRY_LINK([],
+      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);],
+      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  ])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
+#   `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           egrep "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]* | [A-Za-z]:[\\/]*)]
+      re_direlt=['/[^/][^/]*/\.\./']
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+       test "$with_gnu_ld" != no && break
+      else
+       test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependant libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* |pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[012])
+    lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd* )
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  case $host_cpu in
+  hppa*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
+    lt_cv_file_magic_cmd=/usr/bin/file
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  ia64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64']
+    lt_cv_file_magic_cmd=/usr/bin/file
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  esac
+  ;;
+
+irix5* | irix6*)
+  case $host_os in
+  irix5*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+  else
+    [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
+  fi
+  ;;
+
+newsos6)
+  [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+[sysv5uw[78]* | sysv4*uw2*)]
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  motorola)
+    lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  esac
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+       lt_cv_path_NM="$tmp_nm -B"
+       break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+       lt_cv_path_NM="$tmp_nm -p"
+       break
+      else
+       lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+       continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+  # These system don't have libm
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, main, LIBM="-lm")
+  ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments.  Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
+# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!).  If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, main,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    INCLTDL=
+  fi
+])
+
+# If this macro is not defined by Autoconf, define it here.
+ifdef([AC_PROVIDE_IFELSE],
+      [],
+      [define([AC_PROVIDE_IFELSE],
+              [ifdef([AC_PROVIDE_$1],
+                     [$2], [$3])])])
+
+# AC_LIBTOOL_CXX - enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
+
+AC_DEFUN([_AC_LIBTOOL_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+# AC_LIBTOOL_GCJ - enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
+
+AC_DEFUN([_AC_LIBTOOL_GCJ],
+[AC_REQUIRE([AC_PROG_LIBTOOL])
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+         [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+           [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+dnl old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
diff --git a/newlib/libc/sys/rdos/chown.c b/newlib/libc/sys/rdos/chown.c
new file mode 100755 (executable)
index 0000000..48f33f5
--- /dev/null
@@ -0,0 +1,11 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+#include <sys/types.h>\r
+\r
+int chown(const char *path, uid_t owner, gid_t group)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/close.c b/newlib/libc/sys/rdos/close.c
new file mode 100644 (file)
index 0000000..7f95e24
--- /dev/null
@@ -0,0 +1,36 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# close.c                                                                \r
+# close function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+#include "rdos.h"\r
+\r
+int close(int fildes)\r
+{\r
+  RdosCloseFile(fildes);\r
+  return 0;\r
+}\r
diff --git a/newlib/libc/sys/rdos/config.h b/newlib/libc/sys/rdos/config.h
new file mode 100644 (file)
index 0000000..431e268
--- /dev/null
@@ -0,0 +1 @@
+/* Place holder for future configuration information.  */
diff --git a/newlib/libc/sys/rdos/configure b/newlib/libc/sys/rdos/configure
new file mode 100755 (executable)
index 0000000..e937dd6
--- /dev/null
@@ -0,0 +1,1876 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --enable-multilib         build many library versions (default)"
+ac_help="$ac_help
+  --enable-target-optspace  optimize for space"
+ac_help="$ac_help
+  --enable-malloc-debugging indicate malloc debugging requested"
+ac_help="$ac_help
+  --enable-newlib-multithread        enable support for multiple threads"
+ac_help="$ac_help
+  --enable-newlib-iconv     enable iconv library support"
+ac_help="$ac_help
+  --enable-newlib-elix-level         supply desired elix library level (1-4)"
+ac_help="$ac_help
+  --disable-newlib-io-float disable printf/scanf family float support"
+ac_help="$ac_help
+  --disable-newlib-supplied-syscalls disable newlib from supplying syscalls"
+ac_help="$ac_help
+  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=close.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='       '
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+ac_aux_dir=
+for ac_dir in ../../../.. $srcdir/../../../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in ../../../.. $srcdir/../../../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+am__api_version="1.4"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:578: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:631: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftestfile`
+   fi
+   if test "$*" != "X $srcdir/configure conftestfile" \
+      && test "$*" != "X conftestfile $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+   fi
+
+   test "$2" = conftestfile
+   )
+then
+   # Ok.
+   :
+else
+   { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:688: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+       @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:721: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 726 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:754: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 759 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:766: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+# Check whether --enable-multilib or --disable-multilib was given.
+if test "${enable_multilib+set}" = set; then
+  enableval="$enable_multilib"
+  case "${enableval}" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;;
+ esac
+else
+  multilib=yes
+fi
+
+# Check whether --enable-target-optspace or --disable-target-optspace was given.
+if test "${enable_target_optspace+set}" = set; then
+  enableval="$enable_target_optspace"
+  case "${enableval}" in
+  yes) target_optspace=yes ;;
+  no)  target_optspace=no ;;
+  *)   { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;;
+ esac
+else
+  target_optspace=
+fi
+
+# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
+if test "${enable_malloc_debugging+set}" = set; then
+  enableval="$enable_malloc_debugging"
+  case "${enableval}" in
+  yes) malloc_debugging=yes ;;
+  no)  malloc_debugging=no ;;
+  *)   { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;;
+ esac
+else
+  malloc_debugging=
+fi
+
+# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given.
+if test "${enable_newlib_multithread+set}" = set; then
+  enableval="$enable_newlib_multithread"
+  case "${enableval}" in
+  yes) newlib_multithread=yes ;;
+  no)  newlib_multithread=no ;;
+  *)   { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;;
+ esac
+else
+  newlib_multithread=yes
+fi
+
+# Check whether --enable-newlib-iconv or --disable-newlib-iconv was given.
+if test "${enable_newlib_iconv+set}" = set; then
+  enableval="$enable_newlib_iconv"
+  if test "${newlib_iconv+set}" != set; then
+   case "${enableval}" in
+     yes) newlib_iconv=yes ;;
+     no)  newlib_iconv=no ;;
+     *)   { echo "configure: error: bad value ${enableval} for newlib-iconv option" 1>&2; exit 1; } ;;
+   esac
+ fi
+else
+  newlib_iconv=${newlib_iconv}
+fi
+
+# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given.
+if test "${enable_newlib_elix_level+set}" = set; then
+  enableval="$enable_newlib_elix_level"
+  case "${enableval}" in
+  0)   newlib_elix_level=0 ;;
+  1)   newlib_elix_level=1 ;;
+  2)   newlib_elix_level=2 ;;
+  3)   newlib_elix_level=3 ;;
+  4)   newlib_elix_level=4 ;;
+  *)   { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;;
+ esac
+else
+  newlib_elix_level=0
+fi
+
+# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given.
+if test "${enable_newlib_io_float+set}" = set; then
+  enableval="$enable_newlib_io_float"
+  case "${enableval}" in
+  yes) newlib_io_float=yes ;;
+  no)  newlib_io_float=no ;;
+  *)   { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;;
+ esac
+else
+  newlib_io_float=yes
+fi
+
+# Check whether --enable-newlib-supplied-syscalls or --disable-newlib-supplied-syscalls was given.
+if test "${enable_newlib_supplied_syscalls+set}" = set; then
+  enableval="$enable_newlib_supplied_syscalls"
+  case "${enableval}" in
+  yes) newlib_may_supply_syscalls=yes ;;
+  no)  newlib_may_supply_syscalls=no ;;
+  *)   { echo "configure: error: bad value ${enableval} for newlib-supplied-syscalls option" 1>&2; exit 1; } ;;
+ esac
+else
+  newlib_may_supply_syscalls=yes
+fi
+
+
+
+if test x${newlib_may_supply_syscalls} = xyes; then
+  MAY_SUPPLY_SYSCALLS_TRUE=
+  MAY_SUPPLY_SYSCALLS_FALSE='#'
+else
+  MAY_SUPPLY_SYSCALLS_TRUE='#'
+  MAY_SUPPLY_SYSCALLS_FALSE=
+fi
+
+
+test -z "${with_target_subdir}" && with_target_subdir=.
+
+if test "${srcdir}" = "."; then
+  if test "${with_target_subdir}" != "."; then
+    newlib_basedir="${srcdir}/${with_multisrctop}../../../.."
+  else
+    newlib_basedir="${srcdir}/${with_multisrctop}../../.."
+  fi
+else
+  newlib_basedir="${srcdir}/../../.."
+fi
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:936: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:957: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:975: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+
+PACKAGE=newlib
+
+VERSION=1.14.0
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6
+echo "configure:1011: checking for working aclocal-${am__api_version}" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   ACLOCAL=aclocal-${am__api_version}
+   echo "$ac_t""found" 1>&6
+else
+   ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:1024: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+   AUTOCONF=autoconf
+   echo "$ac_t""found" 1>&6
+else
+   AUTOCONF="$missing_dir/missing autoconf"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6
+echo "configure:1037: checking for working automake-${am__api_version}" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-${am__api_version}
+   echo "$ac_t""found" 1>&6
+else
+   AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:1050: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+   AUTOHEADER=autoheader
+   echo "$ac_t""found" 1>&6
+else
+   AUTOHEADER="$missing_dir/missing autoheader"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:1063: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+   MAKEINFO=makeinfo
+   echo "$ac_t""found" 1>&6
+else
+   MAKEINFO="$missing_dir/missing makeinfo"
+   echo "$ac_t""missing" 1>&6
+fi
+
+
+
+# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable.  This should really be fixed in autoconf
+# itself.
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1088: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1118: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+       continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1167: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  ac_test_CFLAGS="${CFLAGS+set}"
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=
+  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1191: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+  if test "$ac_test_CFLAGS" = set; then
+    CFLAGS="$ac_save_CFLAGS"
+  elif test $ac_cv_prog_cc_g = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-O2"
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+
+# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1222: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="${ac_tool_prefix}as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1254: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AR="${ac_tool_prefix}ar"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1286: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1318: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1363: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13.  */
+ac_given_INSTALL=$INSTALL
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:1420: checking whether to enable maintainer-specific portions of Makefiles" >&5
+    # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval="$enable_maintainer_mode"
+  USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+  
+
+if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+  MAINT=$MAINTAINER_MODE_TRUE
+  
+
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which can't create executables.  So we include AC_EXEEXT to keep
+# automake happy, but we don't execute it, since we don't care about
+# the result.
+if false; then
+  
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1454: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.$ac_ext | *.c | *.o | *.obj) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+fi
+
+. ${newlib_basedir}/configure.host
+
+newlib_cflags="${newlib_cflags} -fno-builtin"
+
+NEWLIB_CFLAGS=${newlib_cflags}
+
+
+LDFLAGS=${ldflags}
+
+
+
+
+if test x${newlib_elix_level} = x0; then
+  ELIX_LEVEL_0_TRUE=
+  ELIX_LEVEL_0_FALSE='#'
+else
+  ELIX_LEVEL_0_TRUE='#'
+  ELIX_LEVEL_0_FALSE=
+fi
+
+
+if test x${newlib_elix_level} = x1; then
+  ELIX_LEVEL_1_TRUE=
+  ELIX_LEVEL_1_FALSE='#'
+else
+  ELIX_LEVEL_1_TRUE='#'
+  ELIX_LEVEL_1_FALSE=
+fi
+
+
+if test x${newlib_elix_level} = x2; then
+  ELIX_LEVEL_2_TRUE=
+  ELIX_LEVEL_2_FALSE='#'
+else
+  ELIX_LEVEL_2_TRUE='#'
+  ELIX_LEVEL_2_FALSE=
+fi
+
+
+if test x${newlib_elix_level} = x3; then
+  ELIX_LEVEL_3_TRUE=
+  ELIX_LEVEL_3_FALSE='#'
+else
+  ELIX_LEVEL_3_TRUE='#'
+  ELIX_LEVEL_3_FALSE=
+fi
+
+
+if test x${newlib_elix_level} = x4; then
+  ELIX_LEVEL_4_TRUE=
+  ELIX_LEVEL_4_FALSE='#'
+else
+  ELIX_LEVEL_4_TRUE='#'
+  ELIX_LEVEL_4_FALSE=
+fi
+
+
+
+if test x${use_libtool} = xyes; then
+  USE_LIBTOOL_TRUE=
+  USE_LIBTOOL_FALSE='#'
+else
+  USE_LIBTOOL_TRUE='#'
+  USE_LIBTOOL_FALSE=
+fi
+
+# Hard-code OBJEXT.  Normally it is set by AC_OBJEXT, but we
+# use oext, which is set in configure.host based on the target platform.
+OBJEXT=${oext}
+
+
+
+
+
+
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[    `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@MAY_SUPPLY_SYSCALLS_TRUE@%$MAY_SUPPLY_SYSCALLS_TRUE%g
+s%@MAY_SUPPLY_SYSCALLS_FALSE@%$MAY_SUPPLY_SYSCALLS_FALSE%g
+s%@newlib_basedir@%$newlib_basedir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CC@%$CC%g
+s%@AS@%$AS%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
+s%@MAINT@%$MAINT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g
+s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g
+s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g
+s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g
+s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g
+s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g
+s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g
+s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g
+s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g
+s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g
+s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g
+s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g
+s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g
+s%@OBJEXT@%$OBJEXT%g
+s%@oext@%$oext%g
+s%@aext@%$aext%g
+s%@libm_machine_dir@%$libm_machine_dir%g
+s%@machine_dir@%$machine_dir%g
+s%@sys_dir@%$sys_dir%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/newlib/libc/sys/rdos/configure.in b/newlib/libc/sys/rdos/configure.in
new file mode 100644 (file)
index 0000000..6a78d99
--- /dev/null
@@ -0,0 +1,12 @@
+dnl This is the newlib/libc/sys/rdos configure.in file.
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.5)
+AC_INIT(close.c)
+
+dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. 
+AC_CONFIG_AUX_DIR(../../../..)
+
+NEWLIB_CONFIGURE(../../..)
+
+AC_OUTPUT(Makefile)
diff --git a/newlib/libc/sys/rdos/crt0.S b/newlib/libc/sys/rdos/crt0.S
new file mode 100644 (file)
index 0000000..efc3b16
--- /dev/null
@@ -0,0 +1,406 @@
+/*#######################################################################
+# RDOS operating system
+# Copyright (C) 1988-2006, Leif Ekblad
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+#
+# The author of this program may be contacted at leif@rdos.net
+#
+# crt0.S                                                               
+# GCC startupcode for RDOS
+#
+##########################################################################*/
+  
+#include "user.def"
+
+    KEY_ENTRIES = 256
+  
+    .macro UserGate nr 
+    .byte 0x9A
+    .long \nr
+    .word 2
+    .endm 
+
+    .data
+    .align  8
+
+_key_section:
+    .word 0
+
+_key_ref_arr:
+    .long 0
+
+_key_dtor_arr:
+    .long 0
+
+       .text
+       .align 4
+                                                                                   
+/*##########################################################################
+#
+#   Name       : _start
+#
+#   Purpose....: GCC startup-code
+#
+##########################################################################*/
+
+       .global _start
+
+_start:
+       call get_impure_data_size
+       movl %eax,%ecx
+       UserGate allocate_app_mem_nr
+
+       xorl %eax,%eax
+       .byte 0x64
+       movl %edx,(%eax)
+       movl %edx,%edi
+       rep
+       stosb
+       pushl %edx
+
+    movl $(4 * KEY_ENTRIES),%eax
+       movl %eax,%ecx
+    UserGate allocate_app_mem_nr
+    movl $4,%eax
+    .byte 0x64
+    movl %edx,(%eax)
+    movl %edx,%edi
+       xorl %eax,%eax
+    rep
+    stosb
+
+    movl $(4 * KEY_ENTRIES),%eax
+       movl %eax,%ecx
+    UserGate allocate_app_mem_nr
+    movl %edx,_key_ref_arr
+    movl %edx,%edi
+       xorl %eax,%eax
+    rep
+    stosb
+
+    movl $(4 * KEY_ENTRIES),%eax
+       movl %eax,%ecx
+    UserGate allocate_app_mem_nr
+    movl %edx,_key_dtor_arr
+    movl %edx,%edi
+       xorl %eax,%eax
+    rep
+    stosb
+
+       UserGate create_user_section_nr
+       movw %bx,_key_section
+
+       call __init_rdos
+       add $4, %esp
+
+       movl $0x1000,%eax
+       UserGate allocate_app_mem_nr
+
+       pushl %edx
+       UserGate get_cmd_line_nr
+
+       xorl %ecx,%ecx
+       xorb %ah,%ah
+
+arg_loop:
+       movl %edi,(%edx)
+       addl $4,%edx
+       movb (%edi),%al
+       orb %al,%al
+       je arg_done
+
+arg_scan:      
+       movb (%edi),%al
+       orb %al,%al
+       je next_arg
+
+       cmpb $0x22,%al
+       jne arg_no_quote
+
+       xorb $1,%ah
+       jmp arg_scan_next
+
+arg_no_quote:
+       orb %ah,%ah
+       jnz arg_scan_next
+
+       cmpb $0x20,%al
+       je next_arg
+
+       cmpb $0x8,%al
+       je next_arg
+
+arg_scan_next:
+       incl %edi
+       jmp arg_scan
+
+next_arg:
+       incl %ecx
+
+to_next_arg:
+       orb %al,%al
+       je arg_done
+
+       xorb %al,%al
+       movb %al,(%edi)
+       incl %edi
+       movb (%edi),%al
+       cmpb $0x20,%al
+       je to_next_arg
+
+       cmpb $0x8,%al
+       je to_next_arg
+       
+       jmp arg_loop    
+
+arg_done:
+       int $3
+       pushl %ecx
+       call main
+       add $8, %esp
+
+       pushl %eax
+       call    exit
+                                           
+/*##########################################################################
+#
+#   Name       : _exit
+#
+#   Purpose....: GCC exit-code
+#
+##########################################################################*/
+
+       .global _exit
+
+_exit:
+       pushl %ebp
+       movl %esp,%ebp
+       movl 8(%ebp),%eax
+       UserGate unload_exe_nr
+                                                                                   
+/*##########################################################################
+#
+#   Name       : __getreent
+#
+#   Purpose....: ?
+#
+##########################################################################*/
+
+       .global __getreent
+
+__getreent:
+    xorl %eax,%eax
+       .byte 0x64
+       movl (%eax),%eax
+       ret
+                                                                                                                           
+/*##########################################################################
+#
+#   Name       : __rdos_thread_key_create
+#
+#   Purpose....: Emulate GCC pthread_key_create
+#
+#   Parameters.: dtor
+#
+#   Returns....: Key index
+#
+##########################################################################*/
+
+       .global __rdos_thread_key_create
+       
+__rdos_thread_key_create:
+    int $3
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+    mov _key_section,%bx
+    UserGate enter_user_section_nr     
+
+       movl _key_ref_arr,%ebx
+    movl KEY_ENTRIES,%ecx
+
+rtkc_scan_loop:
+    movl (%ebx), %eax
+    orl %eax, %eax
+    jz rtkc_entry_found
+
+    add $4, %ebx
+    loop rtkc_scan_loop
+
+    movl $-1, %eax
+    jmp rtkc_leave
+
+rtkc_entry_found:
+    movb $255,3(%ebx)
+    subl _key_ref_arr,%ebx
+    addl _key_dtor_arr,%ebx
+       movl 8(%ebp),%eax
+       movl %eax,(%ebx)
+       subl _key_dtor_arr,%ebx
+       movl %ebx,%eax
+
+rtkc_leave:
+    mov _key_section, %bx
+    UserGate leave_user_section_nr     
+
+    popl %ecx
+    popl %ebx  
+       leave
+       ret
+                                                                                                                           
+/*##########################################################################
+#
+#   Name       : __rdos_thread_key_delete
+#
+#   Purpose....: Emulate GCC pthread_key_delete
+#
+#   Parameters.: index
+#
+#   Returns....: result
+#
+##########################################################################*/
+
+       .global __rdos_thread_key_delete
+       
+__rdos_thread_key_delete:
+    int $3
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+    mov _key_section,%bx
+    UserGate enter_user_section_nr     
+
+       movl 8(%ebp),%ebx
+       testb $3,%bl
+       jnz rtkd_fail
+
+    cmpl $(4 * KEY_ENTRIES),%ebx
+    jae rtkd_fail
+       
+    addl _key_ref_arr,%ebx
+    movb $0,3(%ebx)
+    mov (%ebx),%eax
+    orl %eax,%eax
+    jz rtkd_ok
+
+    subl _key_ref_arr,%ebx    
+    movl $0,(%ebx)
+    jmp rtkd_ok
+
+rtkd_fail:
+    movl $1,%eax 
+    jmp rtkd_leave   
+
+rtkd_ok:
+    xorl %eax,%eax 
+
+rtkd_leave:
+    mov _key_section, %bx
+    UserGate leave_user_section_nr     
+
+    popl %ebx  
+       leave
+       ret
+                                                                                                                           
+/*##########################################################################
+#
+#   Name       : __rdos_thread_getspecific
+#
+#   Purpose....: Emulate GCC pthread_getspecific
+#
+#   Parameters.: index
+#
+#   Returns....: value
+#
+##########################################################################*/
+
+       .global __rdos_thread_getspecific
+       
+__rdos_thread_getspecific:
+    int $3
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       testb $3,%bl
+       jnz rtg_fail
+
+    cmpl $(4 * KEY_ENTRIES),%ebx
+    jae rtg_fail
+
+    movl $4,%eax
+    .byte 0x64
+    movl (%eax),%eax
+    addl %eax,%ebx
+    movl (%ebx),%eax
+    jmp rtg_done
+
+rtg_fail:
+    xorl %eax,%eax
+
+rtg_done:
+    popl %ebx  
+       leave
+       ret
+                                                                                                                           
+/*##########################################################################
+#
+#   Name       : __rdos_thread_setspecific
+#
+#   Purpose....: Emulate GCC pthread_setspecific
+#
+#   Parameters.: index
+#                value
+#
+##########################################################################*/
+
+       .global __rdos_thread_setspecific
+       
+__rdos_thread_setspecific:
+    int $3
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movl 8(%ebp),%ebx
+       testb $3,%bl
+       jnz rts_fail
+
+    cmpl $(4 * KEY_ENTRIES),%ebx
+    jae rts_fail
+
+    movl $4,%eax
+    .byte 0x64
+    movl (%eax),%eax
+    addl %eax,%ebx
+
+       movl 12(%ebp),%eax
+    movl %eax,(%ebx)
+    xorl %eax,%eax
+    jmp rts_done
+
+rts_fail:
+    movl $1,%eax
+
+rts_done:
+    popl %ebx  
+       leave
+       ret
diff --git a/newlib/libc/sys/rdos/execve.c b/newlib/libc/sys/rdos/execve.c
new file mode 100644 (file)
index 0000000..ac7eeb2
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int execve( char *name, char **argv, char **env)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/fork.c b/newlib/libc/sys/rdos/fork.c
new file mode 100755 (executable)
index 0000000..fc335bb
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int fork()\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/fstat.c b/newlib/libc/sys/rdos/fstat.c
new file mode 100755 (executable)
index 0000000..c18dd78
--- /dev/null
@@ -0,0 +1,45 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# fstat.c                                                                \r
+# fstat function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include <errno.h>\r
+\r
+int fstat(int fd, struct stat *st)\r
+{\r
+  if (fd < 3)\r
+  {\r
+      st->st_mode = S_IFCHR;\r
+      st->st_blksize = 0;\r
+      return 0;\r
+  }\r
+  else\r
+  {\r
+      return -1;\r
+  }  \r
+}\r
diff --git a/newlib/libc/sys/rdos/getenv.c b/newlib/libc/sys/rdos/getenv.c
new file mode 100644 (file)
index 0000000..933ea4d
--- /dev/null
@@ -0,0 +1,83 @@
+/*#######################################################################
+# RDOS operating system
+# Copyright (C) 1988-2006, Leif Ekblad
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+#
+# The author of this program may be contacted at leif@rdos.net
+#
+# getenv.c                                                                
+# getenv function implementation
+#
+##########################################################################*/
+
+/*
+FUNCTION
+<<getenv>>---look up environment variable
+
+INDEX
+       getenv
+INDEX
+       environ
+
+ANSI_SYNOPSIS
+       #include <stdlib.h>
+       char *getenv(const char *<[name]>);
+
+TRAD_SYNOPSIS
+       #include <stdlib.h>
+       char *getenv(<[name]>)
+       char *<[name]>;
+
+DESCRIPTION
+<<getenv>> searches the list of environment variable names and values
+(using the global pointer ``<<char **environ>>'') for a variable whose
+name matches the string at <[name]>.  If a variable name matches,
+<<getenv>> returns a pointer to the associated value.
+
+RETURNS
+A pointer to the (string) value of the environment variable, or
+<<NULL>> if there is no such environment variable.
+
+PORTABILITY
+<<getenv>> is ANSI, but the rules for properly forming names of environment
+variables vary from one system to another.
+
+This function is not thread-safe, but does it need to be??
+There is an reentrant class that should be used if reentrance is required
+
+*/
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <rdos.h>
+
+static char envbuf[256];
+
+char *getenv(const char *name)
+{
+    int handle;
+    char *ptr = 0;
+
+    handle = RdosOpenSysEnv();
+    if (handle)
+    {
+        if (RdosFindEnvVar(handle, name, envbuf))
+            ptr = envbuf;
+    }
+    RdosCloseEnv(handle);
+    return ptr;
+}
diff --git a/newlib/libc/sys/rdos/getpid.c b/newlib/libc/sys/rdos/getpid.c
new file mode 100644 (file)
index 0000000..d84d673
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int getpid()\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/gettod.c b/newlib/libc/sys/rdos/gettod.c
new file mode 100644 (file)
index 0000000..b180150
--- /dev/null
@@ -0,0 +1,15 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <sys/time.h>\r
+#include <sys/times.h>\r
+#include <errno.h>\r
+\r
+struct timeval;\r
+struct timezone;\r
+\r
+int gettimeofday(struct timeval *ptimeval, struct timezone *ptimezone)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/isatty.c b/newlib/libc/sys/rdos/isatty.c
new file mode 100644 (file)
index 0000000..9862a87
--- /dev/null
@@ -0,0 +1,9 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int isatty(int file)\r
+{\r
+  return 0;\r
+}\r
diff --git a/newlib/libc/sys/rdos/kill.c b/newlib/libc/sys/rdos/kill.c
new file mode 100644 (file)
index 0000000..4f77906
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int kill(int pid, int sig)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/link.c b/newlib/libc/sys/rdos/link.c
new file mode 100644 (file)
index 0000000..23c0b2b
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int link(char *existing, char *new)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/lseek.c b/newlib/libc/sys/rdos/lseek.c
new file mode 100755 (executable)
index 0000000..b1cdb21
--- /dev/null
@@ -0,0 +1,59 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# lseek.c                                                                \r
+# lseek function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <unistd.h>\r
+#include <errno.h>\r
+#include <rdos.h>\r
+\r
+off_t lseek(int file, off_t pos, int whence)\r
+{\r
+       off_t temp;\r
+\r
+       switch (whence)\r
+       {\r
+               case SEEK_CUR:\r
+                       temp = RdosGetFilePos(file);\r
+                       temp += pos;\r
+                       RdosSetFilePos(file, temp);\r
+                       return temp;\r
+\r
+               case SEEK_SET:\r
+                       RdosSetFilePos(file, pos);\r
+                       return pos;\r
+\r
+               case SEEK_END:\r
+                       temp = RdosGetFilePos(file);\r
+                       temp += pos;\r
+                       RdosSetFilePos(file, temp);\r
+                       return temp;\r
+\r
+               default:\r
+                       errno = EINVAL;\r
+                       return - 1;\r
+       }\r
+}\r
diff --git a/newlib/libc/sys/rdos/open.c b/newlib/libc/sys/rdos/open.c
new file mode 100755 (executable)
index 0000000..e989106
--- /dev/null
@@ -0,0 +1,59 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# open.c                                                                \r
+# open function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <fcntl.h>\r
+#include <errno.h>\r
+#include "rdos.h"\r
+#include <stdarg.h>\r
+\r
+int open(const char *file, int flags, ...)\r
+{\r
+       int handle;\r
+       int pos;\r
+\r
+       if (flags & O_CREAT)\r
+               handle = RdosCreateFile(file, flags);\r
+       else\r
+               handle = RdosOpenFile(file, flags);\r
+\r
+       if (handle >= 0)\r
+       {\r
+               if (flags & O_APPEND)\r
+               {\r
+                       pos = RdosGetFileSize(handle);\r
+                       RdosSetFilePos(handle, pos);\r
+               }\r
+\r
+               if (flags & O_TRUNC)\r
+                       RdosSetFileSize(handle, 0);\r
+       \r
+               return handle;\r
+       }\r
+       else\r
+               return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/rdos.S b/newlib/libc/sys/rdos/rdos.S
new file mode 100644 (file)
index 0000000..d99be73
--- /dev/null
@@ -0,0 +1,7528 @@
+/*#######################################################################
+# RDOS operating system
+# Copyright (C) 1988-2006, Leif Ekblad
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+#
+# The author of this program may be contacted at leif@rdos.net
+#
+# rdos.S                                                                
+# GCC based interface to RDOS kernel                                    
+#
+##########################################################################*/
+
+#include "user.def"
+
+    .macro UserGate nr 
+    .byte 0x9A
+    .long \nr
+    .word 2
+    .endm 
+
+/*##########################################################################
+#
+#   Name       : RdosSwapShort
+#
+#   Purpose....: Byte reverse a short int
+#
+#   Returns....: Result
+#
+##########################################################################*/
+
+    .global RdosSwapShort
+    
+RdosSwapShort:
+       pushl %ebp
+       movl %esp,%ebp
+       movw 8(%ebp),%ax
+       xchgb %ah,%al
+       leave
+       ret
+
+
+/*##########################################################################
+#
+#   Name       : RdosSwapLong
+#
+#   Purpose....: Byte reverse a long int
+#
+#   Returns....: Result
+#
+##########################################################################*/
+
+    .global RdosSwapLong
+    
+RdosSwapLong:
+       pushl %ebp
+       movl %esp,%ebp
+       movl 8(%ebp),%eax
+       xchgb %ah,%al
+       roll $16,%eax
+       xchgb %ah,%al
+       leave
+       ret
+
+
+/*##########################################################################
+#
+#   Name       : LocalToNetworkLong
+#
+#   Purpose....: Convert a local long to network format
+#
+#   Returns....: Network format
+#
+##########################################################################*/
+
+    .global LocalToNetworkLong
+    
+LocalToNetworkLong:
+       pushl %ebp
+       movl %esp,%ebp
+       movl 8(%ebp),%eax
+       xchgb %ah,%al
+       roll $16,%eax
+       xchgb %ah,%al
+       leave
+       ret
+
+/*##########################################################################
+#
+#   Name       : NetworkToLocalLong
+#
+#   Purpose....: Convert a network long to local format
+#
+#   Returns....: Local format
+#
+##########################################################################*/
+
+    .global NetworkToLocalLong
+    
+NetworkToLocalLong:
+       pushl %ebp
+       movl %esp,%ebp
+       movl 8(%ebp),%eax
+       xchgb %ah,%al
+       roll $16,%eax
+       xchgb %ah,%al
+       leave
+       ret
+
+/*##########################################################################
+#
+#   Name       : RdosGetThreadHandle
+#
+#   Purpose....: Get current thread handle
+#
+#   Returns....: Thread ID
+#
+##########################################################################*/
+
+    .global RdosGetThreadHandle
+    
+RdosGetThreadHandle:
+       pushl %ebp
+       movl %esp,%ebp
+       UserGate get_thread_nr
+       movzx %ax,%eax
+       leave
+       ret
+
+/*##########################################################################
+#
+#   Name       : RdosGetThreadState
+#
+#   Purpose....: Get thread state
+#
+#   Parameters.: Thread #
+#                State buffer
+#
+##########################################################################*/
+
+    .global RdosGetThreadState
+    
+RdosGetThreadState:
+       pushl %ebp
+       movl %esp,%ebp
+       push %edi
+
+       movl 8(%ebp),%eax
+       movl 12(%ebp),%edx
+       UserGate get_thread_state_nr
+       jc rgtsFail
+       
+    movl $1,%eax
+    jmp rgtsDone
+    
+rgtsFail:
+    xorl %eax,%eax
+
+rgtsDone:
+       popl %edi
+       leave
+       ret
+
+/*##########################################################################
+#
+#   Name       : RdosSuspendThread
+#
+#   Purpose....: Suspend thread
+#
+#   Parameters.: Thread #
+#
+##########################################################################*/
+
+    .global RdosSuspendThread
+    
+RdosSuspendThread:
+       pushl %ebp
+       movl %esp,%ebp
+
+       movl 8(%ebp),%eax
+       UserGate suspend_thread_nr
+       jc rsfFail
+
+    movl $1,%eax
+    jmp rsfDone
+    
+rsfFail:
+    xorl %eax,%eax
+
+rsfDone:
+    leave
+    ret
+    
+
+/*##########################################################################
+#
+#   Name       : RdosExec
+#
+#   Purpose....: Execute a program
+#
+#   Parameters.: Program
+#                Commandline
+#
+##########################################################################*/
+
+    .global RdosExec
+    
+RdosExec:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%esi
+       movl 12(%ebp),%edi
+
+       UserGate load_exe_nr
+       UserGate get_exit_code_nr
+
+       popl %edi
+       popl %esi
+       leave
+       ret
+    
+/*##########################################################################
+#
+#   Name       : RdosSpawn
+#
+#   Purpose....: Create new process and run a program
+#
+#   Parameters.: Program
+#                Commandline
+#                StartDir
+#
+##########################################################################*/
+
+    .global RdosSpawn
+    
+RdosSpawn:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %fs
+       pushl %ebx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+    movw %ds,%dx
+    movw %dx,%fs
+    xorl %edx,%edx
+       movl 8(%ebp),%esi
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ebx
+       UserGate spawn_exe_nr
+       jc rsFail
+       
+    movzx %dx,%eax
+    jmp rsDone
+    
+rsFail:
+    xorl %eax,%eax
+
+rsDone:
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ebx
+       popw %fs
+       leave
+       ret
+    
+/*##########################################################################
+#
+#   Name       : RdosCpuReset
+#
+#   Purpose....: Cpu reset
+#
+##########################################################################*/
+
+    .global RdosCpuReset
+    
+RdosCpuReset:
+       pushl %ebp
+       movl %esp,%ebp
+       UserGate cpu_reset_nr
+       leave
+       ret
+    
+/*##########################################################################
+#
+#   Name       : RdosGetVersion
+#
+#   Purpose....: Get RDOS version
+#
+#   Parameters.: &major
+#                &minor
+#                &release
+#
+##########################################################################*/
+
+    .global RdosGetVersion
+    
+RdosGetVersion:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       UserGate get_version_nr
+
+    movzx %dx,%edx
+       movl 8(%ebp),%edi
+       movl %edx,(%edi)
+
+    movzx %ax,%eax
+       movl 12(%ebp),%edi
+       movl %eax,(%edi)
+
+    movzx %cx,%eax
+       movl 16(%ebp),%edi
+       movl %eax,(%edi)
+
+       popl %edi
+       popl %edx
+       popl %ecx
+       popl %eax
+       leave
+       ret
+    
+/*##########################################################################
+#
+#   Name       : RdosAllocateMem
+#
+#   Purpose....: Allocate memory
+#
+#   Parameters.: Bytes to allocate
+#
+#   Returns....: Memory pointer
+#
+##########################################################################*/
+
+    .global RdosAllocateMem
+    
+RdosAllocateMem:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+
+       movl 8(%ebp),%eax
+       UserGate allocate_app_mem_nr
+       movl %edx,%eax
+
+       popl %edx
+       leave
+       ret
+    
+/*##########################################################################
+#
+#   Name       : RdosFreeMem
+#
+#   Purpose....: Free memory
+#
+#   Parameters.: Memory pointer
+#
+##########################################################################*/
+
+    .global RdosFreeMem
+
+RdosFreeMem:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+
+       movl 8(%ebp),%edx
+       UserGate free_app_mem_nr
+
+       popl %edx
+       leave
+       ret
+           
+/*##########################################################################
+#
+#   Name       : RdosAppDebug
+#
+#   Purpose....: App debug
+#
+##########################################################################*/
+
+    .global RdosAppDebug
+    
+RdosAppDebug:
+       pushl %ebp
+       movl %esp,%ebp
+       UserGate app_debug_nr
+       leave
+       ret
+                   
+/*##########################################################################
+#
+#   Name       : RdosWaitMilli
+#
+#   Purpose....: Wait a number of milliseconds
+#
+#   Parameters.: Milliseconds to wait
+#
+##########################################################################*/
+
+    .global RdosWaitMilli
+    
+RdosWaitMilli:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+
+       movl 8(%ebp),%eax
+       UserGate wait_milli_nr
+
+       popl %eax
+       leave
+       ret
+                           
+/*##########################################################################
+#
+#   Name       : RdosCreateSection
+#
+#   Purpose....: Create section
+#
+#   Returns....: Section handle
+#
+##########################################################################*/
+
+    .global RdosCreateSection
+    
+RdosCreateSection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       
+       UserGate create_user_section_nr
+       movzx %bx,%eax
+
+       popl %ebx
+       leave
+       ret
+                           
+/*##########################################################################
+#
+#   Name       : RdosDeleteSection
+#
+#   Purpose....: Delete section
+#
+#   Parameters.: Section handle
+#
+##########################################################################*/
+
+    .global RdosDeleteSection
+    
+RdosDeleteSection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate delete_user_section_nr
+
+       popl %ebx
+       leave
+       ret
+                                   
+/*##########################################################################
+#
+#   Name       : RdosEnterSection
+#
+#   Purpose....: Enter section
+#
+#   Parameters.: Section handle
+#
+##########################################################################*/
+
+    .global RdosEnterSection
+    
+RdosEnterSection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate enter_user_section_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosLeaveSection
+#
+#   Purpose....: Leave section
+#
+#   Parameters.: Section handle
+#
+##########################################################################*/
+
+    .global RdosLeaveSection
+    
+RdosLeaveSection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate leave_user_section_nr
+
+       popl %ebx
+       leave
+       ret
+                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateWait
+#
+#   Purpose....: Create wait object
+#
+#   Returns....: Wait handle
+#
+##########################################################################*/
+
+    .global RdosCreateWait
+    
+RdosCreateWait:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       UserGate create_wait_nr
+       movzx %bx,%eax
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosCloseWait
+#
+#   Purpose....: Close wait
+#
+#   Parameters.: Wait handle
+#
+##########################################################################*/
+
+    .global RdosCloseWait
+    
+RdosCloseWait:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_wait_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosCheckWait
+#
+#   Purpose....: Check wait state
+#
+#   Parameters.: Wait handle
+#
+#   Returns....: Signalled ID or 0
+#
+##########################################################################*/
+
+    .global RdosCheckWait
+    
+RdosCheckWait:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       UserGate is_wait_idle_nr
+    movl %ecx,%eax
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosWaitForever
+#
+#   Purpose....: Wait forever
+#
+#   Parameters.: Wait handle
+#
+#   Returns....: Signalled ID or 0
+#
+##########################################################################*/
+
+    .global RdosWaitForever
+    
+RdosWaitForever:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       UserGate wait_no_timeout_nr
+       jc rwfFail
+
+    movl %ecx,%eax
+    jmp rwfDone
+
+rwfFail:
+    xorl %eax,%eax
+
+rwfDone:
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosWaitTimeout
+#
+#   Purpose....: Wait with timeout
+#
+#   Parameters.: Wait handle
+#                Timeout in ms
+#
+#   Returns....: Signalled ID or 0
+#
+##########################################################################*/
+
+    .global RdosWaitTimeout
+    
+RdosWaitTimeout:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movl 12(%ebp),%eax
+       movl $1193,%edx
+       mull %edx
+       pushl %edx
+       pushl %eax
+    UserGate get_system_time_nr
+    popl %ebx
+    addl %ebx,%eax
+    popl %ebx
+    adcl %ebx,%edx
+       movw 8(%ebp),%bx
+       UserGate wait_timeout_nr
+       jc rwtFail
+
+    movl %ecx,%eax
+    jmp rwtDone
+
+rwtFail:
+    xorl %eax,%eax
+
+rwtDone:
+    popl %edx
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosStopWait
+#
+#   Purpose....: Stop wait
+#
+#   Parameters.: Wait handle
+#
+##########################################################################*/
+
+    .global RdosStopWait
+    
+RdosStopWait:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate stop_wait_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosRemoveWait
+#
+#   Purpose....: Remove wait object from wait handle
+#
+#   Parameters.: Wait handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosRemoveWait
+    
+RdosRemoveWait:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%ecx
+       UserGate remove_wait_nr
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateSignal
+#
+#   Purpose....: Create signal object
+#
+#   Returns....: Signal handle
+#
+##########################################################################*/
+
+    .global RdosCreateSignal
+    
+RdosCreateSignal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       UserGate create_signal_nr
+       movzx %bx,%eax
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosResetSignal
+#
+#   Purpose....: Reset signal
+#
+#   Parameters.: Signal handle
+#
+##########################################################################*/
+
+    .global RdosResetSignal
+    
+RdosResetSignal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate reset_signal_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosIsSignalled
+#
+#   Purpose....: Check if signalled
+#
+#   Parameters.: Signal handle
+#
+#   Returns....: TRUE if signalled
+#
+##########################################################################*/
+
+    .global RdosIsSignalled
+    
+RdosIsSignalled:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate is_signalled_nr
+       jc risdFree
+
+    movl $1,%eax
+    jmp risdDone       
+
+risdFree:
+    xorl %eax,%eax
+
+risdDone:
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetSignal
+#
+#   Purpose....: Set signal
+#
+#   Parameters.: Signal handle
+#
+##########################################################################*/
+
+    .global RdosSetSignal
+    
+RdosSetSignal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate set_signal_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosFreeSignal
+#
+#   Purpose....: Free signal handle
+#
+#   Parameters.: Signal handle
+#
+##########################################################################*/
+
+    .global RdosFreeSignal
+    
+RdosFreeSignal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate free_signal_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForSignal
+#
+#   Purpose....: Add signal object to wait handle
+#
+#   Parameters.: Wait handle
+#                Signal handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForSignal
+    
+RdosAddWaitForSignal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       movl 16(%ebp),%ecx
+       UserGate add_wait_for_signal_nr
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForKeyboard
+#
+#   Purpose....: Add keyboard to wait handle
+#
+#   Parameters.: Wait handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForKeyboard
+    
+RdosAddWaitForKeyboard:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%ecx
+       UserGate add_wait_for_keyboard_nr
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForMouse
+#
+#   Purpose....: Add mouse to wait handle
+#
+#   Parameters.: Wait handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForMouse
+    
+RdosAddWaitForMouse:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%ecx
+       UserGate add_wait_for_mouse_nr
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForCom
+#
+#   Purpose....: Add com object to wait handle
+#
+#   Parameters.: Wait handle
+#                Com handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForCom
+    
+RdosAddWaitForCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       movl 16(%ebp),%ecx
+       UserGate add_wait_for_com_nr
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForAdc
+#
+#   Purpose....: Add ADC object to wait handle
+#
+#   Parameters.: Wait handle
+#                Adc handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForAdc
+    
+RdosAddWaitForAdc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       movl 16(%ebp),%ecx
+       UserGate add_wait_for_adc_nr
+
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetTextMode
+#
+#   Purpose....: Set text mode
+#
+##########################################################################*/
+
+    .global RdosSetTextMode
+    
+RdosSetTextMode:
+       pushl %ebp
+       movl %esp,%ebp
+
+       movw $3,%ax
+    UserGate set_video_mode_nr
+
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetVideoMode
+#
+#   Purpose....: Set video mode
+#
+#   Parameters.: &xres
+#                &yres
+#                &linesize
+#                &LFB
+#
+#   Returns....: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosSetVideoMode
+    
+RdosSetVideoMode:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movw (%edi),%ax
+
+       movl 12(%ebp),%edi
+       movw (%edi),%cx
+
+       movl 16(%ebp),%edi
+       movw (%edi),%dx
+
+       UserGate get_video_mode_nr
+       jc set_video_fail
+
+    UserGate set_video_mode_nr
+    jc set_video_fail
+
+       pushl %edi
+       movl 8(%ebp),%edi
+       movzx %ax,%eax
+       movl %eax,(%edi)
+
+       movl 12(%ebp),%edi
+       movzx %cx,%ecx
+       movl %ecx,(%edi)
+
+       movl 16(%ebp),%edi
+       movzx %dx,%edx
+       movl %edx,(%edi)
+
+       movl 20(%ebp),%edi
+       movzx %si,%esi
+       movl %esi,(%edi)
+       popl %edi
+
+       movl 24(%ebp),%eax
+       movl %edi,(%eax)
+
+       movzx %bx,%eax
+       jmp set_video_done
+
+set_video_fail:
+       xorl %eax,%eax
+       movl 8(%ebp),%edi
+       movl %eax,(%edi)
+       movl 12(%ebp),%edi
+       movl %eax,(%edi)
+       movl 16(%ebp),%edi
+       movl %eax,(%edi)
+       movl 20(%ebp),%edi
+       movl %eax,(%edi)
+       movl 24(%ebp),%edi
+       movl %eax,(%edi)
+
+set_video_done:
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetClipRect
+#
+#   Purpose....: Set clip rectangle
+#
+#   Parameters.: Bitmap handle
+#                xmin, xmax, ymin, ymax
+#
+##########################################################################*/
+
+    .global RdosSetClipRect
+    
+RdosSetClipRect:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       movw 20(%ebp),%si
+       movw 24(%ebp),%di
+       UserGate set_clip_rect_nr
+
+    popl %edi
+    popl %esi
+    popl %edx
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosClearClipRect
+#
+#   Purpose....: Clear clip rectangle
+#
+#   Parameters.: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosClearClipRect
+    
+RdosClearClipRect:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate clear_clip_rect_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetDrawColor
+#
+#   Purpose....: Set draw color
+#
+#   Parameters.: Bitmap handle
+#                Color
+#
+##########################################################################*/
+
+    .global RdosSetDrawColor
+    
+RdosSetDrawColor:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%eax
+       UserGate set_drawcolor_nr
+
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetLGOP
+#
+#   Purpose....: Set draw color
+#
+#   Parameters.: Bitmap handle
+#                LGOP
+#
+##########################################################################*/
+
+    .global RdosSetLGOP
+    
+RdosSetLGOP:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       UserGate set_lgop_nr
+
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetHollowStyle
+#
+#   Purpose....: Set hollow fill style
+#
+#   Parameters.: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosSetHollowStyle
+    
+RdosSetHollowStyle:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate set_hollow_style_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosSetFilledStyle
+#
+#   Purpose....: Set filled fill style
+#
+#   Parameters.: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosSetFilledStyle
+    
+RdosSetFilledStyle:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate set_filled_style_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosOpenFont
+#
+#   Purpose....: Open a font
+#
+#   Parameters.: height
+#
+#   Returns....: Font handle
+#
+##########################################################################*/
+
+    .global RdosOpenFont
+    
+RdosOpenFont:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%ax
+       UserGate open_font_nr
+       movzx %bx,%eax
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosCloseFont
+#
+#   Purpose....: Close font handle
+#
+#   Parameters.: Font handle
+#
+##########################################################################*/
+
+    .global RdosCloseFont
+    
+RdosCloseFont:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_font_nr
+
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosGetStringMetrics
+#
+#   Purpose....: Get string metrics for text using font
+#
+#   Parameters.: Font handle
+#                String
+#                &width
+#                &height
+#
+##########################################################################*/
+
+    .global RdosGetStringMetrics
+    
+RdosGetStringMetrics:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       UserGate get_string_metrics_nr
+
+       movl 16(%ebp),%edi
+       movzx %cx,%ecx
+       movl %ecx,(%edi)
+       
+       movl 20(%ebp),%edi
+       movzx %dx,%edx
+       movl %edx,(%edi)
+
+       popl %edi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetFont
+#
+#   Purpose....: Set font
+#
+#   Parameters.: Bitmap handle
+#                Font handle
+#
+##########################################################################*/
+
+    .global RdosSetFont
+    
+RdosSetFont:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       UserGate set_font_nr
+
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetPixel
+#
+#   Purpose....: Get pixel
+#
+#   Parameters.: Bitmap handle
+#                x, y
+#
+##########################################################################*/
+
+    .global RdosGetPixel
+    
+RdosGetPixel:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       UserGate get_pixel_nr
+
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetPixel
+#
+#   Purpose....: Set pixel
+#
+#   Parameters.: Bitmap handle
+#                x, y
+#
+##########################################################################*/
+
+    .global RdosSetPixel
+    
+RdosSetPixel:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       UserGate set_pixel_nr
+
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosBlit
+#
+#   Purpose....: Blit
+#
+#   Parameters.: SrcHandle
+#                DestHandle
+#                width, height
+#                SrcX, SrcY
+#                DestX, DestY
+#
+##########################################################################*/
+
+    .global RdosBlit
+    
+RdosBlit:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+;
+       movw 8(%ebp),%ax
+       movw 12(%ebp),%bx
+       movw 16(%ebp),%cx
+       movw 20(%ebp),%dx
+       movw 28(%ebp),%si
+       shll $16,%esi
+       movw 24(%ebp),%si
+       movw 36(%ebp),%di
+       shll $16,%edi
+       movw 32(%ebp),%di
+       UserGate blit_nr
+
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDrawMask
+#
+#   Purpose....: Draw mask
+#
+#   Parameters.: Bitmap handle
+#                mask
+#                RowSize
+#                width, height
+#                SrcX, SrcY
+#                DestX, DestY
+#
+##########################################################################*/
+
+    .global RdosDrawMask
+    
+RdosDrawMask:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+;
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       movw 16(%ebp),%ax
+       movw 24(%ebp),%si
+       shll $16,%esi
+       movw 20(%ebp),%si
+       movw 32(%ebp),%cx
+       shll $16,%ecx
+       movw 28(%ebp),%cx
+       movw 40(%ebp),%dx
+       shll $16,%edx
+       movw 36(%ebp),%dx
+       UserGate draw_mask_nr
+
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDrawLine
+#
+#   Purpose....: Draw a line
+#
+#   Parameters.: Bitmap handle
+#                x1, y1
+#                x2, y2
+#
+##########################################################################*/
+
+    .global RdosDrawLine
+    
+RdosDrawLine:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+;
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       movw 20(%ebp),%si
+       movw 24(%ebp),%di
+       UserGate draw_line_nr
+
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDrawString
+#
+#   Purpose....: Draw a string
+#
+#   Parameters.: Bitmap handle
+#                x, y
+#                string
+#
+##########################################################################*/
+
+    .global RdosDrawString
+    
+RdosDrawString:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+;
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       movl 20(%ebp),%edi
+       UserGate draw_string_nr
+
+       popl %edi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDrawRect
+#
+#   Purpose....: Draw a rect
+#
+#   Parameters.: Bitmap handle
+#                x, y
+#                width, height
+#
+##########################################################################*/
+
+    .global RdosDrawRect
+    
+RdosDrawRect:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       movw 20(%ebp),%si
+       movw 24(%ebp),%di
+       UserGate draw_rect_nr
+
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDrawEllipse
+#
+#   Purpose....: Draw an ellipse
+#
+#   Parameters.: Bitmap handle
+#                x, y
+#                width, height
+#
+##########################################################################*/
+
+    .global RdosDrawEllipse
+    
+RdosDrawEllipse:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       movw 20(%ebp),%si
+       movw 24(%ebp),%di
+       UserGate draw_ellipse_nr
+
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosCreateBitmap
+#
+#   Purpose....: Create a bitmap
+#
+#   Parameters.: BitsPerPixel
+#                width, height
+#
+#   Returns....: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosCreateBitmap
+    
+RdosCreateBitmap:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%ax
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       UserGate create_bitmap_nr
+       movzx %bx,%eax
+;
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDuplicateBitmapHandle
+#
+#   Purpose....: Duplicate bitmap handle for use in another thread / object
+#
+#   Parameters.: Bitmap handle
+#
+#   Returns....: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosDuplicateBitmapHandle
+    
+RdosDuplicateBitmapHandle:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate dup_bitmap_handle_nr
+       movzx %bx,%eax
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseBitmap
+#
+#   Purpose....: Close bitmap handle
+#
+#   Parameters.: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosCloseBitmap
+    
+RdosCloseBitmap:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_bitmap_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateStringBitmap
+#
+#   Purpose....: Create bitmap from string & font
+#
+#   Parameters.: Font
+#                string
+#
+#   Returns....: Bitmap handle
+#
+##########################################################################*/
+
+    .global RdosCreateStringBitmap
+    
+RdosCreateStringBitmap:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       UserGate create_string_bitmap_nr
+       movzx %bx,%eax
+;
+       popl %edi
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetBitmapInfo
+#
+#   Purpose....: Get info about bitmap
+#
+#   Parameters.: Bitmap handle
+#                &BitsPerPixel
+#                &width, &height
+#                &linesize
+#                &LFB
+#
+##########################################################################*/
+
+    .global RdosGetBitmapInfo
+    
+RdosGetBitmapInfo:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       UserGate get_bitmap_info_nr
+       jc gbiFail
+
+       pushl %edi
+       movl 12(%ebp),%edi
+       movzx %al,%eax
+       movl %eax,(%edi)
+
+       movl 16(%ebp),%edi
+       movzx %cx,%ecx
+       movl %ecx,(%edi)
+       
+       movl 20(%ebp),%edi
+       movzx %dx,%edx
+       movl %edx,(%edi)
+
+       movl 24(%ebp),%edi
+       movzx %si,%esi
+       movl %esi,(%edi)
+       popl %edi
+       
+       movl 28(%ebp),%eax
+       movl %edi,(%eax)
+       jmp gbiDone
+
+gbiFail:
+       xorl %eax,%eax
+       movl 12(%ebp),%edi
+       movl %eax,(%edi)
+
+       movl 16(%ebp),%edi
+       movl %eax,(%edi)
+
+       movl 20(%ebp),%edi
+       movl %eax,(%edi)
+
+       movl 24(%ebp),%edi
+       movl %eax,(%edi)
+
+       movl 28(%ebp),%edi
+       movl %eax,(%edi)
+
+gbiDone:
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                           
+/*##########################################################################
+#
+#   Name       : RdosCreateSprite
+#
+#   Purpose....: Create a sprite
+#
+#   Parameters.: dest
+#                bitmap
+#                mask
+#                LGOP
+#
+#   Returns....: Sprite handle
+#
+##########################################################################*/
+
+    .global RdosCreateSprite
+    
+RdosCreateSprite:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       movw 20(%ebp),%ax
+       UserGate create_sprite_nr
+       movzx %bx,%eax
+
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseSprite
+#
+#   Purpose....: Close sprite handle
+#
+#   Parameters.: Sprite handle
+#
+##########################################################################*/
+
+    .global RdosCloseSprite
+    
+RdosCloseSprite:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_sprite_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosShowSprite
+#
+#   Purpose....: Show sprite
+#
+#   Parameters.: Sprite handle
+#
+##########################################################################*/
+
+    .global RdosShowSprite
+    
+RdosShowSprite:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate show_sprite_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosHideSprite
+#
+#   Purpose....: Hide sprite
+#
+#   Parameters.: Sprite handle
+#
+##########################################################################*/
+
+    .global RdosHideSprite
+    
+RdosHideSprite:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate hide_sprite_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosMoveSprite
+#
+#   Purpose....: Move sprite
+#
+#   Parameters.: Sprite handle
+#                x, y
+#
+##########################################################################*/
+
+    .global RdosMoveSprite
+    
+RdosMoveSprite:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%cx
+       movw 16(%ebp),%dx
+       UserGate move_sprite_nr
+
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetForeColor
+#
+#   Purpose....: Set text-mode fore color
+#
+#   Parameters.: palette index
+#
+##########################################################################*/
+
+    .global RdosSetForeColor
+    
+RdosSetForeColor:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+
+       movb 8(%ebp),%al
+       UserGate set_forecolor_nr
+
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetBackColor
+#
+#   Purpose....: Set text-mode back color
+#
+#   Parameters.: palette index
+#
+##########################################################################*/
+
+    .global RdosSetBackColor
+    
+RdosSetBackColor:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+
+       movb 8(%ebp),%al
+       UserGate set_backcolor_nr
+
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetSysTime
+#
+#   Purpose....: Get system time
+#
+#   Parameters.: &year, &month, &day
+#                &hour, &min, &sec, &ms
+#
+##########################################################################*/
+
+    .global RdosGetSysTime
+    
+RdosGetSysTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       UserGate get_system_time_nr
+       pushl %eax
+       UserGate binary_to_time_nr
+       pushl %edx
+
+       movl 8(%ebp),%esi
+       movzx %dx,%edx
+       movl %edx,(%esi)
+
+       movl 12(%ebp),%esi
+       movzx %ch,%edx
+       movl %edx,(%esi)
+
+       movl 16(%ebp),%esi
+       movzx %cl,%edx
+       movl %edx,(%esi)
+
+       movl 20(%ebp),%esi
+       movzx %bh,%edx
+       movl %edx,(%esi)
+
+       movl 24(%ebp),%esi
+       movzx %bl,%edx
+       movl %edx,(%esi)
+
+       movl 28(%ebp),%esi
+       movzx %ah,%edx
+       movl %edx,(%esi)
+
+       popl %edx
+       UserGate time_to_binary_nr
+       movl %eax,%ebx
+       popl %eax
+       subl %ebx,%eax
+       xorl %edx,%edx
+       movl $1192,%ebx
+       divl %ebx
+
+       movl 32(%ebp),%esi
+       movzx %ax,%eax
+       movl %eax,(%esi)
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetTime
+#
+#   Purpose....: Get time
+#
+#   Parameters.: &year, &month, &day
+#                &hour, &min, &sec, &ms
+#
+##########################################################################*/
+
+    .global RdosGetTime
+    
+RdosGetTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       UserGate get_time_nr
+       pushl %eax
+       UserGate binary_to_time_nr
+       pushl %edx
+
+       movl 8(%ebp),%esi
+       movzx %dx,%edx
+       movl %edx,(%esi)
+
+       movl 12(%ebp),%esi
+       movzx %ch,%edx
+       movl %edx,(%esi)
+
+       movl 16(%ebp),%esi
+       movzx %cl,%edx
+       movl %edx,(%esi)
+
+       movl 20(%ebp),%esi
+       movzx %bh,%edx
+       movl %edx,(%esi)
+
+       movl 24(%ebp),%esi
+       movzx %bl,%edx
+       movl %edx,(%esi)
+
+       movl 28(%ebp),%esi
+       movzx %ah,%edx
+       movl %edx,(%esi)
+
+       popl %edx
+       UserGate time_to_binary_nr
+       movl %eax,%ebx
+       popl %eax
+       subl %ebx,%eax
+       xorl %edx,%edx
+       movl $1192,%ebx
+       divl %ebx
+
+       movl 32(%ebp),%esi
+       movzx %ax,%eax
+       movl %eax,(%esi)
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetTime
+#
+#   Purpose....: Set time
+#
+#   Parameters.: year, month, day
+#                hour, min, sec, ms
+#
+##########################################################################*/
+
+    .global RdosSetTime
+    
+RdosSetTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       movw 8(%ebp),%dx
+       movb 12(%ebp),%ch
+       movb 16(%ebp),%cl
+       movb 20(%ebp),%bh
+       movb 24(%ebp),%bl
+       movb 28(%ebp),%ah
+       UserGate time_to_binary_nr
+
+    movl %edx,%edi
+    movl %eax,%esi
+
+       movl 32(%ebp),%eax
+    movl $1192,%edx
+    mull %edx
+    addl %eax,%esi
+    adcl $0,%edi    
+
+       UserGate get_system_time_nr
+    subl %eax,%esi
+    sbbl %edx,%edi
+    movl %esi,%eax
+    movl %edi,%edx
+    UserGate update_time_nr
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosTicsToRecord
+#
+#   Purpose....: Convert tics to record format
+#
+#   Parameters.: MSB, LSB
+#                &year, &month, &day
+#                &hour, &min, &sec, &ms
+#
+##########################################################################*/
+
+    .global RdosTicsToRecord
+    
+RdosTicsToRecord:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       movl 8(%ebp),%edx
+       movl 12(%ebp),%eax
+       addl $596,%eax
+       adcl $0,%edx
+       UserGate binary_to_time_nr
+       pushl %edx
+
+       movl 16(%ebp),%esi
+       movzx %dx,%edx
+       movl %edx,(%esi)
+
+       movl 20(%ebp),%esi
+       movzx %ch,%edx
+       movl %edx,(%esi)
+
+       movl 24(%ebp),%esi
+       movzx %cl,%edx
+       movl %edx,(%esi)
+
+       movl 28(%ebp),%esi
+       movzx %bh,%edx
+       movl %edx,(%esi)
+
+       movl 32(%ebp),%esi
+       movzx %bl,%edx
+       movl %edx,(%esi)
+
+       movl 36(%ebp),%esi
+       movzx %ah,%edx
+       movl %edx,(%esi)
+
+       popl %edx
+       UserGate time_to_binary_nr
+       movl %eax,%ebx
+       movl 12(%ebp),%eax
+       subl %edx,%eax
+       xorl %edx,%edx
+       movl $1192,%ebx
+       divl %ebx
+
+       movl 40(%ebp),%esi
+       cmpw %ax,1000
+       jne rttrSaveMs
+
+       decw %ax
+
+rttrSaveMs:    
+       movzx %ax,%eax
+       movl %eax,(%esi)
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosRecordToTics
+#
+#   Purpose....: Convert from record format to tics
+#
+#   Parameters.: &MSB, &LSB
+#                year, month, day
+#                hour, min, sec, ms
+#
+##########################################################################*/
+
+    .global RdosRecordToTics
+    
+RdosRecordToTics:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       movl 40(%ebp),%eax
+       movl $1192,%edx
+       mull %edx
+       pushl %eax
+       movw 16(%ebp),%dx
+       movb 20(%ebp),%ch
+       movb 24(%ebp),%cl
+       movb 28(%ebp),%bh
+       movb 32(%ebp),%bl
+       movb 36(%ebp),%ah
+       UserGate time_to_binary_nr
+       popl %ebx
+       addl %ebx,%eax
+       adcl $0,%edx
+
+       movl 8(%ebp),%esi
+       movl %edx,(%esi)
+
+       movl 12(%ebp),%esi
+       movl %eax,(%esi)
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDecodeMsbTics
+#
+#   Purpose....: Decode MSB tics
+#
+#   Parameters.: MSB
+#                &day, &hour
+#
+##########################################################################*/
+
+    .global RdosDecodeMsbTics
+    
+RdosDecodeMsbTics:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       movl 8(%ebp),%eax
+       xorl %edx,%edx
+       movl $24,%ecx
+       divl %ecx
+
+       movl 12(%ebp),%ebx
+       movl %eax,(%ebx)
+
+       movl 16(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDecodeLsbTics
+#
+#   Purpose....: Decode LSB tics
+#
+#   Parameters.: LSB
+#                &min, &sec, &ms, &us
+#
+##########################################################################*/
+
+    .global RdosDecodeLsbTics
+    
+RdosDecodeLsbTics:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       movl 8(%ebp),%eax
+       movl $60,%edx
+       mull %edx
+       movl 12(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       movl $60,%edx
+       mull %edx
+       movl 16(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       movl $1000,%edx
+       mull %edx
+       movl 20(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       movl $1000,%edx
+       mull %edx
+       movl 24(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDayOfWeek
+#
+#   Purpose....: Get day of week
+#
+#   Parameters.: year, month, day
+#
+#   Returns....: day of week
+#
+##########################################################################*/
+
+    .global RdosDayOfWeek
+    
+RdosDayOfWeek:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movl 8(%ebp),%edx
+       movb 12(%ebp),%ch
+       movb 16(%ebp),%cl
+    xorw %bx,%bx
+    xorb %ah,%ah
+       UserGate adjust_time_nr
+       pushw %dx
+       movl $365,%eax
+       imulw %dx
+       pushw %dx
+       pushw %ax
+       popl %ebx
+       popw %dx
+       UserGate passed_days_nr
+       decw %dx
+       shrw $2,%dx
+       incw %dx
+       addw %dx,%ax
+       addl %ebx,%eax
+    xorl %edx,%edx
+    addl $5,%eax
+    movl $7,%ebx
+    divl %ebx
+    movzx %dl,%eax
+
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetTics
+#
+#   Purpose....: Get system tics
+#
+#   Parameters.: &MSB, &LSB
+#
+##########################################################################*/
+
+    .global RdosGetTics
+    
+RdosGetTics:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+       pushl %esi
+
+       UserGate get_time_nr
+       movl 8(%ebp),%esi
+       movl %edx,(%esi)
+       movl 12(%ebp),%esi
+       movl %eax,(%esi)
+
+       popl %esi
+       popl %edx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddTics
+#
+#   Purpose....: Add tics to binary time
+#
+#   Parameters.: &MSB, &LSB
+#                tics
+#
+##########################################################################*/
+
+    .global RdosAddTics
+    
+RdosAddTics:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 16(%ebp),%eax
+       movl 12(%ebp),%ebx
+       addl %eax,(%ebx)
+       movl 8(%ebp),%ebx
+       adcl $0,(%ebx)
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddMilli
+#
+#   Purpose....: Add milliseconds to binary time
+#
+#   Parameters.: &MSB, &LSB
+#                milli
+#
+##########################################################################*/
+
+    .global RdosAddMilli
+    
+RdosAddMilli:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 16(%ebp),%eax
+       movl $1193,%edx
+       mull %edx
+       movl 12(%ebp),%ebx
+       addl %eax,(%ebx)
+       movl 8(%ebp),%ebx
+       adcl %edx,(%ebx)
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddSec
+#
+#   Purpose....: Add milliseconds to binary time
+#
+#   Parameters.: &MSB, &LSB
+#                sec
+#
+##########################################################################*/
+
+    .global RdosAddSec
+    
+RdosAddSec:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 16(%ebp),%eax
+       movl $1193000,%edx
+       mull %edx
+       movl 12(%ebp),%ebx
+       addl %eax,(%ebx)
+       movl 8(%ebp),%ebx
+       adcl %edx,(%ebx)
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddMin
+#
+#   Purpose....: Add minutes to binary time
+#
+#   Parameters.: &MSB, &LSB
+#                min
+#
+##########################################################################*/
+
+    .global RdosAddMin
+    
+RdosAddMin:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 16(%ebp),%eax
+       movl $71582760,%edx
+       mull %edx
+       movl 12(%ebp),%ebx
+       addl %eax,(%ebx)
+       movl 8(%ebp),%ebx
+       adcl %edx,(%ebx)
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddHour
+#
+#   Purpose....: Add hour to binary time
+#
+#   Parameters.: &MSB, &LSB
+#                hour
+#
+##########################################################################*/
+
+    .global RdosAddHour
+    
+RdosAddHour:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 16(%ebp),%eax
+       movl 8(%ebp),%ebx
+       adc %eax,(%ebx)
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddDay
+#
+#   Purpose....: Add days to binary time
+#
+#   Parameters.: &MSB, &LSB
+#                days
+#
+##########################################################################*/
+
+    .global RdosAddDay
+    
+RdosAddDay:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 16(%ebp),%eax
+       movl $24,%edx
+       mull %edx
+       movl 8(%ebp),%ebx
+       adc %eax,(%ebx)
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSyncTime
+#
+#   Purpose....: Synchronize time with NTP
+#
+#   Parameters.: IP
+#
+##########################################################################*/
+
+    .global RdosSyncTime
+    
+RdosSyncTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushal
+
+       movl 8(%ebp),%edx
+       UserGate sync_time_nr
+       jc RdosSyncTimeFail
+
+       movl $1,%eax
+       jmp RdosSyncTimeDone
+
+RdosSyncTimeFail:
+       xorl %eax,%eax
+
+RdosSyncTimeDone:
+       popal
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenCom
+#
+#   Purpose....: Open com-port
+#
+#   Parameters.: ID
+#                baudrate
+#                parity
+#                data bits
+#                stop bits
+#                SendBufferSize
+#                RecBufferSize
+#
+#    Returns...: Com handle
+#
+##########################################################################*/
+
+    .global RdosOpenCom
+    
+RdosOpenCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movb 20(%ebp),%ah
+       movb 24(%ebp),%bl
+       movb 16(%ebp),%bh
+       movl 12(%ebp),%ecx
+       movw 28(%ebp),%si
+       movw 32(%ebp),%di
+       UserGate open_com_nr
+       movzx %bx,%eax
+
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseCom
+#
+#   Purpose....: Close com-port
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosCloseCom
+    
+RdosCloseCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_com_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosFlushCom
+#
+#   Purpose....: Flush com-port
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosFlushCom
+    
+RdosFlushCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate flush_com_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadCom
+#
+#   Purpose....: Read com-port
+#
+#   Parameters.: Com handle
+#
+#   Returns....: Character
+#
+##########################################################################*/
+
+    .global RdosReadCom
+    
+RdosReadCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate read_com_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteCom
+#
+#   Purpose....: Write com-port
+#
+#   Parameters.: Com handle
+#                char
+#
+#   Returns....: 0 for success
+#
+##########################################################################*/
+
+    .global RdosWriteCom
+    
+RdosWriteCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movb 12(%ebp),%al
+       UserGate write_com_nr
+       movzx %al,%eax
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWaitForSendCompletedCom
+#
+#   Purpose....: Wait until send buffer is empty
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosWaitForSendCompletedCom
+    
+RdosWaitForSendCompletedCom:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate wait_for_send_completed_com_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosEnableCts
+#
+#   Purpose....: Enable CTS signal
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosEnableCts
+    
+RdosEnableCts:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate enable_cts_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDisableCts
+#
+#   Purpose....: Disable CTS signal
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosDisableCts
+    
+RdosDisableCts:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate disable_cts_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosEnableAutoRts
+#
+#   Purpose....: Enable auto RTS signal generation for RS485
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosEnableAutoRts
+    
+RdosEnableAutoRts:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate enable_auto_rts_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDisableAutoRts
+#
+#   Purpose....: Disable auto RTS signal generation for RS485
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosDisableAutoRts
+    
+RdosDisableAutoRts:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate disable_auto_rts_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetDtr
+#
+#   Purpose....: Set DTR active
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosSetDtr
+    
+RdosSetDtr:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate set_dtr_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosResetDtr
+#
+#   Purpose....: Set DTR inactive
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosResetDtr
+    
+RdosResetDtr:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate reset_dtr_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetRts
+#
+#   Purpose....: Set RTS active
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosSetRts
+    
+RdosSetRts:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate set_rts_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosResetRts
+#
+#   Purpose....: Set RTS inactive
+#
+#   Parameters.: Com handle
+#
+##########################################################################*/
+
+    .global RdosResetRts
+    
+RdosResetRts:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate reset_rts_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetReceiveBufferSpace
+#
+#   Purpose....: Get receive buffer free space
+#
+#   Parameters.: Com handle
+#
+#   Returns....: Free bytes
+#
+##########################################################################*/
+
+    .global RdosGetReceiveBufferSpace
+    
+RdosGetReceiveBufferSpace:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_com_receive_space_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetSendBufferSpace
+#
+#   Purpose....: Get send buffer free space
+#
+#   Parameters.: Com handle
+#
+#   Returns....: Free bytes
+#
+##########################################################################*/
+
+    .global RdosGetSendBufferSpace
+    
+RdosGetSendBufferSpace:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_com_send_space_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenFile
+#
+#   Purpose....: Open file
+#
+#   Parameters.: Filename
+#                Access
+#
+#    Returns...: File handle
+#
+##########################################################################*/
+
+    .global RdosOpenFile
+    
+RdosOpenFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movb 12(%ebp),%cl
+       UserGate open_file_nr
+       jc OpenFileFailed
+
+       movzx %bx,%eax
+       jmp OpenFileDone
+
+OpenFileFailed:
+       xorl %eax,%eax
+
+OpenFileDone:
+       popl %edi
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateFile
+#
+#   Purpose....: Create file
+#
+#   Parameters.: Filename
+#                Attribute
+#
+#    Returns...: File handle
+#
+##########################################################################*/
+
+    .global RdosCreateFile
+    
+RdosCreateFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movw 12(%ebp),%cx
+       UserGate create_file_nr
+       jc CreateFileFailed
+
+       movzx %bx,%eax
+       jmp CreateFileDone
+
+CreateFileFailed:
+       xorl %eax,%eax
+
+CreateFileDone:
+       popl %edi
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseFile
+#
+#   Purpose....: Close file
+#
+#   Parameters.: File handle
+#
+##########################################################################*/
+
+    .global RdosCloseFile
+    
+RdosCloseFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_file_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosIsDevice
+#
+#   Purpose....: Check if file is device
+#
+#   Parameters.: TRUE if device
+#
+##########################################################################*/
+
+    .global RdosIsDevice
+    
+RdosIsDevice:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_ioctl_data_nr
+       testw $0x8000,%dx
+       jz ridFail
+
+       movl $1,%eax
+       jmp ridDone
+
+ridFail:
+       xorl %eax,%eax
+
+ridDone:
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDuplFile
+#
+#   Purpose....: Duplicate file handle
+#
+#   Parameters.: File handle
+#
+#   Returns....: File handle
+#
+##########################################################################*/
+
+    .global RdosDuplFile
+    
+RdosDuplFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate dupl_file_nr
+       jc DuplFileFailed
+       
+       movzx %bx,%eax
+       jmp DuplFileDone
+
+DuplFileFailed:
+       xorl %eax,%eax
+
+DuplFileDone:
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetFileSize
+#
+#   Purpose....: Get file size
+#
+#   Parameters.: File handle
+#
+#   Returns....: Size
+#
+##########################################################################*/
+
+    .global RdosGetFileSize
+    
+RdosGetFileSize:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_file_size_nr
+       jnc GetFileSizeDone
+
+GetFileSizeFail:
+       xorl %eax,%eax
+
+GetFileSizeDone:
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetFileSize
+#
+#   Purpose....: Set file size
+#
+#   Parameters.: File handle
+#                Size
+#
+##########################################################################*/
+
+    .global RdosSetFileSize
+    
+RdosSetFileSize:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%eax
+       UserGate set_file_size_nr
+
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetFilePos
+#
+#   Purpose....: Get file position
+#
+#   Parameters.: File handle
+#
+#   Returns....: Position
+#
+##########################################################################*/
+
+    .global RdosGetFilePos
+    
+RdosGetFilePos:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_file_pos_nr
+       jnc GetFilePosDone
+
+GetFilePosFail:
+       xorl %eax,%eax
+
+GetFilePosDone:
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetFilePos
+#
+#   Purpose....: Set file position
+#
+#   Parameters.: File handle
+#                Position
+#
+##########################################################################*/
+
+    .global RdosSetFilePos
+    
+RdosSetFilePos:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%eax
+       UserGate set_file_pos_nr
+
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetFileTime
+#
+#   Purpose....: Get file time & date
+#
+#   Parameters.: File handle
+#                &MSB, &LSB
+#
+##########################################################################*/
+
+    .global RdosGetFileTime
+    
+RdosGetFileTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       UserGate get_file_time_nr
+       jc GetFileTimeDone
+
+       movl 12(%ebp),%edi
+       movl %edx,(%edi)
+
+       movl 16(%ebp),%edi
+       movl %eax,(%edi)
+
+GetFileTimeDone:
+       popl %edi
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetFileTime
+#
+#   Purpose....: Set file time & date
+#
+#   Parameters.: File handle
+#                MSB, LSB
+#
+##########################################################################*/
+
+    .global RdosSetFileTime
+    
+RdosSetFileTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+       pushl %edx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edx
+       movl 16(%ebp),%eax
+       UserGate set_file_time_nr
+
+       popl %edx
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadFile
+#
+#   Purpose....: Read from file
+#
+#   Parameters.: File handle
+#                buffer
+#                count
+#
+#   Returns....: Read count
+#
+##########################################################################*/
+
+    .global RdosReadFile
+    
+RdosReadFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ecx
+       UserGate read_file_nr
+
+       popl %edi
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteFile
+#
+#   Purpose....: Write to file
+#
+#   Parameters.: File handle
+#                buffer
+#                count
+#
+#   Returns....: Written count
+#
+##########################################################################*/
+
+    .global RdosWriteFile
+    
+RdosWriteFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ecx
+       UserGate write_file_nr
+
+       popl %edi
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateMapping
+#
+#   Purpose....: Create file mapping
+#
+#   Parameters.: Size
+#
+#    Returns...: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosCreateMapping
+    
+RdosCreateMapping:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%eax
+       UserGate create_mapping_nr
+       movzx %bx,%eax
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateNamedMapping
+#
+#   Purpose....: Create named file mapping
+#
+#   Parameters.: Name
+#                Size
+#
+#    Returns...: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosCreateNamedMapping
+    
+RdosCreateNamedMapping:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%eax
+       UserGate create_named_mapping_nr
+       movzx %bx,%eax
+
+       popl %edi
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateNamedFileMapping
+#
+#   Purpose....: Create file named file mapping
+#
+#   Parameters.: Name
+#                Size
+#                File handle
+#
+#    Returns...: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosCreateNamedFileMapping
+    
+RdosCreateNamedFileMapping:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%eax
+       movw 16(%ebp),%bx
+       UserGate create_named_file_mapping_nr
+       movzx %bx,%eax
+
+       popl %edi
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenNamedMapping
+#
+#   Purpose....: Open named file mapping
+#
+#   Parameters.: Name
+#
+#    Returns...: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosOpenNamedMapping
+    
+RdosOpenNamedMapping:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate open_named_mapping_nr
+       movzx %bx,%eax
+
+       popl %edi
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSyncMapping
+#
+#   Purpose....: Sync file mapping
+#
+#   Parameters.: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosSyncMapping
+    
+RdosSyncMapping:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate sync_mapping_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseMapping
+#
+#   Purpose....: Close file mapping
+#
+#   Parameters.: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosCloseMapping
+    
+RdosCloseMapping:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_mapping_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosMapView
+#
+#   Purpose....: Map view of file into memory
+#
+#   Parameters.: Filemap handle
+#                Offset
+#                Address
+#                Size
+#
+##########################################################################*/
+
+    .global RdosMapView
+    
+RdosMapView:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%eax
+       movl 16(%ebp),%edi
+       movl 20(%ebp),%ecx
+       UserGate map_view_nr
+
+       popl %edi
+       popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosUnmapView
+#
+#   Purpose....: Unmap view of file
+#
+#   Parameters.: Filemap handle
+#
+##########################################################################*/
+
+    .global RdosUnmapView
+    
+RdosUnmapView:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate unmap_view_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetCurDrive
+#
+#   Purpose....: Set current drive
+#
+#   Parameters.: Drive
+#
+##########################################################################*/
+
+    .global RdosSetCurDrive
+    
+RdosSetCurDrive:
+       pushl %ebp
+       movl %esp,%ebp
+
+       movb 8(%ebp),%al
+       UserGate set_cur_drive_nr
+       jc rscdrFail
+
+    movl $1,%eax
+    jmp rscdrDone
+
+rscdrFail:
+    xorl %eax,%eax
+
+rscdrDone:
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetCurDrive
+#
+#   Purpose....: Get current drive
+#
+#   Returns....: Drive
+#
+##########################################################################*/
+
+    .global RdosGetCurDrive
+    
+RdosGetCurDrive:
+       pushl %ebp
+       movl %esp,%ebp
+
+    xorl %eax,%eax
+       UserGate get_cur_drive_nr
+       movzx %al,%eax
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetCurDir
+#
+#   Purpose....: Set current directory
+#
+#   Parameters.: Pathname
+#
+##########################################################################*/
+
+    .global RdosSetCurDir
+    
+RdosSetCurDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate set_cur_dir_nr
+       jc rscdFail
+
+    movl $1,%eax
+    jmp rscdDone
+
+rscdFail:
+    xorl %eax,%eax
+
+rscdDone:
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetCurDir
+#
+#   Purpose....: Get current directory
+#
+#   Parameters.: Drive
+#                Pathname
+#
+##########################################################################*/
+
+    .global RdosGetCurDir
+    
+RdosGetCurDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%edi
+       UserGate get_cur_dir_nr
+       jc rgcdFail
+
+    movl $1,%eax
+    jmp rgcdDone
+
+rgcdFail:
+    xorl %eax,%eax
+
+rgcdDone:
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosMakeDir
+#
+#   Purpose....: Create directory
+#
+#   Parameters.: Pathname
+#
+##########################################################################*/
+
+    .global RdosMakeDir
+    
+RdosMakeDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate make_dir_nr
+       jc mdFail
+
+    movl $1,%eax
+    jmp mdDone
+
+mdFail:
+    xorl %eax,%eax
+
+mdDone:
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosRemoveDir
+#
+#   Purpose....: Remove directory
+#
+#   Parameters.: Pathname
+#
+##########################################################################*/
+
+    .global RdosRemoveDir
+    
+RdosRemoveDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate remove_dir_nr
+       jc rdFail
+
+    movl $1,%eax
+    jmp rdDone
+
+rdFail:
+    xorl %eax,%eax
+
+rdDone:
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosRenameFile
+#
+#   Purpose....: Rename file
+#
+#   Parameters.: ToName
+#                FromName
+#
+##########################################################################*/
+
+    .global RdosRenameFile
+    
+RdosRenameFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%esi
+       UserGate rename_file_nr
+       jc rfFail
+
+    mov $1,%eax
+    jmp rfDone
+
+rfFail:
+    xorl %eax,%eax
+
+rfDone:
+       popl %edi
+       popl %esi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDeleteFile
+#
+#   Purpose....: Delete file
+#
+#   Parameters.: Pathname
+#
+##########################################################################*/
+
+    .global RdosDeleteFile
+    
+RdosDeleteFile:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate delete_file_nr
+       jc dfFail
+
+    mov $1,%eax
+    jmp dfDone
+
+dfFail:
+    xorl %eax,%eax
+
+dfDone:
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetFileAttribute
+#
+#   Purpose....: Get file attribute
+#
+#   Parameters.: Pathname
+#                &Attrib
+#
+##########################################################################*/
+
+    .global RdosGetFileAttribute
+    
+RdosGetFileAttribute:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate get_file_attribute_nr
+       jc gfaFail
+
+       movl 12(%ebp),%edi
+    movzx %cx,%ecx
+       movl %ecx,(%edi)
+    movl $1,%eax
+    jmp gfaDone
+
+gfaFail:
+    xorl %eax,%eax
+
+gfaDone:
+       popl %edi
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetFileAttribute
+#
+#   Purpose....: Set file attribute
+#
+#   Parameters.: Pathname
+#                Attrib
+#
+##########################################################################*/
+
+    .global RdosSetFileAttribute
+    
+RdosSetFileAttribute:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movw 12(%ebp),%cx
+       UserGate set_file_attribute_nr
+       jc sfaFail
+
+    movl $1,%eax
+    jmp sfaDone
+
+sfaFail:
+    xorl %eax,%eax
+
+sfaDone:
+       popl %edi
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenDir
+#
+#   Purpose....: Open directory
+#
+#   Parameters.: Pathname
+#
+#   Returns....: Dir handle
+#
+##########################################################################*/
+
+    .global RdosOpenDir
+    
+RdosOpenDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate open_dir_nr
+       jc odFail
+
+    movzx %bx,%eax
+    jmp odDone
+
+odFail:
+    xorl %eax,%eax
+
+odDone:
+       popl %edi
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseDir
+#
+#   Purpose....: Close directory
+#
+#   Parameters.: Dir handle
+#
+##########################################################################*/
+
+    .global RdosCloseDir
+    
+RdosCloseDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_dir_nr
+
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadDir
+#
+#   Purpose....: Read directory entry
+#
+#   Parameters.: Dir handle
+#                Entry #
+#                MaxNameSize
+#                Name buffer
+#                &FileSize
+#                &Attribute
+#                &Msb time
+#                &Lsb time
+#
+##########################################################################*/
+
+    .global RdosReadDir
+    
+RdosReadDir:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%dx
+       movw 16(%ebp),%cx
+       movl 20(%ebp),%edi
+       UserGate read_dir_nr
+       jc rdiFail
+
+       movl 24(%ebp),%edi
+       movl %ecx,(%edi)
+
+       movl 28(%ebp),%edi
+    movzx %bx,%ebx
+       movl %ebx,(%edi)
+
+       movl 32(%ebp),%edi
+       movl %edx,(%edi)
+
+       movl 36(%ebp),%edi
+       movl %eax,(%edi)
+
+    movl $1,%eax
+    jmp rdiDone
+
+rdiFail:
+    xorl %eax,%eax
+    
+rdiDone:
+    popl %edi
+    popl %ecx
+       popl %ebx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetFocus
+#
+#   Purpose....: Set input focus
+#
+#   Parameters.: Focus handle
+#
+##########################################################################*/
+
+    .global RdosSetFocus
+    
+RdosSetFocus:
+       pushl %ebp
+       movl %esp,%ebp
+       
+       movl 8(%ebp),%eax
+       UserGate set_focus_nr
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetFocus
+#
+#   Purpose....: Get input focus
+#
+#   Returns....: Focus handle
+#
+##########################################################################*/
+
+    .global RdosGetFocus
+    
+RdosGetFocus:
+       pushl %ebp
+       movl %esp,%ebp
+       
+       UserGate get_focus_nr
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosClearKeyboard
+#
+#   Purpose....: Clear keyboard buffer
+#
+##########################################################################*/
+
+    .global RdosClearKeyboard
+    
+RdosClearKeyboard:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate flush_keyboard_nr
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosPollKeyboard
+#
+#   Purpose....: Poll keyboard buffer
+#
+#   Returns....: TRUE if non-empty
+#
+##########################################################################*/
+
+    .global RdosPollKeyboard
+    
+RdosPollKeyboard:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate poll_keyboard_nr
+       jc rpkEmpty
+
+       mov $1,%eax
+       jmp rpkDone
+
+rpkEmpty:
+       xorl %eax,%eax
+
+rpkDone:
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadKeyboard
+#
+#   Purpose....: Read keyboard buffer
+#
+#   Returns....: Scan code
+#
+##########################################################################*/
+
+    .global RdosReadKeyboard
+    
+RdosReadKeyboard:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate read_keyboard_nr
+       movzx %ax,%eax
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetKeyboardState
+#
+#   Purpose....: Get keyboard buffer
+#
+#   Returns....: Keyboard state
+#
+##########################################################################*/
+
+    .global RdosGetKeyboardState
+    
+RdosGetKeyboardState:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate get_keyboard_state_nr
+       movzx %ax,%eax
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosPutKeyboard
+#
+#   Purpose....: Put scancode in keyboard buffer
+#
+##########################################################################*/
+
+    .global RdosPutKeyboard
+    
+RdosPutKeyboard:
+       pushl %ebp
+       movl %esp,%ebp
+    pushl %edx
+
+       movw 8(%ebp),%ax
+       movb 12(%ebp),%dl
+       movb 16(%ebp),%dh
+       UserGate put_keyboard_code_nr
+
+    popl %edx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosPeekKeyEvent
+#
+#   Purpose....: Peek keyboard event
+#
+##########################################################################*/
+
+    .global RdosPeekKeyEvent
+    
+RdosPeekKeyEvent:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       UserGate peek_key_event_nr
+       jc rpeFail
+
+       movl 8(%ebp),%edi
+       movzx %ax,%eax
+       movl %eax,(%edi)
+
+       movl 12(%ebp),%edi
+       movzx %cx,%eax
+       movl %eax,(%edi)
+
+       movl 16(%ebp),%edi
+       movzx %dl,%eax
+       movl %eax,(%edi)
+
+       movl 20(%ebp),%edi
+       movzx %dh,%eax
+       movl %eax,(%edi)
+
+       movl $1,%eax
+       jmp rpeDone
+
+rpeFail:
+       xorl %eax,%eax
+
+rpeDone:
+       popl %edi
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadKeyEvent
+#
+#   Purpose....: Read keyboard event
+#
+##########################################################################*/
+
+    .global RdosReadKeyEvent
+    
+RdosReadKeyEvent:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       UserGate read_key_event_nr
+       jc rkeFail
+
+       movl 8(%ebp),%edi
+       movzx %ax,%eax
+       movl %eax,(%edi)
+
+       movl 12(%ebp),%edi
+       movzx %cx,%eax
+       movl %eax,(%edi)
+
+       movl 16(%ebp),%edi
+       movzx %dl,%eax
+       movl %eax,(%edi)
+
+       movl 20(%ebp),%edi
+       movzx %dh,%eax
+       movl %eax,(%edi)
+
+       movl $1,%eax
+       jmp rkeDone
+
+rkeFail:
+       xorl %eax,%eax
+
+rkeDone:
+       popl %edi
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosHideMouse
+#
+#   Purpose....: Hide mouse cursor
+#
+##########################################################################*/
+
+    .global RdosHideMouse
+    
+RdosHideMouse:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate hide_mouse_nr
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosShowMouse
+#
+#   Purpose....: Show mouse cursor
+#
+##########################################################################*/
+
+    .global RdosShowMouse
+    
+RdosShowMouse:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate show_mouse_nr
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetMousePosition
+#
+#   Purpose....: Get mouse position
+#
+#   Parameters.: &x, &y
+#
+##########################################################################*/
+
+    .global RdosGetMousePosition
+    
+RdosGetMousePosition:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+
+       UserGate get_mouse_position_nr
+
+       movl 8(%ebp),%eax
+       movzx %cx,%ecx
+       movl %ecx,(%eax)
+
+       movl 12(%ebp),%eax
+       movzx %dx,%edx
+       movl %edx,(%eax)
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetMousePosition
+#
+#   Purpose....: Set mouse position
+#
+#   Parameters.: x, y
+#
+##########################################################################*/
+
+    .global RdosSetMousePosition
+    
+RdosSetMousePosition:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%cx
+       movw 12(%ebp),%dx
+       UserGate set_mouse_position_nr
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetMouseWindow
+#
+#   Purpose....: Set mouse window
+#
+#   Parameters.: start x, start y
+#                end x, end y
+#
+##########################################################################*/
+
+    .global RdosSetMouseWindow
+    
+RdosSetMouseWindow:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %eax
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%ax
+       movw 12(%ebp),%bx
+       movw 16(%ebp),%cx
+       movw 20(%ebp),%dx
+       UserGate set_mouse_window_nr
+
+       popl %edx
+       popl %ecx
+       popl %ebx
+       popl %eax
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetMouseMickey
+#
+#   Purpose....: Set mouse mickey
+#
+#   Parameters.: x, y
+#
+##########################################################################*/
+
+    .global RdosSetMouseMickey
+    
+RdosSetMouseMickey:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%cx
+       movw 12(%ebp),%dx
+       UserGate set_mouse_mickey_nr
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetCursorPosition
+#
+#   Purpose....: Get cursor position
+#
+#   Parameters.: &x, &y
+#
+##########################################################################*/
+
+    .global RdosGetCursorPosition
+    
+RdosGetCursorPosition:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+
+       UserGate get_cursor_position_nr
+
+       movl 8(%ebp),%eax
+       movzx %cx,%ecx
+       movl %ecx,(%eax)
+
+       movl 12(%ebp),%eax
+       movzx %dx,%edx
+       movl %edx,(%eax)
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetCursorPosition
+#
+#   Purpose....: Set cursor position
+#
+#   Parameters.: x, y
+#
+##########################################################################*/
+
+    .global RdosSetCursorPosition
+    
+RdosSetCursorPosition:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+
+       movw 8(%ebp),%cx
+       movw 12(%ebp),%dx
+       UserGate set_cursor_position_nr
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetLeftButton
+#
+#   Purpose....: Check if left button is pressed
+#
+#   Returns....: TRUE if pressed
+#
+##########################################################################*/
+
+    .global RdosGetLeftButton
+    
+RdosGetLeftButton:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate get_left_button_nr
+       jc get_left_rel
+
+       mov $1,%eax
+       jmp get_left_done
+
+get_left_rel:
+       xorl %eax,%eax
+
+get_left_done:
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRightButton
+#
+#   Purpose....: Check if right button is pressed
+#
+#   Returns....: TRUE if pressed
+#
+##########################################################################*/
+
+    .global RdosGetRightButton
+    
+RdosGetRightButton:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate get_right_button_nr
+       jc get_right_rel
+
+       mov $1,%eax
+       jmp get_right_done
+
+get_right_rel:
+       xorl %eax,%eax
+
+get_right_done:
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetLeftButtonPressPosition
+#
+#   Purpose....: Get left button press position
+#
+#   Parameters.: &x, &y
+#
+##########################################################################*/
+
+    .global RdosGetLeftButtonPressPosition
+    
+RdosGetLeftButtonPressPosition:
+       pushl %ebp
+       movl %esp,%ebp
+
+       pushl %ecx
+       pushl %edx
+
+       UserGate get_left_button_press_position_nr
+
+       movl 8(%ebp),%eax
+       movzx %cx,%ecx
+       movl %ecx,(%eax)
+
+       movl 12(%ebp),%eax
+       movzx %dx,%edx
+       movl %edx,(%eax)
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRightButtonPressPosition
+#
+#   Purpose....: Get right button press position
+#
+#   Parameters.: &x, &y
+#
+##########################################################################*/
+
+    .global RdosGetRightButtonPressPosition
+    
+RdosGetRightButtonPressPosition:
+       pushl %ebp
+       movl %esp,%ebp
+
+       pushl %ecx
+       pushl %edx
+
+       UserGate get_right_button_press_position_nr
+
+       movl 8(%ebp),%eax
+       movzx %cx,%ecx
+       movl %ecx,(%eax)
+
+       movl 12(%ebp),%eax
+       movzx %dx,%edx
+       movl %edx,(%eax)
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetLeftButtonReleasePosition
+#
+#   Purpose....: Get left button release position
+#
+#   Parameters.: &x, &y
+#
+##########################################################################*/
+
+    .global RdosGetLeftButtonReleasePosition
+    
+RdosGetLeftButtonReleasePosition:
+       pushl %ebp
+       movl %esp,%ebp
+
+       pushl %ecx
+       pushl %edx
+
+       UserGate get_left_button_release_position_nr
+
+       movl 8(%ebp),%eax
+       movzx %cx,%ecx
+       movl %ecx,(%eax)
+
+       movl 12(%ebp),%eax
+       movzx %dx,%edx
+       movl %edx,(%eax)
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRightButtonReleasePosition
+#
+#   Purpose....: Get right button release position
+#
+#   Parameters.: &x, &y
+#
+##########################################################################*/
+
+    .global RdosGetRightButtonReleasePosition
+    
+RdosGetRightButtonReleasePosition:
+       pushl %ebp
+       movl %esp,%ebp
+
+       pushl %ecx
+       pushl %edx
+
+       UserGate get_right_button_release_position_nr
+
+       movl 8(%ebp),%eax
+       movzx %cx,%ecx
+       movl %ecx,(%eax)
+
+       movl 12(%ebp),%eax
+       movzx %dx,%edx
+       movl %edx,(%eax)
+
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadLine
+#
+#   Purpose....: Read a line from keyboard
+#
+#   Parameters.: Buffer
+#                Size
+#
+#   Returns....: Read count
+#
+##########################################################################*/
+
+    .global RdosReadLine
+    
+RdosReadLine:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%ecx
+       UserGate read_con_nr
+
+       popl %edi
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteChar
+#
+#   Purpose....: Write a character to screen
+#
+#   Parameters.: Char
+#
+##########################################################################*/
+
+    .global RdosWriteChar
+    
+RdosWriteChar:
+       pushl %ebp
+       movl %esp,%ebp
+
+       movb 8(%ebp),%al
+       UserGate write_char_nr
+
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteSizeString
+#
+#   Purpose....: Write a fixed number of characters to screen
+#
+#   Parameters.: String
+#                Count
+#
+##########################################################################*/
+
+    .global RdosWriteSizeString
+    
+RdosWriteSizeString:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%ecx
+       UserGate write_size_string_nr
+
+       popl %edi
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteString
+#
+#   Purpose....: Write a string to screen
+#
+#   Parameters.: String
+#
+##########################################################################*/
+
+    .global RdosWriteString
+    
+RdosWriteString:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate write_asciiz_nr
+
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosNameToIp
+#
+#   Purpose....: Convert host name to IP address
+#
+#   Parameters.: Name
+#                
+#   Returns....: IP
+#
+##########################################################################*/
+
+    .global RdosNameToIp
+    
+RdosNameToIp:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate name_to_ip_nr
+       jc rntiFail
+
+       movl %edx,%eax
+       jmp rntiDone
+
+rntiFail:
+       xorl %eax,%eax
+
+rntiDone:
+       popl %edi
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetIp
+#
+#   Purpose....: Get my IP
+#                
+#   Returns....: IP
+#
+##########################################################################*/
+
+    .global RdosGetIp
+    
+RdosGetIp:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate get_ip_address_nr
+       movl %edx,%eax
+
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosIpToName
+#
+#   Purpose....: Convert IP address to host name
+#
+#   Parameters.: IP
+#                Name                
+#                Size
+#
+##########################################################################*/
+
+    .global RdosIpToName
+    
+RdosIpToName:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+;
+       movl 8(%ebp),%edx
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ecx
+       UserGate ip_to_name_nr
+       jnc ritnDone
+
+ritnFail:
+       xorl %eax,%eax
+
+ritnDone:
+       popl %edi
+       popl %edx
+       popl %ecx
+       leave
+       ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosPing
+#
+#   Purpose....: Ping node
+#                
+#   Parameters.: IP
+#                Timeout
+#
+##########################################################################*/
+
+    .global RdosPing
+    
+RdosPing:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+;
+       movl 8(%ebp),%edx
+       movl 12(%ebp),%eax
+       UserGate ping_nr
+       jc ping_failed
+
+       movl $1,%eax
+       jmp ping_done
+
+ping_failed:
+       xorl %eax,%eax
+
+ping_done:
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenTcpConnection
+#
+#   Purpose....: Open an active connection over TCP
+#                
+#   Parameters.: RemoteIp
+#                LocalPort
+#                RemotePort
+#                Timeout in ms
+#                BufferSize
+#
+#   Returns....: Conn handle
+#
+##########################################################################*/
+
+    .global RdosOpenTcpConnection
+    
+RdosOpenTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%edx
+       movw 12(%ebp),%si
+       movw 16(%ebp),%di
+       movl 20(%ebp),%eax
+       movl 24(%ebp),%ecx
+       UserGate open_tcp_connection_nr
+       mov $0,%eax
+       jc rotcDone
+
+       movl %ebx,%eax
+
+rotcDone:
+       popl %edi
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateTcpListen
+#
+#   Purpose....: Create listen handle
+#                
+#   Parameters.: Port
+#                MaxConnections
+#                BufferSize
+#
+#   Returns....: Listen handle
+#
+##########################################################################*/
+
+    .global RdosCreateTcpListen
+    
+RdosCreateTcpListen:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+
+       movw 8(%ebp),%si
+       movw 12(%ebp),%ax
+       movl 16(%ebp),%ecx
+       UserGate create_tcp_listen_nr
+       movzx %bx,%eax
+       jnc ctlDone
+
+    xorl %eax,%eax
+
+ctlDone:
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetTcpListen
+#
+#   Purpose....: Get connection from listen
+#                
+#   Parameters.: Listen handle
+#
+#   Returns....: Conn handle
+#
+##########################################################################*/
+
+    .global RdosGetTcpListen
+    
+RdosGetTcpListen:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_tcp_listen_nr
+       movzx %ax,%eax
+       jnc gtlDone
+
+    xorl %eax,%eax
+
+gtlDone:
+    popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseTcpListen
+#
+#   Purpose....: Close TCP listen
+#                
+#   Parameters.: Listen handle
+#
+##########################################################################*/
+
+    .global RdosCloseTcpListen
+    
+RdosCloseTcpListen:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_tcp_listen_nr
+       
+    popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForTcpListen
+#
+#   Purpose....: Add wait object to tcp listen
+#                
+#   Parameters.: Wait handle
+#                Listen handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForTcpListen
+    
+RdosAddWaitForTcpListen:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       movl 16(%ebp),%ecx
+       UserGate add_wait_for_tcp_listen_nr
+       movl $1,%eax
+       jnc awftlDone
+
+       xorl %eax,%eax
+
+awftlDone:
+    popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWaitForTcpConnection
+#
+#   Purpose....: Wait for Tcp connection to be established
+#                
+#   Parameters.: Conn handle
+#                Timeout ms
+#
+##########################################################################*/
+
+    .global RdosWaitForTcpConnection
+    
+RdosWaitForTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%eax
+       UserGate wait_for_tcp_connection_nr
+       movl $1,%eax
+       jnc wftcDone
+
+       xorl %eax,%eax
+
+wftcDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddWaitForTcpConnection
+#
+#   Purpose....: Add wait object to tcp connection
+#                
+#   Parameters.: Wait handle
+#                Conn handle
+#                ID
+#
+##########################################################################*/
+
+    .global RdosAddWaitForTcpConnection
+    
+RdosAddWaitForTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+
+       movw 8(%ebp),%bx
+       movw 12(%ebp),%ax
+       movl 16(%ebp),%ecx
+       UserGate add_wait_for_tcp_connection_nr
+       movl $1,%eax
+       jnc awftcDone
+
+       xorl %eax,%eax
+
+awftcDone:
+    popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseTcpConnection
+#
+#   Purpose....: Close Tcp connection
+#                
+#   Parameters.: Conn handle
+#
+##########################################################################*/
+
+    .global RdosCloseTcpConnection
+    
+RdosCloseTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate close_tcp_connection_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDeleteTcpConnection
+#
+#   Purpose....: Delete Tcp connection
+#                
+#   Parameters.: Conn handle
+#
+##########################################################################*/
+
+    .global RdosDeleteTcpConnection
+    
+RdosDeleteTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate delete_tcp_connection_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAbortTcpConnection
+#
+#   Purpose....: Abort Tcp connection
+#                
+#   Parameters.: Conn handle
+#
+##########################################################################*/
+
+    .global RdosAbortTcpConnection
+    
+RdosAbortTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate abort_tcp_connection_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosPushTcpConnection
+#
+#   Purpose....: Push Tcp connection
+#                
+#   Parameters.: Conn handle
+#
+##########################################################################*/
+
+    .global RdosPushTcpConnection
+    
+RdosPushTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate push_tcp_connection_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosPollTcpConnection
+#
+#   Purpose....: Poll Tcp connection
+#                
+#   Parameters.: Conn handle
+#
+#   Returns....: Available bytes in receive buffer
+#
+##########################################################################*/
+
+    .global RdosPollTcpConnection
+    
+RdosPollTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate poll_tcp_connection_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosIsTcpConnectionClosed
+#
+#   Purpose....: Check if connection is closed
+#                
+#   Parameters.: Conn handle
+#
+#   Returns....: TRUE if closed
+#
+##########################################################################*/
+
+    .global RdosIsTcpConnectionClosed
+    
+RdosIsTcpConnectionClosed:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate is_tcp_connection_closed_nr
+       jc rptcClosed
+
+       xorl %eax,%eax
+       jmp rptcDone
+
+rptcClosed:
+       movl $1,%eax
+       
+rptcDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRemoteTcpConnectionIp
+#
+#   Purpose....: Get remote IP
+#                
+#   Parameters.: Conn handle
+#
+#   Returns....: IP
+#
+##########################################################################*/
+
+    .global RdosGetRemoteTcpConnectionIp
+    
+RdosGetRemoteTcpConnectionIp:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_remote_tcp_connection_ip_nr
+       jnc grtciDone
+
+       movl $0xFFFFFFFF,%eax
+       
+grtciDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRemoteTcpConnectionPort
+#
+#   Purpose....: Get remote port
+#                
+#   Parameters.: Conn handle
+#
+#   Returns....: Port
+#
+##########################################################################*/
+
+    .global RdosGetRemoteTcpConnectionPort
+    
+RdosGetRemoteTcpConnectionPort:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_remote_tcp_connection_port_nr
+       jnc grtcpDone
+
+       movl $0,%eax
+       
+grtcpDone:
+    movzx %ax,%eax
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetLocalTcpConnectionPort
+#
+#   Purpose....: Get local port
+#                
+#   Parameters.: Conn handle
+#
+#   Returns....: Port
+#
+##########################################################################*/
+
+    .global RdosGetLocalTcpConnectionPort
+    
+RdosGetLocalTcpConnectionPort:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movw 8(%ebp),%bx
+       UserGate get_local_tcp_connection_port_nr
+       jnc gltcpDone
+
+       movl $0,%eax
+       
+gltcpDone:
+    movzx %ax,%eax
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadTcpConnection
+#
+#   Purpose....: Read data from connection
+#                
+#   Parameters.: Conn handle
+#                Buffer
+#                Size
+#
+#   Returns....: Read bytes
+#
+##########################################################################*/
+
+    .global RdosReadTcpConnection
+    
+RdosReadTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ecx
+       UserGate read_tcp_connection_nr
+
+       popl %edi
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteTcpConnection
+#
+#   Purpose....: Write data fto connection
+#                
+#   Parameters.: Conn handle
+#                Buffer
+#                Size
+#
+#   Returns....: Written bytes
+#
+##########################################################################*/
+
+    .global RdosWriteTcpConnection
+    
+RdosWriteTcpConnection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ecx
+       UserGate write_tcp_connection_nr
+
+       popl %edi
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetLocalMailslot
+#
+#   Purpose....: Get local mailslot from name
+#                
+#   Parameters.: Name
+#
+#   Returns....: Mailslot handle
+#
+##########################################################################*/
+
+    .global RdosGetLocalMailslot
+    
+RdosGetLocalMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate get_local_mailslot_nr
+       jc rglmFail
+
+       movzx %bx,%eax
+       jmp rglmDone
+
+rglmFail:
+       xorl %eax,%eax
+
+rglmDone:
+       popl %edi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRemoteMailslot
+#
+#   Purpose....: Get remote mailslot from name
+#                
+#   Parameters.: IP
+#                Name
+#
+#   Returns....: Mailslot handle
+#
+##########################################################################*/
+
+    .global RdosGetRemoteMailslot
+    
+RdosGetRemoteMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edx
+       pushl %edi
+
+       movl 8(%ebp),%edx
+       movl 12(%ebp),%edi
+       UserGate get_remote_mailslot_nr
+       jc rgrmFail
+
+       movzx %bx,%eax
+       jmp rgrmDone
+
+rgrmFail:
+       xorl %eax,%eax
+
+rgrmDone:
+       popl %edi
+       popl %edx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosFreeMailslot
+#
+#   Purpose....: Free mailslot
+#                
+#   Parameters.: Mailslot handle
+#
+##########################################################################*/
+
+    .global RdosFreeMailslot
+    
+RdosFreeMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       UserGate free_mailslot_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSendMailslot
+#
+#   Purpose....: Send mailslot
+#                
+#   Parameters.: Mailslot handle
+#                               Msg
+#                               Size
+#                               ReplyBuf
+#                               MaxReplySize
+#
+#   Returns....: Size of reply
+#
+##########################################################################*/
+
+    .global RdosSendMailslot
+    
+RdosSendMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+       pushl %edi
+
+       movw 8(%ebp),%bx
+       movl 12(%ebp),%esi
+       movl 16(%ebp),%ecx
+       movl 20(%ebp),%edi
+       movl 24(%ebp),%eax
+       UserGate send_mailslot_nr
+       jc smFail
+
+       movl %ecx,%eax
+       jmp smDone
+
+smFail:
+       movl $0xFFFFFFFF,%eax
+
+smDone:
+       popl %edi
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDefineMailslot
+#
+#   Purpose....: Define mailslot
+#                
+#   Parameters.: Name
+#                Max msg size
+#
+##########################################################################*/
+
+    .global RdosDefineMailslot
+    
+RdosDefineMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%ecx
+       UserGate define_mailslot_nr
+
+       popl %edi
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReceiveMailslot
+#
+#   Purpose....: Receive from mailslot
+#                
+#   Parameters.: Msg buffer
+#
+#   Returns....: Msg size
+#
+##########################################################################*/
+
+    .global RdosReceiveMailslot
+    
+RdosReceiveMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       UserGate receive_mailslot_nr
+       movl %ecx,%eax
+
+       popl %edi
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReplyMailslot
+#
+#   Purpose....: Reply to mailslot
+#                
+#   Parameters.: Msg buffer
+#                Msg size
+#
+##########################################################################*/
+
+    .global RdosReplyMailslot
+    
+RdosReplyMailslot:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edi
+
+       movl 8(%ebp),%edi
+       movl 12(%ebp),%ecx
+       UserGate reply_mailslot_nr
+
+       popl %edi
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetIdeDisc
+#
+#   Purpose....: Get IDE disc
+#                
+#   Parameters.: Unit #
+#
+#   Returns....: Disc #
+#
+##########################################################################*/
+
+    .global RdosGetIdeDisc
+    
+RdosGetIdeDisc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movb 8(%ebp),%bl
+       UserGate get_ide_disc_nr
+       jc get_ide_disc_fail
+
+    movzx %al,%eax
+       jmp get_ide_disc_done
+
+get_ide_disc_fail:
+       movl $0xFFFFFFFF,%eax
+
+get_ide_disc_done:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetFloppyDisc
+#
+#   Purpose....: Get floppy disc
+#                
+#   Parameters.: Unit #
+#
+#   Returns....: Disc #
+#
+##########################################################################*/
+
+    .global RdosGetFloppyDisc
+    
+RdosGetFloppyDisc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movb 8(%ebp),%bl
+       UserGate get_floppy_disc_nr
+       jc get_floppy_disc_fail
+
+    movzx %al,%eax
+       jmp get_floppy_disc_done
+
+get_floppy_disc_fail:
+       movl $0xFFFFFFFF,%eax
+
+get_floppy_disc_done:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetDiscInfo
+#
+#   Purpose....: Get disc info
+#                
+#   Parameters.: Disc #
+#                               Bytes / sector
+#                               Total sectors
+#                               BIOS sectors / cyl
+#                               BIOS heads
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosGetDiscInfo
+    
+RdosGetDiscInfo:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movb 8(%ebp),%al
+       UserGate get_disc_info_nr
+       jc get_disc_info_fail
+
+       movl 12(%ebp),%ebx
+       movzx %cx,%ecx
+       movl %ecx,(%ebx)
+
+       movl 16(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       movl 20(%ebp),%ebx
+       movzx %si,%esi
+       movl %esi,(%ebx)
+
+       movl 24(%ebp),%ebx
+       movzx %di,%edi
+       movl %edi,(%ebx)
+
+       movl $1,%eax
+       jmp get_disc_info_done
+
+get_disc_info_fail:
+       xorl %eax,%eax
+
+get_disc_info_done:
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetDiscInfo
+#
+#   Purpose....: Set disc info
+#                
+#   Parameters.: Disc #
+#                               Bytes / sector
+#                               Total sectors
+#                               BIOS sectors / cyl
+#                               BIOS heads
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosSetDiscInfo
+    
+RdosSetDiscInfo:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+       pushl %esi
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%ecx
+       movl 16(%ebp),%edx
+       movl 20(%ebp),%esi
+       movl 24(%ebp),%edi
+       UserGate set_disc_info_nr
+       jc set_disc_info_fail
+
+       movl $1,%eax
+       jmp set_disc_info_done
+
+set_disc_info_fail:
+       xorl %eax,%eax
+
+set_disc_info_done:
+       popl %edi
+       popl %esi
+       popl %edx
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadDisc
+#
+#   Purpose....: Read from disc
+#                
+#   Parameters.: Disc #
+#                               Sector #
+#                               Buffer
+#                               Size
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosReadDisc
+    
+RdosReadDisc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%edx
+       movl 16(%ebp),%edi
+       movl 20(%ebp),%ecx
+       UserGate read_disc_nr
+       jc read_disc_fail
+
+       movl $1,%eax
+       jmp read_disc_done
+
+read_disc_fail:
+       xorl %eax,%eax
+
+read_disc_done:
+       popl %edi
+       popl %edx
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteDisc
+#
+#   Purpose....: Write to disc
+#                
+#   Parameters.: Disc #
+#                               Sector #
+#                               Buffer
+#                               Size
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosWriteDisc
+    
+RdosWriteDisc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%edx
+       movl 16(%ebp),%edi
+       movl 20(%ebp),%ecx
+       UserGate write_disc_nr
+       jc write_disc_fail
+
+       movl $1,%eax
+       jmp write_disc_done
+
+write_disc_fail:
+       xorl %eax,%eax
+
+write_disc_done:
+       popl %edi
+       popl %edx
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAllocateFixedDrive
+#
+#   Purpose....: Allocate fixed drive
+#                
+#   Parameters.: Drive #
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosAllocateFixedDrive
+    
+RdosAllocateFixedDrive:
+       pushl %ebp
+       movl %esp,%ebp
+
+       movb 8(%ebp),%al
+       UserGate allocate_fixed_drive_nr
+       jc allocate_fixed_drive_fail
+
+       movl $1,%eax
+       jmp allocate_fixed_drive_done
+
+allocate_fixed_drive_fail:
+       xorl %eax,%eax
+
+allocate_fixed_drive_done:
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAllocateStaticDrive
+#
+#   Purpose....: Allocate static drive
+#                
+#   Returns....: Drive #
+#
+##########################################################################*/
+
+    .global RdosAllocateStaticDrive
+    
+RdosAllocateStaticDrive:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate allocate_static_drive_nr
+       jc allocate_static_drive_fail
+
+    movzx %al,%eax
+       jmp allocate_static_drive_done
+
+allocate_static_drive_fail:
+       xorl %eax,%eax
+
+allocate_static_drive_done:
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAllocateDynamicDrive
+#
+#   Purpose....: Allocate dynamic drive
+#                
+#   Returns....: Drive #
+#
+##########################################################################*/
+
+    .global RdosAllocateDynamicDrive
+    
+RdosAllocateDynamicDrive:
+       pushl %ebp
+       movl %esp,%ebp
+
+       UserGate allocate_dynamic_drive_nr
+       jc allocate_dynamic_drive_fail
+
+    movzx %al,%eax
+       jmp allocate_dynamic_drive_done
+
+allocate_dynamic_drive_fail:
+       xorl %eax,%eax
+
+allocate_dynamic_drive_done:
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetRdfsInfo
+#
+#   Purpose....: Get rdfs info
+#                
+#   Parameters.: Crypt tab
+#                Key tab
+#                Extent size tab
+#
+##########################################################################*/
+
+    .global RdosGetRdfsInfo
+    
+RdosGetRdfsInfo:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%esi
+       movl 12(%ebp),%edi
+       movl 16(%ebp),%ebx
+       UserGate get_rdfs_info_nr
+
+       popl %edi
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetDriveInfo
+#
+#   Purpose....: Get drive info
+#                
+#   Parameters.: Drive #
+#                Free units
+#                Bytes per unit
+#                Total units
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosGetDriveInfo
+    
+RdosGetDriveInfo:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movb 8(%ebp),%al
+       UserGate get_drive_info_nr
+       jc get_drive_info_fail
+
+       movl 12(%ebp),%ebx
+       movl %eax,(%ebx)
+
+       movl 16(%ebp),%ebx
+       movzx %cx,%ecx
+       movl %ecx,(%ebx)
+
+       movl 20(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       movl $1,%eax
+       jmp get_drive_info_done
+
+get_drive_info_fail:
+       xorl %eax,%eax
+
+get_drive_info_done:
+       popl %edx
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDemandLoadDrive
+#
+#   Purpose....: Demand load drive
+#                
+#   Parameters.: Drive #
+#
+##########################################################################*/
+
+    .global RdosDemandLoadDrive
+    
+RdosDemandLoadDrive:
+       pushl %ebp
+       movl %esp,%ebp
+
+       movb 8(%ebp),%al
+       UserGate demand_load_drive_nr
+
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetDriveDiscParam
+#
+#   Purpose....: Get drive disc parameters
+#                
+#   Parameters.: Drive #
+#                Disc #
+#                Start sector
+#                Total sectors
+#
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosGetDriveDiscParam
+    
+RdosGetDriveDiscParam:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %edx
+
+       movb 8(%ebp),%al
+       UserGate get_drive_disc_param_nr
+       jc get_drive_disc_param_fail
+
+       movl 12(%ebp),%ebx
+       movzx %al,%eax
+       movl %eax,(%ebx)
+
+       movl 16(%ebp),%ebx
+       movl %edx,(%ebx)
+
+       movl 20(%ebp),%ebx
+       movl %ecx,(%ebx)
+
+       movl $1,%eax
+       jmp get_drive_disc_param_done
+
+get_drive_disc_param_fail:
+       xorl %eax,%eax
+
+get_drive_disc_param_done:
+       popl %edx
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosFormatDrive
+#
+#   Purpose....: Format drive
+#                
+#   Parameters.: Disc #
+#                Start sector
+#                Sectors
+#                FS name
+#
+#   Returns....: Drive #
+#
+##########################################################################*/
+
+    .global RdosFormatDrive
+    
+RdosFormatDrive:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %edx
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%edx
+       movl 16(%ebp),%ecx
+       movl 20(%ebp),%edi
+       UserGate format_drive_nr
+       jc rfdFail
+
+    movzx %al,%eax
+    jmp rfdDone
+
+rfdFail:
+    xorl %eax,%eax
+
+rfdDone:
+       popl %edi
+       popl %edx
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetExeName
+#
+#   Purpose....: Get name of executable file
+#
+#   Returns....: Exe pathname
+#
+##########################################################################*/
+
+    .global RdosGetExeName
+    
+RdosGetExeName:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       UserGate get_exe_name_nr
+       jc rgenFail
+
+    movl %edi,%eax
+    jmp rgenDone
+
+rgenFail:
+    xorl %eax,%eax
+
+rgenDone:
+       popl %edi
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenAdc
+#
+#   Purpose....: Open handle to ADC channel
+#
+#   Parameters.: Channel #
+#
+#   Returns....: Adc handle
+#
+##########################################################################*/
+
+    .global RdosOpenAdc
+    
+RdosOpenAdc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%eax
+       UserGate open_adc_nr
+       movw %bx,%ax
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseAdc
+#
+#   Purpose....: Close ADC handle
+#
+#   Parameters.: Adc handle
+#
+##########################################################################*/
+
+    .global RdosCloseAdc
+    
+RdosCloseAdc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       UserGate close_adc_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDefineAdcTime
+#
+#   Purpose....: Define time of next conversion
+#
+#   Parameters.: Adc handle
+#                MSB time
+#                LSB time
+#
+##########################################################################*/
+
+    .global RdosDefineAdcTime
+    
+RdosDefineAdcTime:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edx
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%edx
+       movl 16(%ebp),%eax
+       UserGate define_adc_time_nr
+
+    popl %edx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadAdc
+#
+#   Purpose....: Read ADC
+#
+#   Parameters.: Adc handle
+#                
+#   Returns....: Value
+#
+##########################################################################*/
+
+    .global RdosReadAdc
+    
+RdosReadAdc:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       UserGate read_adc_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadSerialLines
+#
+#   Purpose....: Read serial lines
+#
+#   Parameters.: Device
+#                &Value
+#                
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosReadSerialLines
+    
+RdosReadSerialLines:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+       pushl %esi
+
+       movb 8(%ebp),%dh
+       UserGate read_serial_lines_nr
+       jc rdsFail
+
+       movzx %al,%eax
+       movl 12(%ebp),%esi
+       movl %eax,(%esi)
+       movl $1,%eax
+       jmp rdsDone
+
+rdsFail:
+       xorl %eax,%eax
+
+rdsDone:
+       popl %esi
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosToggleSerialLine
+#
+#   Purpose....: Toggle serial line
+#
+#   Parameters.: Device
+#                Line
+#                
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosToggleSerialLine
+    
+RdosToggleSerialLine:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+
+       movb 8(%ebp),%dh
+       movb 12(%ebp),%dl
+       UserGate toggle_serial_line_nr
+       jc rtsFail
+
+       movl $1,%eax
+       jmp rtsDone
+
+rtsFail:
+       xorl %eax,%eax
+
+rtsDone:
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadSerialVal
+#
+#   Purpose....: Read serial value
+#
+#   Parameters.: Device
+#                Line
+#                &Val
+#                
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosReadSerialVal
+    
+RdosReadSerialVal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+       pushl %esi
+
+       movb 8(%ebp),%dh
+       movb 12(%ebp),%dl
+       UserGate read_serial_val_nr
+
+    pushfw
+       shll $8,%eax
+       movl 16(%ebp),%esi
+       movl %eax,(%esi)
+    popfw
+       jc rdvFail
+
+       movl $1,%eax
+       jmp rdvDone
+
+rdvFail:
+       xorl %eax,%eax
+
+rdvDone:
+       popl %esi
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteSerialVal
+#
+#   Purpose....: Write serial value
+#
+#   Parameters.: Device
+#                Line
+#                Val
+#                
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosWriteSerialVal
+    
+RdosWriteSerialVal:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+
+       movb 8(%ebp),%dh
+       movb 12(%ebp),%dl
+       movl 16(%ebp),%eax
+       sarl $8,%eax
+       UserGate write_serial_val_nr
+       jc rwvFail
+
+       movl $1,%eax
+       jmp rwvDone
+
+rwvFail:
+       xorl %eax,%eax
+
+rwvDone:
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadSerialRaw
+#
+#   Purpose....: Read serial raw value
+#
+#   Parameters.: Device
+#                Line
+#                &Val
+#                
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosReadSerialRaw
+    
+RdosReadSerialRaw:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+       pushl %esi
+
+       movb 8(%ebp),%dh
+       movb 12(%ebp),%dl
+       UserGate read_serial_val_nr
+
+    pushfw
+       movl 16(%ebp),%esi
+       movl %eax,(%esi)
+    popfw
+       jc rdrFail
+
+       movl $1,%eax
+       jmp rdrDone
+
+rdrFail:
+       xorl %eax,%eax
+
+rdrDone:
+       popl %esi
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteSerialRaw
+#
+#   Purpose....: Write serial raw value
+#
+#   Parameters.: Device
+#                Line
+#                Val
+#                
+#   Returns....: TRUE if ok
+#
+##########################################################################*/
+
+    .global RdosWriteSerialRaw
+    
+RdosWriteSerialRaw:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edx
+
+       movb 8(%ebp),%dh
+       movb 12(%ebp),%dl
+       movl 16(%ebp),%eax
+       UserGate write_serial_val_nr
+       jc rwrFail
+
+       movl $1,%eax
+       jmp rwrDone
+
+rwrFail:
+       xorl %eax,%eax
+
+rwrDone:
+       popl %edx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenSysEnv
+#
+#   Purpose....: Open system environment
+#                
+#   Returns....: Env handle
+#
+##########################################################################*/
+
+    .global RdosOpenSysEnv
+    
+RdosOpenSysEnv:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       UserGate open_sys_env_nr
+       jc oseFail
+
+       movzx %bx,%eax
+       jmp oseDone
+
+oseFail:
+       xorl %eax,%eax
+
+oseDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenProcessEnv
+#
+#   Purpose....: Open process environment
+#                
+#   Returns....: Env handle
+#
+##########################################################################*/
+
+    .global RdosOpenProcessEnv
+    
+RdosOpenProcessEnv:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       UserGate open_proc_env_nr
+       jc opeFail
+
+       movzx %bx,%eax
+       jmp opeDone
+
+opeFail:
+       xorl %eax,%eax
+
+opeDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseEnv
+#
+#   Purpose....: Close environment
+#
+#   Parameters.: Env handle
+#
+##########################################################################*/
+
+    .global RdosCloseEnv
+    
+RdosCloseEnv:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       UserGate close_env_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosAddEnvVar
+#
+#   Purpose....: Add environment variable
+#
+#   Parameters.: Env handle
+#                var
+#                data
+#
+##########################################################################*/
+
+    .global RdosAddEnvVar
+    
+RdosAddEnvVar:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%esi
+       movl 16(%ebp),%edi
+       UserGate add_env_var_nr
+
+       popl %edi
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDeleteEnvVar
+#
+#   Purpose....: Delete environment variable
+#
+#   Parameters.: Env handle
+#                var
+#
+##########################################################################*/
+
+    .global RdosDeleteEnvVar
+    
+RdosDeleteEnvVar:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%esi
+       UserGate delete_env_var_nr
+
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosFindEnvVar
+#
+#   Purpose....: Find environment variable
+#
+#   Parameters.: Env handle
+#                var
+#                data
+#
+##########################################################################*/
+
+    .global RdosFindEnvVar
+    
+RdosFindEnvVar:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%esi
+       movl 16(%ebp),%edi
+       UserGate find_env_var_nr
+       jc fevFail
+
+       movl $1,%eax
+       jmp fevDone
+
+fevFail:
+       xorl %eax,%eax
+
+fevDone:
+       popl %edi
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGetEnvData
+#
+#   Purpose....: Get raw environment data
+#
+#   Parameters.: Env handle
+#                data
+#
+##########################################################################*/
+
+    .global RdosGetEnvData
+    
+RdosGetEnvData:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%edi
+       UserGate get_env_data_nr
+       jnc gedDone
+
+       xorw %ax,%ax
+       stosw
+
+gedDone:
+       popl %edi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosSetEnvData
+#
+#   Purpose....: Set raw environment data
+#
+#   Parameters.: Env handle
+#                data
+#
+##########################################################################*/
+
+    .global RdosSetEnvData
+    
+RdosSetEnvData:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%edi
+       UserGate set_env_data_nr
+
+       popl %edi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenSysIni
+#
+#   Purpose....: Open system ini-file
+#
+#   Returns....: Ini handle
+#
+##########################################################################*/
+
+    .global RdosOpenSysIni
+    
+RdosOpenSysIni:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       UserGate open_sys_ini_nr
+       jc osiFail
+
+       movzx %bx,%eax
+       jmp osiDone
+
+osiFail:
+       xorl %eax,%eax
+
+osiDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCloseIni
+#
+#   Purpose....: Close ini-file
+#
+#   Parameters.: Ini handle
+#
+##########################################################################*/
+
+    .global RdosCloseIni
+    
+RdosCloseIni:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       UserGate close_ini_nr
+
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosGotoIniSection
+#
+#   Purpose....: Goto ini section
+#
+#   Parameters.: Ini handle
+#                SectionName
+#
+##########################################################################*/
+
+    .global RdosGotoIniSection
+    
+RdosGotoIniSection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%edi
+       UserGate goto_ini_section_nr
+       jc gisFail
+
+       movl $1,%eax
+       jmp gisDone
+
+gisFail:
+       xorl %eax,%eax
+
+gisDone:
+       popl %edi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosRemoveIniSection
+#
+#   Purpose....: Remove current ini section
+#
+#   Parameters.: Ini handle
+#
+##########################################################################*/
+
+    .global RdosRemoveIniSection
+    
+RdosRemoveIniSection:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+
+       movl 8(%ebp),%ebx
+       UserGate remove_ini_section_nr
+       jc risFail
+
+       movl $1,%eax
+       jmp risDone
+
+risFail:
+       xorl %eax,%eax
+
+risDone:
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosReadIni
+#
+#   Purpose....: Read ini var in current section
+#
+#   Parameters.: Ini handle
+#                VarName
+#                Data
+#                MaxSize
+#
+##########################################################################*/
+
+    .global RdosReadIni
+    
+RdosReadIni:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %ecx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%esi
+       movl 16(%ebp),%edi
+       movl 20(%ebp),%ecx
+       UserGate read_ini_nr
+       jc riFail
+
+       movl $1,%eax
+       jmp riDone
+
+riFail:
+       xorl %eax,%eax
+
+riDone:
+       popl %edi
+       popl %esi
+       popl %ecx
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosWriteIni
+#
+#   Purpose....: Write ini var in current section
+#
+#   Parameters.: Ini handle
+#                VarName
+#                Data
+#
+##########################################################################*/
+
+    .global RdosWriteIni
+    
+RdosWriteIni:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+       pushl %edi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%esi
+       movl 16(%ebp),%edi
+       UserGate write_ini_nr
+       jc wiFail
+
+       movl $1,%eax
+       jmp wiDone
+
+wiFail:
+       xorl %eax,%eax
+
+wiDone:
+       popl %edi
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDeleteIni
+#
+#   Purpose....: Delete ini var in current section
+#
+#   Parameters.: Ini handle
+#                VarName
+#
+##########################################################################*/
+
+    .global RdosDeleteIni
+    
+RdosDeleteIni:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ebx
+       pushl %esi
+
+       movl 8(%ebp),%ebx
+       movl 12(%ebp),%esi
+       UserGate delete_ini_nr
+       jc diFail
+
+       movl $1,%eax
+       jmp diDone
+
+diFail:
+       xorl %eax,%eax
+
+diDone:
+       popl %esi
+       popl %ebx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosCreateFileDrive
+#
+#   Purpose....: Create a new file-drive
+#
+#   Parameters.: Drive
+#                Size
+#                FS name
+#                Filename
+#
+##########################################################################*/
+
+    .global RdosCreateFileDrive
+    
+RdosCreateFileDrive:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %ecx
+       pushl %esi
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%ecx
+       movl 16(%ebp),%esi
+       movl 20(%ebp),%edi
+       UserGate create_file_drive_nr
+       jnc cfdOk
+
+    xorl %eax,%eax
+    jmp cfdDone
+
+cfdOk:
+       movl $1,%eax
+
+cfdDone:
+       popl %edi
+       popl %esi
+       popl %ecx
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosOpenFileDrive
+#
+#   Purpose....: Open a new file-drive
+#
+#   Parameters.: Drive
+#                Filename
+#
+##########################################################################*/
+
+    .global RdosOpenFileDrive
+    
+RdosOpenFileDrive:
+       pushl %ebp
+       movl %esp,%ebp
+       pushl %edi
+
+       movb 8(%ebp),%al
+       movl 12(%ebp),%edi
+       UserGate open_file_drive_nr
+       jnc ofdOk
+
+       xorl %eax,%eax
+       jmp ofdDone
+
+ofdOk:
+       movl $1,%eax
+
+ofdDone:
+       popl %edi
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosEnableStatusLed
+#
+#   Purpose....: Enable status LED
+#
+##########################################################################*/
+
+    .global RdosEnableStatusLed
+    
+RdosEnableStatusLed:
+       pushl %ebp
+       movl %esp,%ebp
+       UserGate enable_status_led_nr
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosDisableStatusLed
+#
+#   Purpose....: Disable status LED
+#
+##########################################################################*/
+
+    .global RdosDisableStatusLed
+    
+RdosDisableStatusLed:
+       pushl %ebp
+       movl %esp,%ebp
+       UserGate disable_status_led_nr
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosStartWatchdog
+#
+#   Purpose....: Start watchdog
+#
+#   Parameters.: Timeout, ms
+#
+##########################################################################*/
+
+    .global RdosStartWatchdog
+    
+RdosStartWatchdog:
+       pushl %ebp
+       movl %esp,%ebp
+;
+       movl 8(%ebp),%eax
+       UserGate start_watchdog_nr
+;      
+    leave
+    ret
+                                                                                   
+/*##########################################################################
+#
+#   Name       : RdosKickWatchdog
+#
+#   Purpose....: Kick watchdog
+#
+##########################################################################*/
+
+    .global RdosKickWatchdog
+    
+RdosKickWatchdog:
+       pushl %ebp
+       movl %esp,%ebp
+       UserGate kick_watchdog_nr
+    leave
+    ret
+                                           
diff --git a/newlib/libc/sys/rdos/rdos.h b/newlib/libc/sys/rdos/rdos.h
new file mode 100755 (executable)
index 0000000..6905000
--- /dev/null
@@ -0,0 +1,344 @@
+\r
+#ifndef _RDOS_H\r
+#define _RDOS_H\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+//#undef WIN32\r
+\r
+#define FILE_ATTRIBUTE_READONLY         0x1\r
+#define FILE_ATTRIBUTE_HIDDEN           0x2\r
+#define FILE_ATTRIBUTE_SYSTEM           0x4\r
+#define FILE_ATTRIBUTE_DIRECTORY        0x10\r
+#define FILE_ATTRIBUTE_ARCHIVE          0x20\r
+#define FILE_ATTRIBUTE_NORMAL           0x80\r
+\r
+#define LGOP_NULL  0\r
+#define LGOP_NONE  1\r
+#define LGOP_OR  2\r
+#define LGOP_AND  3\r
+#define LGOP_XOR  4\r
+#define LGOP_INVERT  5\r
+#define LGOP_INVERT_OR  6\r
+#define LGOP_INVERT_AND  7\r
+#define LGOP_INVERT_XOR  8\r
+#define LGOP_ADD  9\r
+#define LGOP_SUBTRACT  10\r
+#define LGOP_MULTIPLY  11\r
+\r
+#define getred(pgc)       (((pgc)>>16)&0xFF)\r
+#define getgreen(pgc)     (((pgc)>>8)&0xFF)\r
+#define getblue(pgc)      ((pgc)&0xFF)\r
+#define mkcolor(r,g,b)    (((r)<<16)|((g)<<8)|(b))\r
+\r
+typedef struct ThreadState\r
+{\r
+        short int ID;\r
+        char Name[32];\r
+        unsigned long MsbTime;\r
+        unsigned long LsbTime;\r
+        char List[32];\r
+        long Offset;\r
+        short int Sel;\r
+} ThreadState;\r
+\r
+#ifdef __GNUC__\r
+#define __stdcall\r
+#else\r
+#if (sizeof(int) == 2)\r
+#define __stdcall\r
+#endif\r
+#endif\r
+\r
+short int __stdcall RdosSwapShort(short int val);\r
+long __stdcall RdosSwapLong(long val);\r
+\r
+void __stdcall RdosSetTextMode();\r
+int __stdcall RdosSetVideoMode(int *BitsPerPixel, int *xres, int *yres, int *linesize, void **buffer);\r
+void __stdcall RdosSetClipRect(int handle, int xmin, int ymin, int xmax, int ymax);\r
+void __stdcall RdosClearClipRect(int handle);\r
+void __stdcall RdosSetDrawColor(int handle, int color);\r
+void __stdcall RdosSetLGOP(int handle, int lgop);\r
+void __stdcall RdosSetHollowStyle(int handle);\r
+void __stdcall RdosSetFilledStyle(int handle);\r
+int __stdcall RdosOpenFont(int height);\r
+void __stdcall RdosCloseFont(int font);\r
+void __stdcall RdosGetStringMetrics(int font, const char *str, int *width, int *height);\r
+void __stdcall RdosSetFont(int handle, int font);\r
+int __stdcall RdosGetPixel(int handle, int x, int y);\r
+void __stdcall RdosSetPixel(int handle, int x, int y);\r
+void __stdcall RdosBlit(int SrcHandle, int DestHandle, int width, int height,\r
+                               int SrcX, int SrcY, int DestX, int DestY);\r
+void __stdcall RdosDrawMask(int handle, void *mask, int RowSize, int width, int height,\r
+                               int SrcX, int SrcY, int DestX, int DestY); \r
+void __stdcall RdosDrawLine(int handle, int x1, int y1, int x2, int y2);\r
+void __stdcall RdosDrawString(int handle, int x, int y, const char *str);\r
+void __stdcall RdosDrawRect(int handle, int x, int y, int width, int height);\r
+void __stdcall RdosDrawEllipse(int handle, int x, int y, int width, int height);\r
+int __stdcall RdosCreateBitmap(int BitsPerPixel, int width, int height);\r
+int __stdcall RdosDuplicateBitmapHandle(int handle);\r
+void __stdcall RdosCloseBitmap(int handle);\r
+int __stdcall RdosCreateStringBitmap(int font, const char *str);\r
+void __stdcall RdosGetBitmapInfo(int handle, int *BitPerPixel, int *width, int *height,\r
+                                          int *linesize, void **buffer);\r
+\r
+int __stdcall RdosCreateSprite(int DestHandle, int BitmapHandle, int MaskHandle, int lgop); \r
+void __stdcall RdosCloseSprite(int handle);\r
+void __stdcall RdosShowSprite(int handle);\r
+void __stdcall RdosHideSprite(int handle);\r
+void __stdcall RdosMoveSprite(int handle, int x, int y);\r
+\r
+void __stdcall RdosSetForeColor(int color);\r
+void __stdcall RdosSetBackColor(int color);\r
+int __stdcall RdosGetMemSize(void *ptr);\r
+void *__stdcall RdosAllocateMem(int Size);\r
+void __stdcall RdosFreeMem(void *ptr);\r
+int __stdcall RdosAppDebug();\r
+\r
+int __stdcall RdosOpenCom(int ID, long BaudRate, char Parity, char DataBits, char StopBits, int SendBufSize, int RecBufSize); \r
+void __stdcall RdosCloseCom(int Handle);\r
+void __stdcall RdosFlushCom(int Handle);\r
+char __stdcall RdosReadCom(int Handle);\r
+int __stdcall RdosWriteCom(int Handle, char Val);\r
+void __stdcall RdosEnableCts(int Handle);\r
+void __stdcall RdosDisableCts(int Handle);\r
+void __stdcall RdosEnableAutoRts(int Handle);\r
+void __stdcall RdosDisableAutoRts(int Handle);\r
+void __stdcall RdosSetDtr(int Handle);\r
+void __stdcall RdosResetDtr(int Handle);\r
+void __stdcall RdosSetRts(int Handle);\r
+void __stdcall RdosResetRts(int Handle);\r
+int __stdcall RdosGetReceiveBufferSpace(int Handle);\r
+int __stdcall RdosGetSendBufferSpace(int Handle);\r
+void __stdcall RdosWaitForSendCompletedCom(int Handle);\r
+\r
+int __stdcall RdosOpenFile(const char *FileName, char Access);\r
+int __stdcall RdosCreateFile(const char *FileName, int Attrib);\r
+void __stdcall RdosCloseFile(int Handle);\r
+int __stdcall RdosIsDevice(int Handle);\r
+int __stdcall RdosDuplFile(int Handle);\r
+long __stdcall RdosGetFileSize(int Handle);\r
+void __stdcall RdosSetFileSize(int Handle, long Size);\r
+long __stdcall RdosGetFilePos(int Handle);\r
+void __stdcall RdosSetFilePos(int Handle, long Pos);\r
+int __stdcall RdosReadFile(int Handle, void *Buf, int Size);\r
+int __stdcall RdosWriteFile(int Handle, const void *Buf, int Size);\r
+void __stdcall RdosGetFileTime(int Handle, unsigned long *MsbTime, unsigned long *LsbTime);\r
+void __stdcall RdosSetFileTime(int Handle, unsigned long MsbTime, unsigned long LsbTime);\r
+\r
+int __stdcall RdosCreateMapping(int Size);\r
+int __stdcall RdosCreateNamedMapping(const char *Name, int Size); \r
+int __stdcall RdosCreateNamedFileMapping(const char *Name, int Size, int FileHandle);\r
+int __stdcall RdosOpenNamedMapping(const char *Name);\r
+void __stdcall RdosSyncMapping(int Handle);\r
+void __stdcall RdosCloseMapping(int Handle);\r
+void __stdcall RdosMapView(int Handle, int Offset, void *Base, int Size);\r
+void __stdcall RdosUnmapView(int Handle);\r
+\r
+int __stdcall RdosSetCurDrive(int Drive);\r
+int __stdcall RdosGetCurDrive();\r
+int __stdcall RdosSetCurDir(const char *PathName);\r
+int __stdcall RdosGetCurDir(int Drive, char *PathName);\r
+int __stdcall RdosMakeDir(const char *PathName);\r
+int __stdcall RdosRemoveDir(const char *PathName);\r
+int __stdcall RdosRenameFile(const char *ToName, const char *FromName);\r
+int __stdcall RdosDeleteFile(const char *PathName);\r
+int __stdcall RdosGetFileAttribute(const char *PathName, int *Attribute);\r
+int __stdcall RdosSetFileAttribute(const char *PathName, int Attribute);\r
+int __stdcall RdosOpenDir(const char *PathName);\r
+void __stdcall RdosCloseDir(int Handle);\r
+int __stdcall RdosReadDir(int Handle, int EntryNr, int MaxNameSize, char *PathName, long *FileSize, int *Attribute, unsigned long *MsbTime, unsigned long *LsbTime);\r
+\r
+int __stdcall RdosGetThreadState(int ThreadNr, ThreadState *State);\r
+int __stdcall RdosSuspendThread(int ThreadNr);\r
+\r
+void __stdcall RdosCpuReset();\r
+void __stdcall RdosGetVersion(int *Major, int *Minor, int *Release);\r
+void __stdcall RdosCreateThread(void (*Start)(void *Param), const char *Name, void *Param, int StackSize);\r
+void __stdcall RdosTerminateThread();\r
+int __stdcall RdosGetThreadHandle();\r
+int __stdcall RdosExec(const char *prog, const char *param);\r
+int __stdcall RdosSpawn(const char *prog, const char *param, const char *startdir);\r
+void __stdcall RdosWaitMilli(int ms);\r
+void __stdcall RdosGetTics(unsigned long *msb, unsigned long *lsb);\r
+void __stdcall RdosTicsToRecord(unsigned long msb, unsigned long lsb, int *year, int *month, int *day, int *hour, int *min, int *sec, int *milli);\r
+void __stdcall RdosRecordToTics(unsigned long *msb, unsigned long *lsb, int year, int month, int day, int hour, int min, int sec, int milli);\r
+int __stdcall RdosDayOfWeek(int year, int month, int day);\r
+void __stdcall RdosGetSysTime(int *year, int *month, int *day, int *hour, int *min, int *sec, int *milli);\r
+void __stdcall RdosGetTime(int *year, int *month, int *day, int *hour, int *min, int *sec, int *milli);\r
+void __stdcall RdosSetTime(int year, int month, int day, int hour, int min, int sec, int milli);\r
+void __stdcall RdosAddTics(unsigned long *msb, unsigned long *lsb, long tics);\r
+void __stdcall RdosAddMilli(unsigned long *msb, unsigned long *lsb, long ms);\r
+void __stdcall RdosAddSec(unsigned long *msb, unsigned long *lsb, long sec);\r
+void __stdcall RdosAddMin(unsigned long *msb, unsigned long *lsb, long min);\r
+void __stdcall RdosAddHour(unsigned long *msb, unsigned long *lsb, long hour);\r
+void __stdcall RdosAddDay(unsigned long *msb, unsigned long *lsb, long day);\r
+int __stdcall RdosSyncTime(long IP);\r
+\r
+void __stdcall RdosDecodeMsbTics(unsigned long msb, int *days, int *hours);\r
+void __stdcall RdosDecodeLsbTics(unsigned long lsb, int *min, int *sec, int *milli, int *micro); \r
+\r
+int __stdcall RdosCreateSection();\r
+void __stdcall RdosDeleteSection(int Handle);\r
+void __stdcall RdosEnterSection(int Handle);\r
+void __stdcall RdosLeaveSection(int Handle);\r
+\r
+int __stdcall RdosCreateWait();\r
+void __stdcall RdosCloseWait(int Handle);\r
+void * __stdcall RdosCheckWait(int Handle);\r
+void * __stdcall RdosWaitForever(int Handle);\r
+void * __stdcall RdosWaitTimeout(int Handle, int MillSec);\r
+void __stdcall RdosStopWait(int Handle);\r
+void __stdcall RdosRemoveWait(int Handle, void *ID);\r
+void __stdcall RdosAddWaitForKeyboard(int Handle, void *ID);\r
+void __stdcall RdosAddWaitForMouse(int Handle, void *ID);\r
+void __stdcall RdosAddWaitForCom(int Handle, int ComHandle, void *ID);\r
+void __stdcall RdosAddWaitForAdc(int Handle, int AdcHandle, void *ID);\r
+\r
+int __stdcall RdosCreateSignal();\r
+void __stdcall RdosResetSignal(int Handle);\r
+int __stdcall RdosIsSignalled(int Handle);\r
+void __stdcall RdosSetSignal(int Handle);\r
+void __stdcall RdosFreeSignal(int Handle);\r
+void __stdcall RdosAddWaitForSignal(int Handle, int SignalHandle, void *ID);\r
+\r
+long __stdcall RdosGetIp();\r
+int __stdcall RdosNameToIp(const char *HostName);\r
+int __stdcall RdosIpToName(int Ip, char *HostName, int MaxSize);\r
+\r
+int __stdcall RdosCreateTcpListen(int Port, int MaxConnections, int BufferSize);\r
+int __stdcall RdosGetTcpListen(int Handle);\r
+void __stdcall RdosCloseTcpListen(int Handle);\r
+void __stdcall RdosAddWaitForTcpListen(int Handle, int ConHandle, void *ID);\r
+\r
+int __stdcall RdosOpenTcpConnection(int RemoteIp, int LocalPort, int RemotePort, int Timeout, int BufferSize);\r
+int __stdcall RdosWaitForTcpConnection(int Handle, long Timeout);\r
+void __stdcall RdosAddWaitForTcpConnection(int Handle, int ConHandle, void *ID);\r
+void __stdcall RdosCloseTcpConnection(int Handle);\r
+void __stdcall RdosDeleteTcpConnection(int Handle);\r
+void __stdcall RdosAbortTcpConnection(int Handle);\r
+void __stdcall RdosPushTcpConnection(int Handle);\r
+int __stdcall RdosIsTcpConnectionClosed(int Handle);\r
+long __stdcall RdosGetRemoteTcpConnectionIP(int Handle);\r
+int __stdcall RdosGetRemoteTcpConnectionPort(int Handle);\r
+int __stdcall RdosGetLocalTcpConnectionPort(int Handle);\r
+int __stdcall RdosReadTcpConnection(int Handle, void *Buf, int Size);\r
+int __stdcall RdosWriteTcpConnection(int Handle, const void *Buf, int Size);\r
+int __stdcall RdosPollTcpConnection(int Handle);\r
+\r
+int __stdcall RdosGetLocalMailslot(const char *Name);\r
+int __stdcall RdosGetRemoteMailslot(long Ip, const char *Name);\r
+void __stdcall RdosFreeMailslot(int Handle);\r
+int __stdcall RdosSendMailslot(int Handle, const void *Msg, int Size, void *ReplyBuf, int MaxReplySize);\r
+\r
+void __stdcall RdosDefineMailslot(const char *Name, int MaxSize);\r
+int __stdcall RdosReceiveMailslot(void *Msg);\r
+void __stdcall RdosReplyMailslot(const void *Msg, int Size);\r
+\r
+void __stdcall RdosSetFocus(char FocusKey);\r
+char __stdcall RdosGetFocus();\r
+\r
+void __stdcall RdosClearKeyboard();\r
+int __stdcall RdosPollKeyboard();\r
+int __stdcall RdosReadKeyboard();\r
+int __stdcall RdosGetKeyboardState();\r
+int __stdcall RdosPutKeyboard(int KeyCode, int VirtualKey, int ScanCode);\r
+int __stdcall RdosPeekKeyEvent(int *ExtKey, int *KeyState, int *VirtualKey, int *ScanCode);\r
+int __stdcall RdosReadKeyEvent(int *ExtKey, int *KeyState, int *VirtualKey, int *ScanCode);\r
+\r
+void __stdcall RdosHideMouse();\r
+void __stdcall RdosShowMouse();\r
+void __stdcall RdosGetMousePosition(int *x, int *y);\r
+void __stdcall RdosSetMousePosition(int x, int y);\r
+void __stdcall RdosSetMouseWindow(int StartX, int StartY, int EndX, int EndY);\r
+void __stdcall RdosSetMouseMickey(int x, int y);\r
+int __stdcall RdosGetLeftButton();\r
+int __stdcall RdosGetRightButton();\r
+void __stdcall RdosGetLeftButtonPressPosition(int *x, int *y);\r
+void __stdcall RdosGetRightButtonPressPosition(int *x, int *y);\r
+void __stdcall RdosGetLeftButtonReleasePosition(int *x, int *y);\r
+void __stdcall RdosGetRightButtonReleasePosition(int *x, int *y);\r
+\r
+void __stdcall RdosGetCursorPosition(int *Row, int *Col);\r
+void __stdcall RdosSetCursorPosition(int Row, int Col);\r
+void __stdcall RdosWriteChar(char ch);\r
+void __stdcall RdosWriteSizeString(const char *Buf, int Size);\r
+void __stdcall RdosWriteString(const char *Buf);\r
+int __stdcall RdosReadLine(char *Buf, int MaxSize);\r
+\r
+int __stdcall RdosPing(long Node, long Timeout);\r
+\r
+int __stdcall RdosGetIdeDisc(int UnitNr);\r
+int __stdcall RdosGetFloppyDisc(int UnitNr);\r
+\r
+int __stdcall RdosSetDiscInfo(int DiscNr, int SectorSize, long Sectors, int BiosSectorsPerCyl, int BiosHeads);\r
+int __stdcall RdosGetDiscInfo(int DiscNr, int *SectorSize, long *Sectors, int *BiosSectorsPerCyl, int *BiosHeads);\r
+int __stdcall RdosReadDisc(int DiscNr, long Sector, char *Buf, int Size);\r
+int __stdcall RdosWriteDisc(int DiscNr, long Sector, const char *Buf, int Size);\r
+\r
+void __stdcall RdosGetRdfsInfo(void *CryptTab, void *KeyTab, void *ExtentSizeTab);\r
+void __stdcall RdosDemandLoadDrive(int DriveNr);\r
+int __stdcall RdosFormatDrive(int DiscNr, long StartSector, int Size, const char *FsName);\r
+\r
+int __stdcall RdosAllocateFixedDrive(int DriveNr);\r
+int __stdcall RdosAllocateStaticDrive();\r
+int __stdcall RdosAllocateDynamicDrive();\r
+\r
+int __stdcall RdosGetDriveInfo(int DriveNr, long *FreeUnits, int *BytesPerUnit, long *TotalUnits);\r
+int __stdcall RdosGetDriveDiscParam(int DriveNr, int *DiscNr, long *StartSector, long *TotalSectors);\r
+\r
+int __stdcall RdosCreateFileDrive(int Drive, long Size, const char *FsName, const char *FileName);\r
+int __stdcall RdosOpenFileDrive(int Drive, const char *FileName);\r
+\r
+int __stdcall RdosGetModuleHandle();\r
+const char * __stdcall RdosGetExeName();\r
+int __stdcall RdosLoadDll(const char *Name);\r
+void __stdcall RdosFreeDll(int handle);\r
+int __stdcall RdosReadResource(int handle, int ID, char *Buf, int Size);\r
+int __stdcall RdosReadBinaryResource(int handle, int ID, char *Buf, int Size);\r
+\r
+int __stdcall RdosOpenAdc(int channel);\r
+void __stdcall RdosCloseAdc(int handle);\r
+void __stdcall RdosDefineAdcTime(int handle, unsigned long msg, unsigned long lsb);\r
+long __stdcall RdosReadAdc(int handle);\r
+\r
+int __stdcall RdosReadSerialLines(int device, int *val);\r
+int __stdcall RdosToggleSerialLine(int device, int line);\r
+int __stdcall RdosReadSerialVal(int device, int line, int *val);\r
+int __stdcall RdosWriteSerialVal(int device, int line, int val);\r
+int __stdcall RdosReadSerialRaw(int device, int line, int *val);\r
+int __stdcall RdosWriteSerialRaw(int device, int line, int val);\r
+\r
+int __stdcall RdosOpenSysEnv();\r
+int __stdcall RdosOpenProcessEnv();\r
+void __stdcall RdosCloseEnv(int handle);\r
+void __stdcall RdosAddEnvVar(int handle, const char *var, const char *value);\r
+void __stdcall RdosDeleteEnvVar(int handle, const char *var);\r
+int __stdcall RdosFindEnvVar(int handle, const char *var, char *value);\r
+void __stdcall RdosGetEnvData(int handle, char *buf);\r
+void __stdcall RdosSetEnvData(int handle, const char *buf);\r
+\r
+int __stdcall RdosOpenSysIni();\r
+void __stdcall RdosCloseIni(int handle);\r
+int __stdcall RdosGotoIniSection(int handle, const char *name);\r
+int __stdcall RdosRemoveIniSection(int handle);\r
+int __stdcall RdosReadIni(int handle, const char *var, char *str, int maxsize);\r
+int __stdcall RdosWriteIni(int handle, const char *var, const char *str);\r
+int __stdcall RdosDeleteIni(int handle, const char *var);\r
+\r
+void __stdcall RdosEnableStatusLED();\r
+void __stdcall RdosDisableStatusLED();\r
+\r
+void __stdcall RdosStartWatchdog(int timeout);\r
+void __stdcall RdosKickWatchdog();\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif\r
+\r
+\r
+\r
diff --git a/newlib/libc/sys/rdos/rdoshelp.c b/newlib/libc/sys/rdos/rdoshelp.c
new file mode 100644 (file)
index 0000000..20d2535
--- /dev/null
@@ -0,0 +1,162 @@
+/*#######################################################################
+# RDOS operating system
+# Copyright (C) 1988-2006, Leif Ekblad
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+#
+# The author of this program may be contacted at leif@rdos.net
+#
+# rdoshelp.c                                                                
+# implementation of various structures and helpers
+#
+##########################################################################*/
+
+#include <reent.h>
+#include <rdos.h>
+#include <stdio.h>
+
+char *__env[1] = { 0 }; 
+char **environ = __env; 
+
+static int once_section;
+static int key_section;
+
+/*##########################################################################
+#
+#   Name       : _get_impure_data_size
+#
+#   Purpose....: Get size of _reent structure
+#
+#   In params..: *
+#   Out params.: *
+#   Returns....: size
+#
+##########################################################################*/
+int get_impure_data_size()
+{
+       return sizeof(struct _reent);
+}
+
+/*##########################################################################
+#
+#   Name       : __rdos_thread_once
+#
+#   Purpose....: Emulate GCC pthread_once
+#
+#   In params..: Handle initially 0
+#              : function to initially call
+#   Out params.: *
+#   Returns....: result
+#
+##########################################################################*/
+int __rdos_thread_once (int *handle, void (*func) (void))
+{
+    if (handle == 0 || func == 0)
+        return 0;
+         
+    RdosEnterSection(once_section);
+    if (*handle == 0)
+        (*func)();
+    else
+        *handle = 1;
+    RdosLeaveSection(once_section);
+    return 0;
+}
+
+/*##########################################################################
+#
+#   Name       : __rdos_thread_mutex_init
+#
+#   Purpose....: Emulate GCC pthread_thread_mutex_init
+#
+#   In params..: *
+#   Out params.: *
+#   Returns....: handle
+#
+##########################################################################*/
+int __rdos_thread_mutex_init (void)
+{
+    return RdosCreateSection();
+}
+
+/*##########################################################################
+#
+#   Name       : __rdos_thread_mutex_lock
+#
+#   Purpose....: Emulate GCC pthread_thread_mutex_lock
+#
+#   In params..: handle
+#   Out params.: *
+#   Returns....: *
+#
+##########################################################################*/
+int __rdos_thread_mutex_lock (int handle)
+{
+    RdosEnterSection(handle);
+    return 0;
+}
+
+/*##########################################################################
+#
+#   Name       : __rdos_thread_mutex_trylock
+#
+#   Purpose....: Emulate GCC pthread_thread_mutex_trylock
+#                Try is not yet implemented, and lock is used.
+#
+#   In params..: handle
+#   Out params.: *
+#   Returns....: *
+#
+##########################################################################*/
+int __rdos_thread_mutex_trylock (int handle)
+{
+    RdosEnterSection(handle);
+    return 0;
+}
+
+/*##########################################################################
+#
+#   Name       : __rdos_thread_mutex_unlock
+#
+#   Purpose....: Emulate GCC pthread_thread_mutex_unlock
+#
+#   In params..: handle
+#   Out params.: *
+#   Returns....: *
+#
+##########################################################################*/
+int __rdos_thread_mutex_unlock (int handle)
+{
+    RdosLeaveSection(handle);
+    return 0;
+}
+
+/*##########################################################################
+#
+#   Name       : __init_rdos
+#
+#   Purpose....: Init RDOS specific data
+#
+#   In params..: reent structure
+#   Out params.: *
+#   Returns....: *
+#
+##########################################################################*/
+void __init_rdos(struct _reent *reent)
+{
+       once_section = RdosCreateSection();
+       _REENT_INIT_PTR(reent);
+       __sinit(reent);
+}
diff --git a/newlib/libc/sys/rdos/read.c b/newlib/libc/sys/rdos/read.c
new file mode 100644 (file)
index 0000000..e9f3464
--- /dev/null
@@ -0,0 +1,35 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# read.c                                                                \r
+# read function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+#include "rdos.h"\r
+\r
+int read(int file, char *ptr, int len)\r
+{\r
+    return RdosReadFile(file, ptr, len);\r
+}\r
diff --git a/newlib/libc/sys/rdos/readlink.c b/newlib/libc/sys/rdos/readlink.c
new file mode 100755 (executable)
index 0000000..ad4c69d
--- /dev/null
@@ -0,0 +1,11 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+#include <sys/types.h>\r
+\r
+int readlink(const char *path, char *buf, size_t bufsize)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/sbrk.c b/newlib/libc/sys/rdos/sbrk.c
new file mode 100644 (file)
index 0000000..fdcb5fb
--- /dev/null
@@ -0,0 +1,33 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# sbrk.c                                                                \r
+# sbrk function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_syslist.h>\r
+#include "rdos.h"\r
+\r
+void *sbrk (int incr)\r
+{ \r
+   return RdosAllocateMem(incr);\r
+} \r
diff --git a/newlib/libc/sys/rdos/stat.c b/newlib/libc/sys/rdos/stat.c
new file mode 100755 (executable)
index 0000000..f1683b6
--- /dev/null
@@ -0,0 +1,12 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include <errno.h>\r
+\r
+int stat(const char *file, struct stat *st)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/symlink.c b/newlib/libc/sys/rdos/symlink.c
new file mode 100755 (executable)
index 0000000..4d5fa1e
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int symlink(const char *path1, const char *path2)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/times.c b/newlib/libc/sys/rdos/times.c
new file mode 100644 (file)
index 0000000..47a540b
--- /dev/null
@@ -0,0 +1,11 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <sys/times.h>\r
+#include <errno.h>\r
+\r
+clock_t times(struct tms *buf)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/unlink.c b/newlib/libc/sys/rdos/unlink.c
new file mode 100644 (file)
index 0000000..d6c3736
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int unlink(char *name)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/user.def b/newlib/libc/sys/rdos/user.def
new file mode 100644 (file)
index 0000000..f5af306
--- /dev/null
@@ -0,0 +1,368 @@
+
+allocate_dos_mem_nr                    = 0
+allocate_local_mem_nr          = 1
+free_mem_nr                                    = 2
+available_local_linear_nr      = 3
+used_local_linear_nr           = 4
+available_vm_linear_nr         = 5
+used_vm_linear_nr                      = 6
+
+reserve_pe_mem_nr                      = 7
+set_flat_linear_valid_nr       = 8
+set_flat_linear_invalid_nr     = 9
+set_flat_linear_read_nr                = 10
+set_flat_linear_readwrite_nr = 11
+
+get_raw_switch_ads_nr          = 12
+raw_switch_nr                          = 13
+get_exception_nr                       = 14
+set_exception_nr                       = 15
+get_pm_int_nr                          = 16
+set_pm_int_nr                          = 17
+get_vm_int_nr                          = 18
+set_vm_int_nr                          = 19
+dpmi_int_nr                                    = 20
+dpmi_call_int_nr                       = 21
+dpmi_call_nr                           = 22
+allocate_vm_callback_nr                = 23
+free_vm_callback_nr                    = 24
+
+wait_milli_nr                          = 25
+wait_micro_nr                          = 26
+wait_until_nr                          = 27
+create_thread_nr                       = 28
+terminate_thread_nr                    = 29
+get_thread_nr                          = 30
+swap_nr                                                = 31
+
+create_user_section_nr         = 32
+create_blocked_user_section_nr = 33
+delete_user_section_nr         = 34
+enter_user_section_nr          = 35
+leave_user_section_nr          = 36
+
+get_local_mailslot_nr          = 37
+get_remote_mailslot_nr         = 38
+free_mailslot_nr                       = 39
+send_mailslot_nr                       = 40
+define_mailslot_nr                     = 41
+receive_mailslot_nr                    = 42
+reply_mailslot_nr                      = 43
+
+load_exe_nr                                    = 44
+spawn_exe_nr                           = 45
+unload_exe_nr                          = 46
+get_exit_code_nr                       = 47
+get_exe_name_nr                                = 48
+get_cmd_line_nr                                = 49
+get_env_nr                                     = 50
+load_dll_nr                                    = 51
+free_dll_nr                                    = 52
+get_dll_proc_nr                                = 53
+get_dll_resource_nr                    = 54
+get_dll_name_nr                                = 55
+get_dll_nr                                     = 56
+allocate_app_mem_nr                    = 57
+free_app_mem_nr                                = 58
+get_psp_sel_nr                         = 59
+
+get_debug_tss_nr                       = 60
+get_debug_thread_nr                    = 61
+debug_trace_nr                         = 62
+debug_pace_nr                          = 63
+debug_go_nr                                    = 64
+debug_next_nr                          = 65
+
+wait_for_pe_debug_nr           = 68
+continue_pe_debug_nr           = 69
+notify_pe_exception_nr         = 70
+read_thread_mem_nr                     = 71
+write_thread_mem_nr                    = 72
+get_thread_tss_nr                      = 73
+set_thread_tss_nr                      = 74
+
+get_cpu_time_nr                                = 75
+get_system_time_nr                     = 76
+get_time_nr                                    = 77
+time_to_system_time_nr         = 78
+system_time_to_time_nr         = 79
+days_in_month_nr                       = 80
+adjust_time_nr                         = 81
+passed_days_nr                         = 82
+time_to_binary_nr                      = 83
+binary_to_time_nr                      = 84
+sync_time_nr                           = 85
+
+set_focus_nr                           = 86
+enable_focus_nr                                = 87
+
+get_dns_nr                                     = 88
+get_ppp_dns_nr                         = 89
+open_tcp_connection_nr         = 90
+wait_for_tcp_connection_nr     = 92
+close_tcp_connection_nr                = 93
+delete_tcp_connection_nr       = 94
+is_tcp_connection_closed_nr    = 95
+abort_tcp_connection_nr                = 96
+read_tcp_connection_nr         = 97
+write_tcp_connection_nr                = 98
+push_tcp_connection_nr         = 99
+get_ip_address_nr                      = 100
+name_to_ip_nr                          = 101
+ip_to_name_nr                          = 102
+ping_nr                                                = 103 
+
+get_disc_info_nr                       = 104
+format_drive_nr                                = 105
+get_rdfs_info_nr                       = 106
+read_disc_nr                           = 107
+write_disc_nr                          = 108
+get_drive_info_nr                      = 109
+
+set_cur_drive_nr                       = 110
+get_cur_drive_nr                       = 111
+set_cur_dir_nr                         = 112
+get_cur_dir_nr                         = 113
+make_dir_nr                                    = 114
+remove_dir_nr                          = 115
+rename_file_nr                         = 116
+delete_file_nr                         = 117
+get_file_attribute_nr          = 118
+set_file_attribute_nr          = 119
+open_dir_nr                                    = 120
+close_dir_nr                           = 121
+read_dir_nr                                    = 122
+
+open_file_nr                           = 123
+create_file_nr                         = 124
+close_file_nr                          = 125
+dupl_file_nr                           = 126
+get_ioctl_data_nr                      = 127
+get_file_size_nr                       = 128
+set_file_size_nr                       = 129
+get_file_pos_nr                                = 130
+set_file_pos_nr                                = 131
+get_file_time_nr                       = 132
+set_file_time_nr                       = 133
+read_file_nr                           = 134
+write_file_nr                          = 135
+read_con_nr                                    = 136
+
+create_mapping_nr                      = 137
+create_named_mapping_nr                = 138
+create_file_mapping_nr         = 139
+create_named_file_mapping_nr = 140
+open_named_mapping_nr          = 141
+sync_mapping_nr                                = 142
+close_mapping_nr                       = 143
+map_view_nr                                    = 144
+unmap_view_nr                          = 145
+
+read_keyboard_nr                       = 146
+poll_keyboard_nr                       = 147
+flush_keyboard_nr                      = 148
+get_keyboard_state_nr          = 151
+
+show_mouse_nr                          = 152
+hide_mouse_nr                          = 153
+get_mouse_position_nr          = 154
+set_mouse_position_nr          = 155
+set_mouse_window_nr                    = 156
+set_mouse_mickey_nr                    = 157
+get_left_button_nr                     = 158
+get_right_button_nr                    = 159
+get_left_button_press_position_nr      = 160
+get_right_button_press_position_nr     = 161
+get_left_button_release_position_nr    = 162
+get_right_button_release_position_nr   = 163
+hook_mouse_nr                          = 164
+unhook_mouse_nr                                = 165
+
+lock_cd_nr                                     = 166
+unlock_cd_nr                           = 167
+eject_cd_nr                                    = 168
+insert_cd_nr                           = 169
+
+open_com_nr                                    = 170
+close_com_nr                           = 171
+flush_com_nr                           = 172
+add_wait_for_com_nr                    = 174
+read_com_nr                                    = 175
+write_com_nr                           = 176
+set_dtr_nr                                     = 177
+reset_dtr_nr                           = 178
+
+init_printer_nr                                = 179
+check_printer_nr                       = 180
+write_printer_nr                       = 181
+
+set_cursor_position_nr         = 182
+get_cursor_position_nr         = 183
+write_char_nr                          = 184
+write_asciiz_nr                                = 185
+write_size_string_nr           = 186
+
+set_video_mode_nr                      = 187
+set_vga_mode_nr                                = 188
+set_forecolor_nr                       = 189
+set_backcolor_nr                       = 190
+get_string_metrics_nr          = 193
+set_font_nr                                    = 194
+get_video_mode_nr           = 195
+draw_string_nr                         = 197
+
+xms_handler_nr                         = 198
+ems_handler_nr                         = 199
+
+test_nr                                                = 200
+
+resize_flat_linear_nr          = 201
+
+set_drawcolor_nr                       = 202
+set_lgop_nr                                    = 203
+set_hollow_style_nr                    = 204
+set_filled_style_nr                    = 205
+get_pixel_nr                           = 206
+set_pixel_nr                           = 207
+draw_line_nr                           = 208
+draw_rect_nr                           = 209
+draw_ellipse_nr                                = 210
+create_bitmap_nr                       = 211
+close_bitmap_nr                                = 212
+blit_nr                                                = 213
+open_font_nr                           = 215
+close_font_nr                          = 216
+create_string_bitmap_nr                = 217
+get_bitmap_info_nr                     = 218
+draw_mask_nr                           = 219
+
+create_sprite_nr            = 220
+close_sprite_nr             = 221
+show_sprite_nr              = 222
+hide_sprite_nr              = 223
+move_sprite_nr              = 224
+
+dup_bitmap_handle_nr        = 225
+set_clip_rect_nr            = 226
+clear_clip_rect_nr          = 227
+
+set_rts_nr                  = 228
+reset_rts_nr                = 229
+get_com_receive_space_nr    = 230
+get_com_send_space_nr       = 231
+
+get_char_attrib_nr                     = 232
+
+create_wait_nr              = 233
+close_wait_nr               = 234
+is_wait_idle_nr                                = 235
+wait_no_timeout_nr          = 236
+wait_timeout_nr                                = 237
+stop_wait_nr                = 238
+add_wait_for_keyboard_nr    = 239
+
+peek_key_event_nr           = 240
+read_key_event_nr           = 241
+
+add_wait_for_mouse_nr          = 242
+remove_wait_nr              = 243
+
+add_wait_for_adc_nr                    = 244
+open_adc_nr                                    = 245
+close_adc_nr                           = 246
+define_adc_time_nr                     = 247
+read_adc_nr                                    = 248
+
+free_v86_nr                 = 249
+
+read_serial_lines_nr           = 250
+toggle_serial_line_nr          = 251
+
+read_serial_val_nr                     = 252
+write_serial_val_nr                    = 253
+
+create_file_drive_nr        = 254
+open_file_drive_nr          = 255
+
+dos_ext_exec_nr                                = 256
+
+open_sys_env_nr             = 257
+open_proc_env_nr            = 258
+close_env_nr                = 259
+add_env_var_nr              = 260
+delete_env_var_nr           = 261
+find_env_var_nr             = 262
+get_env_data_nr            = 263
+set_env_data_nr                = 264
+
+open_sys_ini_nr                                = 265
+close_ini_nr                           = 266
+goto_ini_section_nr         = 267
+remove_ini_section_nr       = 268
+read_ini_nr                 = 269
+write_ini_nr                = 270
+delete_ini_nr               = 271
+
+app_debug_nr                           = 272
+get_version_nr              = 273
+
+enable_status_led_nr        = 274
+disable_status_led_nr       = 275
+
+start_watchdog_nr           = 276
+kick_watchdog_nr            = 277
+
+erase_disc_sectors_nr       = 278
+
+cpu_reset_nr                = 279
+
+enable_cts_nr               = 280
+disable_cts_nr              = 281
+
+wait_for_send_completed_com_nr  = 282
+
+add_wait_for_tcp_connection_nr  = 283
+
+get_remote_tcp_connection_ip_nr        = 284
+get_remote_tcp_connection_port_nr      = 285
+get_local_tcp_connection_port_nr       = 286
+
+enable_auto_rts_nr          = 287
+disable_auto_rts_nr         = 288
+
+put_keyboard_code_nr        = 289
+
+poll_tcp_connection_nr         = 290
+
+create_signal_nr            = 291
+free_signal_nr              = 292
+add_wait_for_signal_nr      = 293
+set_signal_nr               = 294
+reset_signal_nr             = 295
+is_signalled_nr             = 296
+
+get_drive_disc_param_nr     = 297
+
+get_ide_disc_nr             = 298
+get_floppy_disc_nr          = 299
+demand_load_drive_nr        = 300
+set_disc_info_nr            = 301
+
+get_thread_state_nr                    = 302
+suspend_thread_nr              = 303
+resume_thread_nr               = 304
+
+update_time_nr                         = 305
+
+allocate_static_drive_nr       = 306
+allocate_fixed_drive_nr                = 307
+allocate_dynamic_drive_nr      = 308
+
+get_focus_nr                = 309
+
+add_wait_for_tcp_listen_nr  = 310
+create_tcp_listen_nr        = 311
+get_tcp_listen_nr           = 312
+close_tcp_listen_nr         = 313
+
+usergate_entries                       = 340
diff --git a/newlib/libc/sys/rdos/wait.c b/newlib/libc/sys/rdos/wait.c
new file mode 100644 (file)
index 0000000..a7bc8aa
--- /dev/null
@@ -0,0 +1,10 @@
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+\r
+int wait(int *status)\r
+{\r
+  errno = ENOSYS;\r
+  return -1;\r
+}\r
diff --git a/newlib/libc/sys/rdos/write.c b/newlib/libc/sys/rdos/write.c
new file mode 100644 (file)
index 0000000..d02faec
--- /dev/null
@@ -0,0 +1,35 @@
+/*#######################################################################\r
+# RDOS operating system\r
+# Copyright (C) 1988-2006, Leif Ekblad\r
+#\r
+# This library is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU Lesser General Public License as published\r
+# by the Free Software Foundation; either version 2.1 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+#\r
+# The author of this program may be contacted at leif@rdos.net\r
+#\r
+# write.c                                                                \r
+# write function implementation\r
+#\r
+##########################################################################*/\r
+\r
+#include "config.h"\r
+#include <_ansi.h>\r
+#include <_syslist.h>\r
+#include <errno.h>\r
+#include "rdos.h"\r
+\r
+int write(int file, char *ptr, int len)\r
+{\r
+    return RdosWriteFile(file, ptr, len);\r
+}\r