Explorar el Código

* first rtl version for netwlibc

armin hace 21 años
padre
commit
4add7ccbc6

+ 1465 - 0
rtl/netwlibc/Makefile

@@ -0,0 +1,1465 @@
+#
+# Don't edit, this file is generated by FPCMake Version 1.1 [2004/09/05]
+#
+default: all
+MAKEFILETARGETS=netwlibc
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) sunos qnx
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override OS_TARGET_DEFAULT=netwlibc
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPC:=$(shell $(FPCPROG) -PB)
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=ppc386
+endif
+else
+override FPC=ppc386
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+ifndef FPC_VERSION
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifneq ($(words $(FPC_COMPILERINFO)),5)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(OS_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(OS_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSDIR
+CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET)
+endif
+ifndef CROSSTARGETDIR
+CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET)
+endif
+ifdef CROSSCOMPILE
+UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units)
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+else
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+override PACKAGE_NAME=rtl
+RTL=..
+INC=$(RTL)/inc
+PROCINC=$(RTL)/$(CPU_TARGET)
+UNITPREFIX=rtl
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+SYSTEMUNIT=system
+else
+SYSTEMUNIT=sysnetwa
+endif
+override FPCOPT+=-Ur
+override FPCOPT+=-dMT -dDEBUG_MT
+CREATESMART=0
+OBJPASDIR=$(RTL)/objpas
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings lineinfo winsock heaptrc matrix nwsnut libc dos crt objects sysconst dynlibs initc sysutils types typinfo systhrds classes cpu mmx getopts dateutils strutils convutils charset ucomplex variants rtlconst math varutils utf8bidi mouse
+override TARGET_LOADERS+=nwplibc
+override TARGET_RSTS+=math varutils variants convutils typinfo systhrds classes dateutils sysconst rtlconst
+override INSTALL_FPCPACKAGE=y
+override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
+override COMPILER_SOURCEDIR+=$(INC) $(PROCINC)
+override COMPILER_TARGETDIR+=.
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+ifdef CROSSCOMPILE
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+endif
+else
+ifdef CROSSCOMPILE
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET)
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+ifdef CROSSCOMPILE
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units
+else
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET)
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+STATICLIBPREFIX=libp
+RSTEXT=.rst
+FPCMADE=fpcmade
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+FPCMADE=fpcmade.v1
+PACKAGESUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+FPCMADE=fpcmade.dos
+ZIPSUFFIX=go32
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+FPCMADE=fpcmade.wat
+ZIPSUFFIX=watc
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.lnx
+ZIPSUFFIX=linux
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.freebsd
+ZIPSUFFIX=freebsd
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.netbsd
+ZIPSUFFIX=netbsd
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.openbsd
+ZIPSUFFIX=openbsd
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.w32
+ZIPSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.os2
+ZIPSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.emx
+ZIPSUFFIX=emx
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+FPCMADE=fpcmade.amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+FPCMADE=fpcmade.mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+FPCMADE=fpcmade.ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+FPCMADE=fpcmade.be
+ZIPSUFFIX=be
+endif
+ifeq ($(OS_TARGET),sunos)
+BATCHEXT=.sh
+EXEEXT=
+FPCMADE=fpcmade.sun
+ZIPSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+FPCMADE=fpcmade.qnx
+ZIPSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+FPCMADE=fpcmade.nw
+ZIPSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+FPCMADE=fpcmade.nwl
+ZIPSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+FPCMADE=fpcmade.macos
+ZIPSUFFIX=macos
+DEBUGSYMEXT=.xcoff
+endif
+ifeq ($(OS_TARGET),darwin)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.darwin
+ZIPSUFFIX=darwin
+endif
+else
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+STATICLIBPREFIX=
+FPCMADE=fpcmade.v1
+PACKAGESUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+FPCMADE=fpcmade.dos
+ZIPSUFFIX=go32
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+FPCMADE=fpcmade.dos
+ZIPSUFFIX=watcom
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.lnx
+ZIPSUFFIX=linux
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.freebsd
+ZIPSUFFIX=freebsd
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.netbsd
+ZIPSUFFIX=netbsd
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.openbsd
+ZIPSUFFIX=openbsd
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.w32
+ZIPSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.sl2
+STATICLIBPREFIX=
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.os2
+ZIPSUFFIX=emx
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+PPUEXT=.ppu
+ASMEXT=.asm
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.library
+FPCMADE=fpcmade.amg
+endif
+ifeq ($(OS_TARGET),atari)
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=.ttp
+FPCMADE=fpcmade.ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+FPCMADE=fpcmade.be
+ZIPSUFFIX=be
+endif
+ifeq ($(OS_TARGET),sunos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+FPCMADE=fpcmade.sun
+ZIPSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+FPCMADE=fpcmade.qnx
+ZIPSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+FPCMADE=fpcmade.nw
+ZIPSUFFIX=nw
+EXEEXT=.nlm
+endif
+ifeq ($(OS_TARGET),netwlibc)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+FPCMADE=fpcmade.nwl
+ZIPSUFFIX=nwl
+EXEEXT=.nlm
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+FPCMADE=fpcmade.macos
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command__
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command__
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command__
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command__
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command__
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command__
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -rfp
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command__
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command__
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command__
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command__
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),win32)
+ifeq ($(CROSSBINDIR),)
+ASNAME=asw
+LDNAME=ldw
+ARNAME=arw
+endif
+endif
+endif
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vI
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(CPU_TARGET)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+else
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1
+else
+FPCCPUOPT:=
+endif
+endif
+override FPCOPT+=-Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-OG2p3
+endif
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifeq ($(OS_TARGET),linux)
+ifeq ($(FPC_VERSION),1.0.6)
+override FPCOPTDEF+=HASUNIX
+endif
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+EXECPPAS:=@$(PPAS)
+endif
+endif
+.PHONY: fpc_loaders
+ifneq ($(TARGET_LOADERS),)
+override ALLTARGET+=fpc_loaders
+override CLEANTARGET+=fpc_loaders_clean
+override INSTALLTARGET+=fpc_loaders_install
+override LOADEROFILES:=$(addsuffix $(OEXT),$(TARGET_LOADERS))
+endif
+%$(OEXT): %$(LOADEREXT)
+	$(AS) -o $*$(OEXT) $<
+fpc_loaders: $(LOADEROFILES)
+fpc_loaders_clean:
+	-$(DEL) $(LOADEROFILES)
+fpc_loaders_install:
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(LOADEROFILES) $(INSTALL_UNITDIR)
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) 
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_distclean: clean
+ifdef COMPILER_UNITTARGETDIR
+TARGETDIRCLEAN=fpc_clean
+endif
+fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+examples:
+shared:
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall:
+zipinstall:
+zipsourceinstall:
+zipexampleinstall:
+zipdistinstall:
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+SYSTEMPPU=$(addsuffix $(PPUEXT),$(SYSTEMUNIT))
+include $(INC)/makefile.inc
+SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
+include $(PROCINC)/makefile.cpu
+SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
+SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
+nwplibc$(OEXT) :
+	cp pre/libcpre.gcc.o nwplibc.o
+$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp libc.pp $(SYSDEPS)
+	$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
+objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
+strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
+		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
+		   $(SYSTEMUNIT)$(PPUEXT)
+systhrds$(PPUEXT): systhrds.pp $(INC)/threadh.inc $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT)
+netware$(PPUEXT) : netware.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) -I$(WININC) netware.pp
+winsock2$(PPUEXT) : winsock2.pp qos.inc netware$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+sockets$(PPUEXT) : sockets.pp netware$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+		   $(INC)/sockets.inc $(INC)/socketsh.inc
+dynlibs$(PPUEXT) : $(INC)/dynlibs.pp libc$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+initc$(PPUEXT) : initc.pp libc$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+dos$(PPUEXT) : dos.pp libc.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+crt$(PPUEXT) : crt.pp libc.pp $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT) dos$(PPUEXT)
+objects$(PPUEXT) : $(INC)/objects.pp $(SYSTEMUNIT)$(PPUEXT)
+sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
+		    objpas$(PPUEXT) dos$(PPUEXT) libc.pp sysconst$(PPUEXT)
+	$(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
+classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
+		   sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconst$(PPUEXT) \
+		   sysconst$(PPUEXT) types$(PPUEXT) systhrds$(PPUEXT)
+	$(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
+typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
+	$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
+math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/math.pp
+gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/gettext.pp
+varutils$(PPUEXT) : varutils.pp $(OBJPASDIR)/cvarutil.inc \
+		    objpas$(PPUEXT) $(OBJPASDIR)/varutilh.inc
+	$(COMPILER) -I$(OBJPASDIR) varutils.pp
+utf8bidi$(PPUEXT) : $(OBJPASDIR)/utf8bidi.pp
+	$(COMPILER) $(OBJPASDIR)/utf8bidi.pp
+variants$(PPUEXT) : $(INC)/variants.pp varutils$(PPUEXT)
+types$(PPUEXT) : $(OBJPASDIR)/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/types.pp
+rtlconst$(PPUEXT) : $(OBJPASDIR)/rtlconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/rtlconst.pp
+sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/sysconst.pp
+dateutils$(PPUEXT) : $(OBJPASDIR)/dateutils.pp
+	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutils.pp
+convutils$(PPUEXT) : $(OBJPASDIR)/convutils.pp
+	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/convutils.pp
+strutils$(PPUEXT) : $(OBJPASDIR)/strutils.pp
+	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/strutils.pp
+macpas$(PPUEXT) : $(INC)/macpas.pp system$(PPUEXT)
+	$(COMPILER) $(INC)/macpas.pp $(REDIR)
+cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMUNIT)$(PPUEXT)
+mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
+heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) -Sg $(INC)/heaptrc.pp
+lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
+charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
+ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)
+aio$(PPUEXT) : aio.pp $(SYSTEMUNIT)$(PPUEXT)
+override INSTALLPPUFILES+=nwsnut.imp ws2_32.imp ws2nlm.imp libc.imp netware.imp \
+libcclib.imp nwplibc.o

+ 240 - 0
rtl/netwlibc/Makefile.fpc

@@ -0,0 +1,240 @@
+#
+#   Makefile.fpc for Free Pascal Netware RTL (Libc)
+#
+
+[package]
+main=rtl
+
+[target]
+loaders=nwplibc
+units=$(SYSTEMUNIT) objpas macpas strings \
+      lineinfo winsock heaptrc matrix \
+      nwsnut libc dos crt objects sysconst dynlibs \
+      initc sysutils types typinfo systhrds classes \
+      cpu mmx getopts \
+      dateutils strutils convutils \
+      charset ucomplex variants \
+      rtlconst math varutils utf8bidi \
+      mouse
+
+rsts=math varutils variants convutils typinfo systhrds classes dateutils sysconst rtlconst
+
+[require]
+nortl=y
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+target=netwlibc
+
+[compiler]
+includedir=$(INC) $(PROCINC)
+sourcedir=$(INC) $(PROCINC)
+targetdir=.
+
+
+[prerules]
+RTL=..
+INC=$(RTL)/inc
+PROCINC=$(RTL)/$(CPU_TARGET)
+
+UNITPREFIX=rtl
+
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+SYSTEMUNIT=system
+else
+SYSTEMUNIT=sysnetwa
+endif
+
+# Use new feature from 1.0.5 version
+# that generates release PPU files
+# which will not be recompiled
+# ifdef RELEASE
+override FPCOPT+=-Ur
+# endif
+
+#debug, -a: dont delete asm, -al include lines
+#override FPCOPT+=-a
+#override FPCOPT+=-al
+
+
+# for netware always use multithread
+override FPCOPT+=-dMT -dDEBUG_MT
+
+# and alway use smartlinking
+#CREATESMART=1
+CREATESMART=0
+
+# Paths
+OBJPASDIR=$(RTL)/objpas
+
+
+[rules]
+SYSTEMPPU=$(addsuffix $(PPUEXT),$(SYSTEMUNIT))
+
+# Get the system independent include file names.
+# This will set the following variables :
+# SYSINCNAMES
+include $(INC)/makefile.inc
+SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
+
+# Get the processor dependent include file names.
+# This will set the following variables :
+# CPUINCNAMES
+include $(PROCINC)/makefile.cpu
+SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
+
+# Put system unit dependencies together.
+SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
+
+
+#
+# Loaders
+#
+
+#nwpre$(OEXT) : nwpre.as
+#        $(AS) -o nwpre$(OEXT) nwpre.as
+
+#prelude$(OEXT) : prelude.as
+#        $(AS) -o prelude$(OEXT) prelude.as
+
+# for now use the gcc pre
+nwplibc$(OEXT) :
+        cp pre/libcpre.gcc.o nwplibc.o
+
+#
+# System Units (System, Objpas, Strings)
+#
+
+$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp libc.pp $(SYSDEPS)
+        $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
+
+objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
+
+strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
+                   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
+                   $(SYSTEMUNIT)$(PPUEXT)
+systhrds$(PPUEXT): systhrds.pp $(INC)/threadh.inc $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT)
+
+#
+# System Dependent Units
+#
+
+netware$(PPUEXT) : netware.pp $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) -I$(WININC) netware.pp
+
+
+winsock2$(PPUEXT) : winsock2.pp qos.inc netware$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+sockets$(PPUEXT) : sockets.pp netware$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+                   $(INC)/sockets.inc $(INC)/socketsh.inc
+
+dynlibs$(PPUEXT) : $(INC)/dynlibs.pp libc$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+initc$(PPUEXT) : initc.pp libc$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+
+#
+# TP7 Compatible RTL Units
+#
+
+dos$(PPUEXT) : dos.pp libc.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+crt$(PPUEXT) : crt.pp libc.pp $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT) dos$(PPUEXT)
+
+objects$(PPUEXT) : $(INC)/objects.pp $(SYSTEMUNIT)$(PPUEXT)
+
+#
+# Delphi Compatible Units
+#
+
+sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
+                    objpas$(PPUEXT) dos$(PPUEXT) libc.pp sysconst$(PPUEXT)
+        $(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
+
+classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
+                   sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconst$(PPUEXT) \
+                   sysconst$(PPUEXT) types$(PPUEXT) systhrds$(PPUEXT)
+        $(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
+
+typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
+        $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
+
+math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/math.pp
+
+gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/gettext.pp
+
+varutils$(PPUEXT) : varutils.pp $(OBJPASDIR)/cvarutil.inc \
+                    objpas$(PPUEXT) $(OBJPASDIR)/varutilh.inc
+        $(COMPILER) -I$(OBJPASDIR) varutils.pp
+
+utf8bidi$(PPUEXT) : $(OBJPASDIR)/utf8bidi.pp
+        $(COMPILER) $(OBJPASDIR)/utf8bidi.pp
+
+
+variants$(PPUEXT) : $(INC)/variants.pp varutils$(PPUEXT)
+
+types$(PPUEXT) : $(OBJPASDIR)/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/types.pp
+
+rtlconst$(PPUEXT) : $(OBJPASDIR)/rtlconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/rtlconst.pp
+
+sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/sysconst.pp
+
+dateutils$(PPUEXT) : $(OBJPASDIR)/dateutils.pp
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutils.pp
+
+convutils$(PPUEXT) : $(OBJPASDIR)/convutils.pp
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/convutils.pp
+
+strutils$(PPUEXT) : $(OBJPASDIR)/strutils.pp
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/strutils.pp
+
+#
+# Mac Pascal Model
+#
+
+macpas$(PPUEXT) : $(INC)/macpas.pp system$(PPUEXT)
+        $(COMPILER) $(INC)/macpas.pp $(REDIR)
+
+#
+# Other system-independent RTL Units
+#
+
+cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMUNIT)$(PPUEXT)
+
+mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
+
+heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) -Sg $(INC)/heaptrc.pp
+
+lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
+
+charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
+
+ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+
+
+#
+# Other system-dependent RTL Units
+#
+
+callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)
+
+aio$(PPUEXT) : aio.pp $(SYSTEMUNIT)$(PPUEXT)
+
+#
+# Netware-.imp files need to be installed in the unit-dir
+#
+override INSTALLPPUFILES+=nwsnut.imp ws2_32.imp ws2nlm.imp libc.imp netware.imp \
+libcclib.imp nwplibc.o
+

+ 48 - 0
rtl/netwlibc/classes.pp

@@ -0,0 +1,48 @@
+{
+    $Id$
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2004 by Michael Van Canneyt and Florian Klaempfl
+
+    Classes unit for netware libc
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+{$mode objfpc}
+
+{ determine the type of the resource/form file }
+{$define Win16Res}
+
+unit Classes;
+
+interface
+
+uses
+  sysutils,
+  types,
+  typinfo,
+  rtlconst,
+  systhrds,
+  Libc;
+
+
+{$i classesh.inc}
+
+implementation
+
+{ OS - independent class implementations are in /inc directory. }
+{$i classes.inc}
+
+end.
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 626 - 0
rtl/netwlibc/crt.pp

@@ -0,0 +1,626 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team.
+
+    Borland Pascal 7 Compatible CRT Unit for Netware (libc version)
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+unit crt;
+
+interface
+
+{$i crth.inc}
+
+Const
+  ScreenHeight : longint=25;
+  ScreenWidth  : longint=80;
+
+implementation
+
+uses Libc;
+
+
+{$ASMMODE ATT}
+
+var
+  ScreenHandle : scr_t;
+
+{ Definition of textrec is in textrec.inc }
+{$i textrec.inc}
+
+
+{****************************************************************************
+                           Low level Routines
+****************************************************************************}
+
+procedure setscreenmode(mode : byte);
+begin
+  setscreenmode (mode);
+end;
+
+
+function GetScreenHeight : longint;
+VAR Height, Width : WORD;
+begin
+  GetScreenSize(Height, Width);
+  GetScreenHeight := Height;
+end;
+
+
+function GetScreenWidth : longint;
+VAR Height, Width : WORD;
+begin
+  GetScreenSize(Height, Width);
+  GetScreenWidth := Width;
+end;
+
+procedure GetScreenCursor(var x,y : longint);
+begin
+  x := wherecol+1;
+  y := whererow+1;
+end;
+
+
+{****************************************************************************
+                              Helper Routines
+****************************************************************************}
+
+Function WinMinX: Longint;
+{
+  Current Minimum X coordinate
+}
+Begin
+  WinMinX:=(WindMin and $ff)+1;
+End;
+
+
+
+Function WinMinY: Longint;
+{
+  Current Minimum Y Coordinate
+}
+Begin
+  WinMinY:=(WindMin shr 8)+1;
+End;
+
+
+
+Function WinMaxX: Longint;
+{
+  Current Maximum X coordinate
+}
+Begin
+  WinMaxX:=(WindMax and $ff)+1;
+End;
+
+
+
+Function WinMaxY: Longint;
+{
+  Current Maximum Y coordinate;
+}
+Begin
+  WinMaxY:=(WindMax shr 8) + 1;
+End;
+
+
+Function FullWin:boolean;
+{
+  Full Screen 80x25? Window(1,1,80,25) is used, allows faster routines
+}
+begin
+  FullWin:=(WinMinX=1) and (WinMinY=1) and
+           (WinMaxX=ScreenWidth) and (WinMaxY=ScreenHeight);
+end;
+
+
+{****************************************************************************
+                             Public Crt Functions
+****************************************************************************}
+
+
+procedure textmode(mode : integer);
+begin
+  Window (1,1,byte(ScreenWidth),byte(ScreenHeight));
+  ClrScr;
+end;
+
+
+Procedure TextColor(Color: Byte);
+{
+  Switch foregroundcolor
+}
+Begin
+  TextAttr:=(Color and $f) or (TextAttr and $70);
+  If (Color>15) Then TextAttr:=TextAttr Or Blink;
+End;
+
+
+
+Procedure TextBackground(Color: Byte);
+{
+  Switch backgroundcolor
+}
+Begin
+  TextAttr:=((Color shl 4) and ($f0 and not Blink)) or (TextAttr and ($0f OR Blink) );
+End;
+
+
+
+Procedure HighVideo;
+{
+  Set highlighted output.
+}
+Begin
+  TextColor(TextAttr Or $08);
+End;
+
+
+
+Procedure LowVideo;
+{
+  Set normal output
+}
+Begin
+  TextColor(TextAttr And $77);
+End;
+
+
+
+Procedure NormVideo;
+{
+  Set normal back and foregroundcolors.
+}
+Begin
+  TextColor(7);
+  TextBackGround(0);
+End;
+
+
+Procedure GotoXy(X: Byte; Y: Byte);
+{
+  Go to coordinates X,Y in the current window.
+}
+Begin
+  If (X>0) and (X<=WinMaxX- WinMinX+1) and
+     (Y>0) and (Y<=WinMaxY-WinMinY+1) Then
+   Begin
+     X := X + WinMinX - 1;
+     Y := Y + WinMinY - 1;
+     gotorowcol (y-1,x-1);
+   End;
+End;
+
+
+Procedure Window(X1, Y1, X2, Y2: Byte);
+{
+  Set screen window to the specified coordinates.
+}
+Begin
+  if (X1>X2) or (X2>ScreenWidth) or
+     (Y1>Y2) or (Y2>ScreenHeight) then
+   exit;
+  WindMin:=((Y1-1) Shl 8)+(X1-1);
+  WindMax:=((Y2-1) Shl 8)+(X2-1);
+  GoToXY(1,1);
+End;
+
+
+Procedure ClrScr;
+{
+  Clear the current window, and set the cursor on 1,1
+}
+var
+  rowlen,rows: longint;
+begin
+  if FullWin then
+  begin
+    clearscreen;  {seems to swich cursor off}
+    //_DisplayInputCursor;
+  end else
+  begin
+    rowlen := WinMaxX-WinMinX+1;
+    rows   := WinMaxY-WinMinY+1;
+    FillScreenArea(ScreenHandle,WinMinY-1,WinMinX-1,rows,rowlen,' ',textattr);
+  end;
+  Gotoxy(1,1);
+end;
+
+
+Procedure ClrEol;
+{
+  Clear from current position to end of line.
+}
+var
+  x,y : longint;
+  rowlen : word;
+Begin
+  GetScreenCursor(x,y);
+  if x<WinMaxX then
+  begin
+    rowlen := WinMaxX-x+1;
+    FillScreenArea(ScreenHandle,y-1,x-1,1,rowlen,' ',textattr);
+  end;
+End;
+
+
+
+Function WhereX: Byte;
+{
+  Return current X-position of cursor.
+}
+Begin
+  WhereX:=wherecol-WinMinX+1;
+End;
+
+
+
+Function WhereY: Byte;
+{
+  Return current Y-position of cursor.
+}
+Begin
+  WhereY:=whererow-WinMinY+1;
+End;
+
+
+{*************************************************************************
+                            Keyboard
+*************************************************************************}
+
+var
+   is_last : boolean;
+
+{
+function readkey : char;
+var
+  keytype,modifier,scancode : longint;
+begin
+  if is_last then
+  begin
+     is_last:=false;
+     readkey:=getch;
+  end else
+  begin
+    // _SetCtrlCharCheckMode (CheckBreak);
+    WaitForKey (ScreenHandle);
+    getkey(keytype,modifer,scancode):longint;
+    char1 := getch;
+    if char1 = #0 then is_last := true;
+    readkey:=char1;
+  end;
+end;
+}
+
+function readkey : char;  // for now
+begin
+  readkey := char(getcharacter);
+end;
+
+
+function keypressed : boolean;
+begin
+  if is_last then
+  begin
+    keypressed:=true;
+    exit;
+  end else
+    keypressed := (kbhit <> 0);
+end;
+
+
+{*************************************************************************
+                                   Delay
+*************************************************************************}
+
+procedure Delay(MS: Word);
+begin
+  libc.delay (MS);
+end;
+
+procedure sound(hz : word);
+begin
+  RingBell;
+end;
+
+procedure nosound;
+begin
+end;
+
+
+
+{****************************************************************************
+                          HighLevel Crt Functions
+****************************************************************************}
+
+{procedure removeline(y : longint);
+var
+  fil : word;
+  rowlen : word;
+  p : pointer;
+begin
+  fil:=32 or (textattr shl 8);
+  rowlen:=WinMaxX-WinMinX+1;
+  GetMem (p, rowlen*2);
+  y:=WinMinY+y-1;
+  While (y<=WinMaxY) do
+   begin
+     _CopyFromScreenMemory (1,rowlen,p,WinMinX-1,word(y));
+     _CopyToScreenMemory (1,rowlen,p,WinMinX-1,word(y-1));
+     inc(y);
+   end;
+  FillWord (p^,rowlen,fil);
+  _CopyToScreenMemory (1,rowlen,p,WinMinX-1,WinMaxY-1);
+  FreeMem (p, rowlen*2);
+end;}
+procedure removeline(y : longint);
+var rowlen : longint;
+begin
+  rowlen:=WinMaxX-WinMinX+1;
+  y:=WinMinY+y-1-1;
+  ScrollScreenArea(ScreenHandle,y,WinMinX-1,WinMaxY-WinMinY+1,rowlen,1,0,SCROLL_UP);
+end;
+
+
+procedure delline;
+begin
+  removeline(wherey);
+end;
+
+
+procedure insline;
+var rowlen : longint;
+begin
+  rowlen:=WinMaxX-WinMinX+1;
+  ScrollScreenArea(ScreenHandle,wherecol,WinMinX-1,WinMaxY-WinMinY+1,rowlen,1,textattr,SCROLL_DOWN);
+end;
+
+
+
+
+{****************************************************************************
+                             Extra Crt Functions
+****************************************************************************}
+
+procedure cursoron;
+begin
+  SetCursorStyle(ScreenHandle,CURSOR_NORMAL);
+  EnableInputCursor(ScreenHandle);
+end;
+
+
+procedure cursoroff;
+begin
+  DisableInputCursor (ScreenHandle);
+end;
+
+
+procedure cursorbig;
+begin
+  SetCursorStyle(ScreenHandle,CURSOR_BLOCK);
+  EnableInputCursor(ScreenHandle);
+end;
+
+
+{*****************************************************************************
+                          Read and Write routines
+*****************************************************************************}
+
+var
+  CurrX,CurrY : longint;
+
+Procedure WriteChar(c:char);
+var st : array [0..1] of char;
+begin
+  case c of
+   #10 : inc(CurrY);
+   #13 : CurrX:=WinMinX;
+    #8 : begin
+           if CurrX>WinMinX then
+            dec(CurrX);
+         end;
+    #7 : begin { beep }
+           RingBell;
+         end;
+  else
+   begin
+     //WriteScreenCharacterAttribute(ScreenHandle,CurrY-1,CurrX-1,c,textattr);  {not available in protected mode}
+     st[0] := c;
+     st[1] := #0;
+     OutputToScreenWithAttribute(ScreenHandle,textattr,@st);
+     inc(CurrX);
+   end;
+  end;
+  if CurrX>WinMaxX then
+   begin
+     CurrX:=WinMinX;
+     inc(CurrY);
+   end;
+  while CurrY>WinMaxY do
+   begin
+     removeline(1);
+     dec(CurrY);
+   end;
+end;
+
+
+Function CrtWrite(var f : textrec):integer;
+var
+  i : longint;
+begin
+  GetScreenCursor(CurrX,CurrY);
+  for i:=0 to f.bufpos-1 do
+    WriteChar(f.buffer[i]);  { ad: may be better to use a buffer but i think it's fast enough }
+  gotorowcol (CurrY-1,CurrX-1);
+  f.bufpos:=0;
+  CrtWrite:=0;
+end;
+
+
+Function CrtRead(Var F: TextRec): Integer;
+
+  procedure BackSpace;
+  begin
+    if (f.bufpos>0) and (f.bufpos=f.bufend) then
+     begin
+       WriteChar(#8);
+       WriteChar(' ');
+       WriteChar(#8);
+       dec(f.bufpos);
+       dec(f.bufend);
+     end;
+  end;
+
+var
+  ch : Char;
+Begin
+  GetScreenCursor(CurrX,CurrY);
+  f.bufpos:=0;
+  f.bufend:=0;
+  repeat
+    if f.bufpos>f.bufend then
+     f.bufend:=f.bufpos;
+    gotorowcol (CurrY-1,CurrX-1);
+    ch:=readkey;
+    case ch of
+    #0 : case readkey of
+          #71 : while f.bufpos>0 do
+                 begin
+                   dec(f.bufpos);
+                   WriteChar(#8);
+                 end;
+          #75 : if f.bufpos>0 then
+                 begin
+                   dec(f.bufpos);
+                   WriteChar(#8);
+                 end;
+          #77 : if f.bufpos<f.bufend then
+                 begin
+                   WriteChar(f.bufptr^[f.bufpos]);
+                   inc(f.bufpos);
+                 end;
+          #79 : while f.bufpos<f.bufend do
+                 begin
+                   WriteChar(f.bufptr^[f.bufpos]);
+                   inc(f.bufpos);
+                 end;
+         end;
+    ^S,
+    #8 : BackSpace;
+    ^Y,
+   #27 : begin
+           f.bufpos:=f.bufend;
+           while f.bufend>0 do
+            BackSpace;
+         end;
+   #13 : begin
+           WriteChar(#13);
+           WriteChar(#10);
+           f.bufptr^[f.bufend]:=#13;
+           f.bufptr^[f.bufend+1]:=#10;
+           inc(f.bufend,2);
+           break;
+         end;
+   #26 : if CheckEOF then
+          begin
+            f.bufptr^[f.bufend]:=#26;
+            inc(f.bufend);
+            break;
+          end;
+    else
+     begin
+       if f.bufpos<f.bufsize-2 then
+        begin
+          f.buffer[f.bufpos]:=ch;
+          inc(f.bufpos);
+          WriteChar(ch);
+        end;
+     end;
+    end;
+  until false;
+  f.bufpos:=0;
+  gotorowcol (CurrY-1,CurrX-1);
+  CrtRead:=0;
+End;
+
+{$Warnings off}
+Function CrtReturn(Var F: TextRec): Integer;
+Begin
+  CrtReturn:=0;
+end;
+{$Warnings on}
+
+
+Function CrtClose(Var F: TextRec): Integer;
+Begin
+  F.Mode:=fmClosed;
+  CrtClose:=0;
+End;
+
+
+Function CrtOpen(Var F: TextRec): Integer;
+Begin
+  If F.Mode=fmOutput Then
+   begin
+     TextRec(F).InOutFunc:=@CrtWrite;
+     TextRec(F).FlushFunc:=@CrtWrite;
+   end
+  Else
+   begin
+     F.Mode:=fmInput;
+     TextRec(F).InOutFunc:=@CrtRead;
+     TextRec(F).FlushFunc:=@CrtReturn;
+   end;
+  TextRec(F).CloseFunc:=@CrtClose;
+  CrtOpen:=0;
+End;
+
+
+procedure AssignCrt(var F: Text);
+begin
+  Assign(F,'');
+  TextRec(F).OpenFunc:=@CrtOpen;
+end;
+
+procedure InitScreenMode;
+var
+  s_mode : dword;
+begin
+  getscreenmode (s_mode);
+  lastmode := s_mode;
+end;
+
+var
+  x,y : longint;
+begin
+  ScreenHandle := getscreenhandle;
+{ Load startup values }
+  ScreenWidth:=GetScreenWidth;
+  ScreenHeight:=GetScreenHeight;
+  lastmode := CO80;
+  GetScreenCursor(x,y);
+  TextColor (LightGray);
+  TextBackground (Black);
+  InitScreenMode;
+{ Redirect the standard output }
+  assigncrt(Output);
+  Rewrite(Output);
+  TextRec(Output).Handle:=StdOutputHandle;
+  assigncrt(Input);
+  Reset(Input);
+  TextRec(Input).Handle:=StdInputHandle;
+  CheckBreak := FALSE;
+  CheckEOF := FALSE;
+  //_SetCtrlCharCheckMode (CheckBreak);
+  //_SetAutoScreenDestructionMode (TRUE);
+end.
+

+ 748 - 0
rtl/netwlibc/dos.pp

@@ -0,0 +1,748 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team.
+
+    Dos unit for BP7 compatible RTL (novell netware libc)
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+unit dos;
+interface
+
+uses libc;
+
+Const
+  FileNameLen = 255;
+
+Type
+  searchrec = packed record
+     DirP  : POINTER;              { used for opendir }
+     EntryP: POINTER;              { and readdir }
+     Magic : WORD;
+     fill  : array[1..11] of byte;
+     attr  : byte;
+     time  : longint;
+     size  : longint;
+     name  : string[255];
+     { Internals used by netware port only: }
+     _mask : string[255];
+     _dir  : string[255];
+   end;
+
+  registers = packed record
+    case i : integer of
+     0 : (ax,f1,bx,f2,cx,f3,dx,f4,bp,f5,si,f51,di,f6,ds,f7,es,f8,flags,fs,gs : word);
+     1 : (al,ah,f9,f10,bl,bh,f11,f12,cl,ch,f13,f14,dl,dh : byte);
+     2 : (eax,  ebx,  ecx,  edx,  ebp,  esi,  edi : longint);
+    end;
+
+{$i dosh.inc}
+
+implementation
+
+uses
+  strings;
+
+{$ASMMODE ATT}
+
+{*****************************************************************************
+                        --- Info / Date / Time ---
+******************************************************************************}
+{$PACKRECORDS 4}
+
+
+function dosversion : word;
+var i : Tutsname;
+begin
+  if uname (i) >= 0 then
+    dosversion := WORD (i.netware_major) SHL 8 + i.netware_minor
+  else dosversion := $0005;
+end;
+
+
+procedure getdate(var year,month,mday,wday : word);
+var
+  t  : TTime;
+  tm : Ttm;
+begin
+  time(t); localtime_r(t,tm);
+  with tm do
+  begin
+    year := tm_year+1900;
+    month := tm_mon+1;
+    mday := tm_mday;
+    wday := tm_wday;
+  end;
+end;
+
+
+procedure setdate(year,month,day : word);
+begin
+end;
+
+
+procedure gettime(var hour,minute,second,sec100 : word);
+var
+  t  : TTime;
+  tm : Ttm;
+begin
+  time(t); localtime_r(t,tm);
+  with tm do
+  begin
+    hour := tm_hour;
+    minute := tm_min;
+    second := tm_sec;
+    sec100 := 0;
+  end;
+end;
+
+
+procedure settime(hour,minute,second,sec100 : word);
+begin
+end;
+
+
+Procedure packtime(var t : datetime;var p : longint);
+Begin
+  p:=(t.sec shr 1)+(t.min shl 5)+(t.hour shl 11)+(t.day shl 16)+(t.month shl 21)+((t.year-1980) shl 25);
+End;
+
+
+Procedure unpacktime(p : longint;var t : datetime);
+Begin
+  with t do
+   begin
+     sec:=(p and 31) shl 1;
+     min:=(p shr 5) and 63;
+     hour:=(p shr 11) and 31;
+     day:=(p shr 16) and 31;
+     month:=(p shr 21) and 15;
+     year:=(p shr 25)+1980;
+   end;
+End;
+
+
+{******************************************************************************
+                               --- Exec ---
+******************************************************************************}
+
+{$ifdef HASTHREADVAR}
+threadvar
+{$else HASTHREADVAR}
+var
+{$endif HASTHREADVAR}
+  lastdosexitcode : word;
+
+const maxargs=256;
+procedure exec(const path : pathstr;const comline : comstr);
+var c : comstr;
+    i : integer;
+    args : array[0..maxargs] of pchar;
+    arg0 : pathstr;
+    numargs,wstat : integer;
+begin
+  //writeln ('dos.exec (',path,',',comline,')');
+  arg0 := fexpand (path)+#0;
+  args[0] := @arg0[1];
+  numargs := 0;
+  c:=comline;
+  i:=1;
+  while i<=length(c) do
+  begin
+    if c[i]<>' ' then
+    begin
+      {Commandline argument found. append #0 and set pointer in args }
+      inc(numargs);
+      args[numargs]:=@c[i];
+      while (i<=length(c)) and (c[i]<>' ') do
+        inc(i);
+      c[i] := #0;
+    end;
+    inc(i);
+  end;
+  args[numargs+1] := nil;
+  // i := spawnvp (P_WAIT,args[0],@args);
+  i := procve(args[0], PROC_CURRENT_SPACE+PROC_INHERIT_CWD,nil,nil,nil,nil,0,nil,args);
+  if i <> -1 then
+  begin
+    waitpid(i,@wstat,0);
+    doserror := 0;
+    lastdosexitcode := wstat;
+  end else
+  begin
+    doserror := 8;  // for now, what about errno ?
+  end;
+end;
+
+
+
+function dosexitcode : word;
+begin
+  dosexitcode:=lastdosexitcode;
+end;
+
+
+procedure getcbreak(var breakvalue : boolean);
+begin
+end;
+
+
+procedure setcbreak(breakvalue : boolean);
+begin
+end;
+
+
+procedure getverify(var verify : boolean);
+begin
+  verify := true;
+end;
+
+
+procedure setverify(verify : boolean);
+begin
+end;
+
+
+{******************************************************************************
+                               --- Disk ---
+******************************************************************************}
+
+function getvolnum (drive : byte) : longint;
+var dir : STRING[255];
+    P,PS,
+    V   : LONGINT;
+begin
+  {if drive = 0 then
+  begin  // get volume name from current directory (i.e. SERVER-NAME/VOL2:TEST)
+    getdir (0,dir);
+    p := pos (':', dir);
+    if p = 0 then
+    begin
+      getvolnum := -1;
+      exit;
+    end;
+    byte (dir[0]) := p-1;
+    dir[p] := #0;
+    PS := pos ('/', dir);
+    INC (PS);
+    if _GetVolumeNumber (@dir[PS], V) <> 0 then
+      getvolnum := -1
+    else
+      getvolnum := V;
+  end else
+    getvolnum := drive-1;}
+end;
+
+
+function diskfree(drive : byte) : int64;
+VAR Buf                 : ARRAY [0..255] OF CHAR;
+    TotalBlocks         : WORD;
+    SectorsPerBlock     : WORD;
+    availableBlocks     : WORD;
+    totalDirectorySlots : WORD;
+    availableDirSlots   : WORD;
+    volumeisRemovable   : WORD;
+    volumeNumber        : LONGINT;
+begin
+  volumeNumber := getvolnum (drive);
+  (*
+  if volumeNumber >= 0 then
+  begin
+    {i think thats not the right function but for others i need a connection handle}
+    if _GetVolumeInfoWithNumber (byte(volumeNumber),@Buf,
+                                 TotalBlocks,
+                                 SectorsPerBlock,
+                                 availableBlocks,
+                                 totalDirectorySlots,
+                                 availableDirSlots,
+                                 volumeisRemovable) = 0 THEN
+    begin
+      diskfree := int64 (availableBlocks) * int64 (SectorsPerBlock) * 512;
+    end else
+      diskfree := 0;
+  end else*)
+    diskfree := 0;
+end;
+
+
+function disksize(drive : byte) : int64;
+VAR Buf                 : ARRAY [0..255] OF CHAR;
+    TotalBlocks         : WORD;
+    SectorsPerBlock     : WORD;
+    availableBlocks     : WORD;
+    totalDirectorySlots : WORD;
+    availableDirSlots   : WORD;
+    volumeisRemovable   : WORD;
+    volumeNumber        : LONGINT;
+begin
+  volumeNumber := getvolnum (drive);
+  (*
+  if volumeNumber >= 0 then
+  begin
+    {i think thats not the right function but for others i need a connection handle}
+    if _GetVolumeInfoWithNumber (byte(volumeNumber),@Buf,
+                                 TotalBlocks,
+                                 SectorsPerBlock,
+                                 availableBlocks,
+                                 totalDirectorySlots,
+                                 availableDirSlots,
+                                 volumeisRemovable) = 0 THEN
+    begin
+      disksize := int64 (TotalBlocks) * int64 (SectorsPerBlock) * 512;
+    end else
+      disksize := 0;
+  end else*)
+    disksize := 0;
+end;
+
+
+{******************************************************************************
+                     --- Utils ---
+******************************************************************************}
+
+procedure timet2dostime (timet:longint; var dostime : longint);
+var tm : Ttm;
+begin
+  localtime_r(timet,tm);
+  dostime:=(tm.tm_sec shr 1)+(tm.tm_min shl 5)+(tm.tm_hour shl 11)+(tm.tm_mday shl 16)+((tm.tm_mon+1) shl 21)+((tm.tm_year+1900-1980) shl 25);
+end;
+
+function nwattr2dosattr (nwattr : longint) : word;
+begin
+  nwattr2dosattr := 0;
+  if nwattr and M_A_RDONLY > 0 then nwattr2dosattr := nwattr2dosattr + readonly;
+  if nwattr and M_A_HIDDEN > 0 then nwattr2dosattr := nwattr2dosattr + hidden;
+  if nwattr and M_A_SYSTEM > 0 then nwattr2dosattr := nwattr2dosattr + sysfile;
+  if nwattr and M_A_SUBDIR > 0 then nwattr2dosattr := nwattr2dosattr + directory;
+  if nwattr and M_A_ARCH   > 0 then nwattr2dosattr := nwattr2dosattr + archive;
+end;
+
+
+{******************************************************************************
+                     --- Findfirst FindNext ---
+******************************************************************************}
+
+
+procedure find_setfields (var f : searchRec);
+var
+  StatBuf : TStat;
+  fname   : string[255];
+begin
+  with F do
+  begin
+    if Magic = $AD01 then
+    begin
+      attr := nwattr2dosattr (Pdirent(EntryP)^.d_mode);
+      size := Pdirent(EntryP)^.d_size;
+      name := strpas (Pdirent(EntryP)^.d_name);
+      doserror := 0;
+      fname := f._dir + f.name;
+      if length (fname) = 255 then dec (byte(fname[0]));
+      fname := fname + #0;
+      if stat (@fname[1],StatBuf) = 0 then
+        timet2dostime (StatBuf.st_mtim.tv_sec, time)
+      else
+        time := 0;
+    end else
+    begin
+      FillChar (f,sizeof(f),0);
+      doserror := 18;
+    end;
+  end;
+end;
+
+
+procedure findfirst(const path : pathstr;attr : word;var f : searchRec);
+var
+  path0 : array[0..256] of char;
+  p     : longint;
+begin
+  IF path = '' then
+  begin
+    doserror := 18;
+    exit;
+  end;
+  if (pos ('?',path) > 0) or (pos ('*',path) > 0) then
+  begin
+    p := length (path);
+    while (p > 0) and (not (path[p] in ['\','/'])) do
+      dec (p);
+    if p > 0 then
+    begin
+      f._mask := copy (path,p+1,255);
+      f._dir := copy (path,1,p);
+      strpcopy(path0,f._dir);
+    end else
+    begin
+      f._mask := path;
+      getdir (0,f._dir);
+      if (f._dir[length(f._dir)] <> '/') and
+         (f._dir[length(f._dir)] <> '\') then
+        f._dir := f._dir + '/';
+    end;
+  end;
+  //writeln (stderr,'mask: "',f._mask,'" dir:"',path0,'"');
+  f._mask := f._mask + #0;
+  Pdirent(f.DirP) := opendir (path0);
+  if f.DirP = nil then
+    doserror := 18
+  else begin
+    F.Magic := $AD01;
+    findnext (f);
+  end;
+end;
+
+
+procedure findnext(var f : searchRec);
+begin
+  if F.Magic <> $AD01 then
+  begin
+    doserror := 18;
+    exit;
+  end;
+  doserror:=0;
+  repeat
+    Pdirent(f.EntryP) := readdir (Pdirent(f.DirP));
+    if F.EntryP = nil then
+      doserror := 18
+    else
+    if f._mask = #0 then
+    begin
+      find_setfields (f);
+      exit;
+    end else
+    if fnmatch(@f._mask[1],Pdirent(f.EntryP)^.d_name,FNM_CASEFOLD) = 0 then
+    begin
+      find_setfields (f);
+      exit;
+    end;
+  until doserror <> 0;
+end;
+
+
+Procedure FindClose(Var f: SearchRec);
+begin
+  if F.Magic <> $AD01 then
+  begin
+    doserror := 18;
+    EXIT;
+  end;
+  doserror:=0;
+  closedir (Pdirent(f.DirP));
+  f.Magic := 0;
+  f.DirP := NIL;
+  f.EntryP := NIL;
+end;
+
+
+procedure swapvectors;
+begin
+end;
+
+
+{******************************************************************************
+                               --- File ---
+******************************************************************************}
+
+procedure fsplit(path : pathstr;var dir : dirstr;var name : namestr;var ext : extstr);
+var
+   dotpos,p1,i : longint;
+begin
+  { allow backslash as slash }
+  for i:=1 to length(path) do
+   if path[i]='\' then path[i]:='/';
+  { get volume name }
+  p1:=pos(':',path);
+  if p1>0 then
+    begin
+       dir:=copy(path,1,p1);
+       delete(path,1,p1);
+    end
+  else
+    dir:='';
+  { split the path and the name, there are no more path informtions }
+  { if path contains no backslashes                                 }
+  while true do
+    begin
+       p1:=pos('/',path);
+       if p1=0 then
+         break;
+       dir:=dir+copy(path,1,p1);
+       delete(path,1,p1);
+    end;
+  { try to find out a extension }
+  //if LFNSupport then
+    begin
+       Ext:='';
+       i:=Length(Path);
+       DotPos:=256;
+       While (i>0) Do
+         Begin
+            If (Path[i]='.') Then
+              begin
+                 DotPos:=i;
+                 break;
+              end;
+            Dec(i);
+         end;
+       Ext:=Copy(Path,DotPos,255);
+       Name:=Copy(Path,1,DotPos - 1);
+    end
+end;
+
+
+function  GetShortName(var p : String) : boolean;
+begin
+  GetShortName := false;
+end;
+
+function  GetLongName(var p : String) : boolean;
+begin
+  GetLongName := false;
+end;
+
+
+{$define FPC_FEXPAND_DRIVES}
+{$define FPC_FEXPAND_VOLUMES}
+{$define FPC_FEXPAND_NO_DEFAULT_PATHS}
+{$i fexpand.inc}
+
+Function FSearch(path: pathstr; dirlist: string): pathstr;
+var
+  i,p1   : longint;
+  s      : searchrec;
+  newdir : pathstr;
+begin
+  system.write ('FSearch ("',path,'","',dirlist,'"');
+{ check if the file specified exists }
+  findfirst(path,anyfile,s);
+  if doserror=0 then
+   begin
+     findclose(s);
+     fsearch:=path;
+     exit;
+   end;
+{ No wildcards allowed in these things }
+  if (pos('?',path)<>0) or (pos('*',path)<>0) then
+    fsearch:=''
+  else
+    begin
+       { allow backslash as slash }
+       for i:=1 to length(dirlist) do
+         if dirlist[i]='\' then dirlist[i]:='/';
+       repeat
+         p1:=pos(';',dirlist);
+         if p1<>0 then
+          begin
+            newdir:=copy(dirlist,1,p1-1);
+            delete(dirlist,1,p1);
+          end
+         else
+          begin
+            newdir:=dirlist;
+            dirlist:='';
+          end;
+         if (newdir<>'') and (not (newdir[length(newdir)] in ['/',':'])) then
+          newdir:=newdir+'/';
+         findfirst(newdir+path,anyfile,s);
+         if doserror=0 then
+          newdir:=newdir+path
+         else
+          newdir:='';
+       until (dirlist='') or (newdir<>'');
+       fsearch:=newdir;
+    end;
+  findclose(s);
+end;
+
+
+{******************************************************************************
+                       --- Get/Set File Time,Attr ---
+******************************************************************************}
+
+
+procedure getftime(var f;var time : longint);
+var
+  StatBuf : TStat;
+begin
+  doserror := 0;
+  if fstat (FileRec (f).Handle, StatBuf) = 0 then
+    timet2dostime (StatBuf.st_mtim.tv_sec,time)
+  else begin
+    time := 0;
+    doserror := ___errno^;
+   end;
+end;
+
+
+procedure setftime(var f;time : longint);
+begin
+  {is there a netware function to do that ?????}
+  ConsolePrintf ('warning: fpc dos.setftime not implemented'#13#10);
+end;
+
+
+procedure getfattr(var f;var attr : word);
+VAR StatBuf : TStat;
+begin
+  doserror := 0;
+  if fstat (FileRec (f).Handle, StatBuf) = 0 then
+    attr := nwattr2dosattr (StatBuf.st_mode)
+  else
+  begin
+    attr := 0;
+    doserror := ___errno^;
+  end;
+end;
+
+
+procedure setfattr(var f;attr : word);
+var
+  StatBuf : TStat;
+  newMode : longint;
+begin
+  if fstat (FileRec(f).Handle,StatBuf) = 0 then
+  begin
+    newmode := StatBuf.st_mode and ($FFFFFFFF - M_A_RDONLY-M_A_HIDDEN-M_A_SYSTEM-M_A_ARCH); {only this can be set by dos unit}
+    newmode := newmode and M_A_BITS_SIGNIFICANT;  {set netware attributes}
+    if attr and readonly > 0 then
+      newmode := newmode or M_A_RDONLY;
+    if attr and hidden > 0 then
+      newmode := newmode or M_A_HIDDEN;
+    if attr and sysfile > 0 then
+      newmode := newmode or M_A_SYSTEM;
+    if attr and archive > 0 then
+      newmode := newmode or M_A_ARCH;
+    if fchmod (FileRec(f).Handle,newMode) < 0 then
+      doserror := ___errno^ else
+      doserror := 0;
+  end else
+    doserror := ___errno^;
+end;
+
+
+{******************************************************************************
+                             --- Environment ---
+******************************************************************************}
+
+Function EnvCount: Longint;
+var
+  envcnt : longint;
+  p      : ppchar;
+Begin
+  envcnt:=0;
+  p:=envp;      {defined in system}
+  while (p^<>nil) do
+  begin
+    inc(envcnt);
+    inc(p);
+  end;
+  EnvCount := envcnt
+End;
+
+
+Function EnvStr (Index: longint): String;
+Var
+  i : longint;
+  p : ppchar;
+Begin
+  if Index <= 0 then
+    envstr:=''
+  else
+  begin
+    p:=envp;      {defined in system}
+    i:=1;
+    while (i<Index) and (p^<>nil) do
+    begin
+      inc(i);
+      inc(p);
+    end;
+    if p=nil then
+      envstr:=''
+    else
+      envstr:=strpas(p^)
+  end;
+end;
+
+
+{ works fine (at least with netware 6.5) }
+Function  GetEnv(envvar: string): string;
+var envvar0 : array[0..512] of char;
+    p       : pchar;
+    i,isDosPath,res : longint;
+begin
+  if upcase(envvar) = 'PATH' then
+  begin  // netware does not have search paths in the environment var PATH
+         // return it here (needed for the compiler)
+    GetEnv := '';
+    i := 1;
+    res := GetSearchPathElement (i, isdosPath, @envvar0[0]);
+    while res = 0 do
+    begin
+      if GetEnv <> '' then GetEnv := GetEnv + ';';
+      GetEnv := GetEnv + envvar0;
+      inc (i);
+      res := GetSearchPathElement (i, isdosPath, @envvar0[0]);
+    end;
+    for i := 1 to length(GetEnv) do
+      if GetEnv[i] = '\' then
+        GetEnv[i] := '/';
+  end else
+  begin
+    strpcopy(envvar0,envvar);
+    p := libc.getenv (envvar0);
+    if p = NIL then
+      GetEnv := ''
+    else
+      GetEnv := strpas (p);
+  end;
+end;
+
+
+{******************************************************************************
+                             --- Not Supported ---
+******************************************************************************}
+
+Procedure keep(exitcode : word);
+Begin
+ { simply wait until nlm will be unloaded }
+ while true do delay (60000);
+End;
+
+Procedure getintvec(intno : byte;var vector : pointer);
+Begin
+ { no netware equivalent }
+End;
+
+Procedure setintvec(intno : byte;vector : pointer);
+Begin
+ { no netware equivalent }
+End;
+
+procedure intr(intno : byte;var regs : registers);
+begin
+ { no netware equivalent }
+end;
+
+procedure msdos(var regs : registers);
+begin
+ { no netware equivalent }
+end;
+
+
+end.
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}
+

+ 62 - 0
rtl/netwlibc/dynlibs.inc

@@ -0,0 +1,62 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team
+
+    Implement OS-dependent part of dynamic library loading.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+{$ifdef readinterface}
+
+{ ---------------------------------------------------------------------
+    Interface declarations
+  ---------------------------------------------------------------------}
+
+Type
+  TLibHandle = Pointer;
+
+Const
+  NilHandle = Nil;
+
+{$else}
+
+{ ---------------------------------------------------------------------
+    Implementation section
+  ---------------------------------------------------------------------}
+
+uses libc;
+
+Function LoadLibrary(Name : AnsiString) : TLibHandle;
+
+begin
+  Result:=dlopen(Pchar(Name),RTLD_LAZY);
+end;
+
+Function GetProcedureAddress(Lib : TLibHandle; ProcName : AnsiString) : Pointer;
+
+begin
+  Result:=dlsym(lib,pchar(ProcName));
+end;
+
+Function UnloadLibrary(Lib : TLibHandle) : Boolean;
+
+begin
+  Result:=dlClose(Lib)=0;
+end;
+
+{$endif}
+
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 147 - 0
rtl/netwlibc/errno.inc

@@ -0,0 +1,147 @@
+  { -------------------------- Base POSIX-mandated constants ---------------  }
+  { no such file or directory                      }
+  const
+     SYS_ENOENT = 1;      // arg list too big
+     SYS_E2BIG = 2;       // arg list too big
+     SYS_ENOEXEC = 3;     // exec format error
+     SYS_EBADF = 4;       // bad file number
+     SYS_ENOMEM = 5;      // not enough memory
+     SYS_EACCES = 6;      // permission denied
+     SYS_EEXIST = 7;      // file exists
+     SYS_EXDEV = 8;       // cross-device link
+     SYS_EINVAL = 9;      // invalid argument
+     SYS_ENFILE = 10;     // file table overflow
+     SYS_EMFILE = 11;     // too many open files
+     SYS_ENOSPC = 12;     // no space left on device
+     SYS_EDOM = 13;       // argument too large
+     SYS_ERANGE = 14;     // result too large
+     SYS_EDEADLK = 15;    // resource deadlock would occur
+  { -------------------------- Miscellaneous NLM Library constants ---------  }
+     SYS_EINUSE    = 16;  // resource(s) in use
+     SYS_ESERVER   = 17;  // server error (memory out, I/O error, etc.)
+     SYS_ENOSERVR  = 18;  // no server (queue server, file server, etc.)
+     SYS_EWRNGKND  = 19;  // wrong kind--an operation is being...
+                          // ...attempted on the wrong kind of object
+     SYS_ETRNREST  = 20;  // transaction restarted
+     SYS_ERESOURCE = 21;  // resources unavailable (maybe permanently)
+     SYS_EBADHNDL  = 22;  // bad non-file handle (screen, semaphore, etc)
+     SYS_ENO_SCRNS = 23;  // screen I/O attempted when no screens
+  { -------------------------- Additional POSIX / traditional UNIX constants  }
+     SYS_EAGAIN    = 24;  // resource temporarily unavailable
+     SYS_ENXIO     = 25;  // no such device or address
+     SYS_EBADMSG   = 26;  // not a data message
+     SYS_EFAULT    = 27;  // bad address
+     SYS_EIO       = 28;  // physical I/O error
+     SYS_ENODATA   = 29;  // no data
+     SYS_ENOSTRMS  = 30;  // streams not available
+  { Berkeley sockets constants ------------------  }
+     SYS_EPROTO    = 31;  // fatal protocol error
+     SYS_EPIPE     = 32;  // broken pipe
+     SYS_ESPIPE    = 33;  // illegal seek
+  { Non-blocking and interrupt I/O constants ----  }
+     SYS_ETIME     = 34;  // ioctl acknowledge timeout
+  { operation would block                          }
+     SYS_EWOULDBLOCK=35;  // operation would block
+     SYS_EINPROGRESS=36;  // operation now in progress
+     SYS_EALREADY  = 37;  // operation already in progress
+  { IPC network argument constants --------------  }
+     SYS_ENOTSOCK  = 38;  // socket operation on non-socket
+     SYS_EDESTADDRREQ=39; // destination address required
+     SYS_EMSGSIZE  = 40;  // message too long
+     SYS_EPROTOTYPE= 41;  // protocol wrong type for socket
+     SYS_ENOPROTOOPT=42;  // protocol not available
+     SYS_EPROTONOSUPPORT = 43;  // protocol not supported
+     SYS_ESOCKTNOSUPPORT = 44;  // socket type not supported
+     SYS_EOPNOTSUPP      = 45;  // operation not supported on socket
+     SYS_EPFNOSUPPORT    = 46;  // protocol family not supported
+     SYS_EAFNOSUPPORT    = 47;  // address family unsupported by protocol family
+     SYS_EADDRINUSE      = 48;  // address already in use
+     SYS_EADDRNOTAVAIL   = 49;  // can't assign requested address
+  { Operational constants -----------------------  }
+     SYS_ENETDOWN        = 50;  // Network is down
+  { network is unreachable                         }
+     SYS_ENETUNREACH = 51;
+  { network dropped connection on reset            }
+     SYS_ENETRESET = 52;
+  { software caused connection abort               }
+     SYS_ECONNABORTED = 53;
+  { connection reset by peer                       }
+     SYS_ECONNRESET = 54;
+  { no buffer space available                      }
+     SYS_ENOBUFS = 55;
+  { socket is already connected                    }
+     SYS_EISCONN = 56;
+  { socket is not connected                        }
+     SYS_ENOTCONN = 57;
+  { can't send after socket shutdown               }
+     SYS_ESHUTDOWN = 58;
+  { too many references: can't splice              }
+     SYS_ETOOMANYREFS = 59;
+  { connection timed out                           }
+     SYS_ETIMEDOUT = 60;
+  { connection refused                             }
+     SYS_ECONNREFUSED = 61;
+  { -------------------------- Additional POSIX-mandated constants ---------  }
+  { resource busy                                  }
+     SYS_EBUSY = 62;
+  { interrupted function call                      }
+     SYS_EINTR = 63;
+  { is a directory                                 }
+     SYS_EISDIR = 64;
+  { filename too long                              }
+     SYS_ENAMETOOLONG = 65;
+  { function not implemented                       }
+     SYS_ENOSYS = 66;
+  { not a directory                                }
+     SYS_ENOTDIR = 67;
+  { directory not empty                            }
+     SYS_ENOTEMPTY = 68;
+  { operation not permitted                        }
+     SYS_EPERM = 69;
+  { no child process                               }
+     SYS_ECHILD = 70;
+  { file too large                                 }
+     SYS_EFBIG = 71;
+  { too many links                                 }
+     SYS_EMLINK = 72;
+     SYS_ELOOP  = SYS_EMLINK;
+  { no such device                                 }
+     SYS_ENODEV = 73;
+  { no locks available                             }
+     SYS_ENOLCK = 74;
+  { inappropriate I/O control operation            }
+     SYS_ENOTTY = 75;
+  { inappropriate operation for file type      }
+     SYS_EFTYPE = SYS_ENOTTY;
+  { read-only file system                          }
+     SYS_EROFS = 76;
+  { no such process                                }
+     SYS_ESRCH = 77;
+  { operation was cancelled                        }
+     SYS_ECANCELED = 78;
+  { this optional functionality not supported      }
+     SYS_ENOTSUP = 79;
+  { -------------------------- CLib-implementation-specific constants ------  }
+     SYS_ECANCELLED = SYS_ECANCELED;
+  { anomaly in NLM data structure                  }
+     SYS_ENLMDATA = 100;
+  { illegal character sequence in multibyte        }
+     SYS_EILSEQ = 101;
+  { internal library inconsistency                 }
+     SYS_EINCONSIS = 102;
+  { DOS-text file inconsistency--no newline...     }
+     SYS_EDOSTEXTEOL = 103;
+  { ...after carriage return                       }
+  { object doesn't exist                           }
+     SYS_ENONEXTANT = 104;
+     SYS_ENOCONTEXT = 105;        // no thread library context present
+     SYS_ELASTERR = SYS_ENOCONTEXT;
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+  Revision 1.4  2002/09/07 16:01:20  peter
+    * old logs removed and tabs fixed
+
+}

+ 54 - 0
rtl/netwlibc/initc.pp

@@ -0,0 +1,54 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team.
+
+    This file handles the libc errno abstraction.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+unit initc;
+
+interface
+
+type libcint   = longint;
+     plibcint = ^libcint;
+
+function fpgetCerrno:libcint;
+procedure fpsetCerrno(err:libcint);
+
+{$ifdef HASGLOBALPROPERTY}
+property cerrno:libcint read fpgetCerrno write fpsetcerrno;
+{$endif HASGLOBALPROPERTY}
+
+implementation
+
+const clib = 'libc';
+
+function geterrnolocation: Plibcint; cdecl;external clib name '___errno';
+
+function fpgetCerrno:libcint;
+
+begin
+  fpgetCerrno:=geterrnolocation^;
+end;
+
+procedure fpsetCerrno(err:libcint);
+begin
+  geterrnolocation^:=err;
+end;
+
+
+end.
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 1391 - 0
rtl/netwlibc/libc.imp

@@ -0,0 +1,1391 @@
+ ASCIIZToLenStr,
+ ASCIIZToMaxLenStr,
+ Copy__fp_characteristics,
+ Delete_CLIB_OPT_FromCommandLine,
+ DllMain,
+ ExportPublicObject,
+ GetRawKeyWithScreen,
+ ImportPublicObject,
+ KernelSpinLock,
+ KernelSpinLockDisable,
+ KernelSpinLockInit,
+ KernelSpinTryLock,
+ KernelSpinTryLockDisable,
+ KernelSpinUnlock,
+ KernelSpinUnlockRestore,
+ LenStrCat,
+ LenStrCmp,
+ LenStrCpy,
+ LenToASCIIZStr,
+ LibCPostStart,
+ LibCPreStart,
+ Lisalnum,
+ Lisalpha,
+ Lisblank,
+ Liscntrl,
+ Lisdigit,
+ Lisgraph,
+ Lislower,
+ Lisprint,
+ Lispunct,
+ Lisspace,
+ Lisupper,
+ Lisxdigit,
+ Lstrbcpy,
+ Lstrchr,
+ Lstrcmp,
+ Lstrcoll,
+ Lstrcspn,
+ Lstricmp,
+ Lstrlen,
+ Lstrlwr,
+ Lstrncat,
+ Lstrncmp,
+ Lstrncpy,
+ Lstrnicmp,
+ Lstrpbrk,
+ Lstrrchr,
+ Lstrrev,
+ Lstrspn,
+ Lstrstr,
+ Lstrtok_r,
+ Lstrupr,
+ Lstrxfrm,
+ PromptForPassword,
+ PromptForString,
+ ReallocSleepOK,
+ RxIdentifyCode,
+ RxLockMemory,
+ RxRegisterKernelResource,
+ RxRegisterSysCall,
+ RxRegisterSyscall,
+ RxRegisterThreadResource,
+ RxUnidentifyCode,
+ RxUnlockMemory,
+ RxUnregisterKernelResource,
+ RxUnregisterSysCall,
+ RxUnregisterSyscall,
+ RxUnregisterThreadResource,
+ SetAutoUnloadFlag,
+ ShutdownServer,
+ StartNLMInNKS,
+ TerminateNLMFromNKS,
+ TransmitFile,
+ UnImportPublicObject,
+ UnregisterKLibHandlers,
+ _8087,
+ _NonAppCheckUnload,
+ _NonAppStart,
+ _NonAppStop,
+ __8087,
+ __CHP,
+ __CW_div,
+ __CW_ldiv,
+ __FDA,
+ __FDC,
+ __FDD,
+ __FDFS,
+ __FDI4,
+ __FDM,
+ __FDN,
+ __FDS,
+ __FDU4,
+ __FSA,
+ __FSC,
+ __FSD,
+ __FSFD,
+ __FSI1,
+ __FSI2,
+ __FSI4,
+ __FSM,
+ __FSN,
+ __FSS,
+ __FSU1,
+ __FSU2,
+ __FSU4,
+ __I4FD,
+ __I4FS,
+ __RDI4,
+ __RDU4,
+ __TlsAlloc,
+ __U4FD,
+ __U4FS,
+ __ZBuf2F,
+ ____environ,
+ ___cin,
+ ___clocks_per_sec,
+ ___cout,
+ ___daylight,
+ ___daylightOffset,
+ ___daylightOnOff,
+ ___environ,
+ ___errno,
+ ___fd_clr,
+ ___fd_isset,
+ ___fd_set,
+ ___fd_zero,
+ ___fpclassify_d,
+ ___fpclassify_f,
+ ___fpclassify_ld,
+ ___h_errno,
+ ___huge_double,
+ ___huge_float,
+ ___huge_long_double,
+ ___isfinite_d,
+ ___isfinite_f,
+ ___isfinite_ld,
+ ___lastClientErrno,
+ ___lastFileSysErrno,
+ ___nan_float,
+ ___optarg,
+ ___opterr,
+ ___optind,
+ ___optopt,
+ ___optreset,
+ ___signbit_d,
+ ___signbit_f,
+ ___signbit_ld,
+ ___stderr,
+ ___stdin,
+ ___stdout,
+ ___timezone,
+ ___tzname,
+ __ashldi3,
+ __ashrdi3,
+ __ctype,
+ __deinit_environment,
+ __divdi3,
+ __fp_characteristics,
+ __get_stderr,
+ __get_stdin,
+ __get_stdout,
+ __init_387_emulator,
+ __init_environment,
+ __longjmp,
+ __lshrdi3,
+ __moddi3,
+ __muldi3,
+ __old_8087,
+ __set_errno,
+ __setjmp,
+ __udivdi3,
+ __umoddi3,
+ __utf8width,
+ _alldiv,
+ _allmul,
+ _allrem,
+ _allshl,
+ _allshr,
+ _assert,
+ _assert_expr,
+ _aulldiv,
+ _aullrem,
+ _aullshl,
+ _aullshr,
+ _clear87,
+ _control87,
+ _fini,
+ _fltused_,
+ _fpreset,
+ _init,
+ _lldiv,
+ _llmod,
+ _llmul,
+ _llshl,
+ _llshr,
+ _lludiv,
+ _llumod,
+ _llushr,
+ _lrotl,
+ _lrotr,
+ _rotl,
+ _rotr,
+ _rt_cmps64%16,
+ _rt_cmpu64%16,
+ _rt_divs64%16,
+ _rt_divu64%16,
+ _rt_mods64%16,
+ _rt_modu64%16,
+ _rt_mul64%16,
+ _rt_rotl64%16,
+ _rt_rotr64%16,
+ _rt_shl64%16,
+ _rt_shrs64%16,
+ _rt_shru64%16,
+ _status87,
+ abs,
+ acos,
+ asin,
+ assert_action,
+ atan,
+ atan2,
+ atof,
+ atoi,
+ atol,
+ atoll,
+ atomic64_add,
+ atomic64_cmpxchg,
+ atomic64_dec,
+ atomic64_inc,
+ atomic64_sub,
+ atomic64_xchg,
+ atomic64_xchgadd,
+ atomic_add,
+ atomic_and,
+ atomic_btr,
+ atomic_bts,
+ atomic_cmpxchg,
+ atomic_dec,
+ atomic_inc,
+ atomic_or,
+ atomic_sub,
+ atomic_xchg,
+ atomic_xchgadd,
+ atomic_xor,
+ basename,
+ bsearch,
+ btowc,
+ cabs,
+ cbrt,
+ ceil,
+ cleardontunloadflag,
+ confstr,
+ construct,
+ construct_argc_argv,
+ cos,
+ cosh,
+ deconstruct,
+ detect_redirection,
+ dirname,
+ dlclose,
+ dlerror,
+ dlopen,
+ dlsym,
+ err,
+ errx,
+ exp,
+ fabs,
+ feclearexcept,
+ fegetenv,
+ fegetexceptflag,
+ fegetround,
+ feholdexcept,
+ feraiseexceptflag,
+ fesetenv,
+ fesetexceptflag,
+ fesetround,
+ fetestexcept,
+ feupdateenv,
+ finite,
+ floor,
+ fmod,
+ fpathconf,
+ fpgetmask,
+ fpgetround,
+ fpgetsticky,
+ fpsetmask,
+ fpsetround,
+ fpsetsticky,
+ frexp,
+ fs_getslotinfo,
+ fs_mapkeytopath,
+ fs_mapzidtopath,
+ fs_read,
+ fs_register,
+ fs_unregister,
+ fs_write,
+ fst_getorignamespace,
+ fst_getvoldir,
+ fst_mapvoldirtopath,
+ fst_mapvoltoname,
+ fst_read,
+ fst_register,
+ fst_unregister,
+ fst_write,
+ get_app_data,
+ get_app_type,
+ getaddressspace,
+ getaddressspacename,
+ getallocresourcetag,
+ getnativethread,
+ getnlmhandle,
+ getnlmhandlefromthread,
+ getnlmloadpath,
+ getnlmname,
+ getopt,
+ getopt_long,
+ getopt_long_only,
+ getthreadid,
+ getthreadname,
+ htol,
+ hypot,
+ in6addr_any,
+ in6addr_loopback,
+ inet_makeaddr,
+ inet_ntop,
+ inet_pton,
+ isalnum,
+ isalpha,
+ isascii,
+ isblank,
+ iscntrl,
+ isdigit,
+ isgraph,
+ islower,
+ ismultibyte,
+ isprint,
+ ispunct,
+ isspace,
+ isupper,
+ isutf8alnum,
+ isutf8alpha,
+ isutf8ascii,
+ isutf8digit,
+ isutf8lower,
+ isutf8space,
+ isutf8upper,
+ isutf8xdigit,
+ iswalnum,
+ iswalpha,
+ iswascii,
+ iswcntrl,
+ iswctype,
+ iswdigit,
+ iswgraph,
+ iswlower,
+ iswprint,
+ iswpunct,
+ iswspace,
+ iswupper,
+ iswxdigit,
+ isxdigit,
+ itoa,
+ itoab,
+ j0,
+ j1,
+ jn,
+ labs,
+ ldexp,
+ libcthreshold,
+ library_calloc,
+ library_free,
+ library_malloc,
+ library_msize,
+ library_realloc,
+ lltoa,
+ log,
+ log10,
+ ltoa,
+ main,
+ matherr_handler,
+ max,
+ mbrlen,
+ mbrtowc,
+ mbsinit,
+ mbsrtowcs,
+ memchr,
+ memcmp,
+ memcpy,
+ memicmp,
+ memmove,
+ memset,
+ min,
+ mkdtemp,
+ mkstemp,
+ mktemp,
+ modf,
+ multibyte,
+ netware_conn_info,
+ netware_conn_info_from_slot,
+ netware_cpu_info,
+ netware_fs_info,
+ netware_mem_info,
+ netware_mem_info_for_nlm,
+ netware_net_info,
+ netware_net_macaddr,
+ netware_os_info,
+ netware_restag_info_for_nlm,
+ netware_vmem_info,
+ netware_vol_info,
+ netware_vol_info_from_name,
+ netware_vol_info_from_number,
+ nextmb,
+ nlmisloadedprotected,
+ null_ipv6_address,
+ pathconf,
+ posix_checkunload,
+ posix_start,
+ posix_stop,
+ pow,
+ prevmb,
+ qsort,
+ register_destructor,
+ register_library,
+ remainder,
+ rint,
+ rotl16,
+ rotl32,
+ rotl64,
+ rotl8,
+ rotr16,
+ rotr32,
+ rotr64,
+ rotr8,
+ set_app_data,
+ setdontunloadflag,
+ sethostid,
+ setthreadname,
+ sin,
+ sinh,
+ sqrt,
+ stackwatermark,
+ stpcpy,
+ strcasecmp,
+ strcat,
+ strchr,
+ strcmp,
+ strcpy,
+ strcspn,
+ strecpy,
+ stricmp,
+ strindex,
+ strlcat,
+ strlcpy,
+ strlen,
+ strlist,
+ strlwr,
+ strncasecmp,
+ strncat,
+ strncmp,
+ strncoll,
+ strncpy,
+ strnicmp,
+ strnset,
+ strpbrk,
+ strrchr,
+ strrev,
+ strrindex,
+ strset,
+ strspn,
+ strstr,
+ strsub,
+ strtod,
+ strtoi,
+ strtok_r,
+ strtol,
+ strtoll,
+ strtoul,
+ strtoull,
+ strupr,
+ strwhich,
+ strxfrm,
+ swab,
+ swaw,
+ sysconf,
+ system,
+ tan,
+ tanh,
+ toascii,
+ tolower,
+ toupper,
+ towctrans,
+ towlower,
+ towupper,
+ truncmb,
+ ucs2_to_utf8,
+ ulltoa,
+ ultoa,
+ uname2,
+ unregister_library,
+ utf8_to_ucs2,
+ utf8cat,
+ utf8chr,
+ utf8cmp,
+ utf8cpy,
+ utf8cspn,
+ utf8dup,
+ utf8index,
+ utf8len,
+ utf8list,
+ utf8lwr,
+ utf8ncat,
+ utf8ncpy,
+ utf8next,
+ utf8nlen,
+ utf8nset,
+ utf8pbrk,
+ utf8prev,
+ utf8rchr,
+ utf8rev,
+ utf8size,
+ utf8spn,
+ utf8str,
+ utf8tok_r,
+ utf8upr,
+ utf8width,
+ utoa,
+ validateaddressrange,
+ valuemb,
+ verifynlmhandle,
+ verr,
+ verrx,
+ vwarn,
+ vwarnx,
+ warn,
+ warnx,
+ wcrtomb,
+ wcscasecmp,
+ wcscat,
+ wcschr,
+ wcscmp,
+ wcscoll,
+ wcscpy,
+ wcscspn,
+ wcserror,
+ wcsftime,
+ wcsicmp,
+ wcsindex,
+ wcslen,
+ wcslist,
+ wcslwr,
+ wcsmemcmp,
+ wcsmemcpy,
+ wcsmemmove,
+ wcsncasecmp,
+ wcsncat,
+ wcsncmp,
+ wcsncpy,
+ wcsnicmp,
+ wcsnset,
+ wcspbrk,
+ wcsrchr,
+ wcsrev,
+ wcsrindex,
+ wcsrtombs,
+ wcsset,
+ wcsspn,
+ wcsstr,
+ wcstod,
+ wcstof,
+ wcstok,
+ wcstok_r,
+ wcstol,
+ wcstold,
+ wcstoll,
+ wcstoul,
+ wcstoull,
+ wcsupr,
+ wcswidth,
+ wcsxfrm,
+ wctob,
+ wctrans,
+ wctype,
+ wcwidth,
+ wmemchr,
+ wmemmove,
+ wungettok,
+ wungettok_r,
+ y0,
+ y1,
+ yn,
+ NXClose,
+ NXCondAlloc,
+ NXCondBroadcast,
+ NXCondDeinit,
+ NXCondFree,
+ NXCondInit,
+ NXCondSignal,
+ NXCondTimedWait,
+ NXCondWait,
+ NXContextAlloc,
+ NXContextFree,
+ NXContextGet,
+ NXContextGetInfo,
+ NXContextGetName,
+ NXContextReinit,
+ NXContextSetName,
+ NXCreatePathContext,
+ NXDelayedWorkSchedule,
+ NXDeviceOpen,
+ NXDirCreate,
+ NXDirEnumEnd,
+ NXDirEnumGetEntries,
+ NXDirEnumStart,
+ NXDirMarkInit,
+ NXDirRemove,
+ NXFifoOpen,
+ NXFileCancelIo,
+ NXFileFlushBuffers,
+ NXFileGetAttributesWithHandle,
+ NXFileGetLength,
+ NXFileGetLengthWithHandle,
+ NXFileOpen,
+ NXFileOpenEx,
+ NXFileRangeLock,
+ NXFileRangeUnlock,
+ NXFileRemoveWithHandle,
+ NXFileRenameWithHandle,
+ NXFileSetAttributesWithHandle,
+ NXFileSetLength,
+ NXFileSetLengthWithHandle,
+ NXFindDeinit,
+ NXFindEntry,
+ NXFindInit,
+ NXFreePathContext,
+ NXGetAttr,
+ NXGetAttrWithHandle,
+ NXGetAttributes,
+ NXGetCacheLineSize,
+ NXGetCpuCount,
+ NXGetCpuId,
+ NXGetNKSVersion,
+ NXGetPageSize,
+ NXGetSystemTick,
+ NXGetTime,
+ NXIoGetOpenMode,
+ NXIoSetBlockingState,
+ NXKeyCreate,
+ NXKeyDelete,
+ NXKeyGetValue,
+ NXKeySetValue,
+ NXLock,
+ NXLwWorkCancel,
+ NXLwWorkSchedule,
+ NXMemAlloc,
+ NXMemCtl,
+ NXMemFree,
+ NXMemRealloc,
+ NXMutexAlloc,
+ NXMutexDeinit,
+ NXMutexDepth,
+ NXMutexFree,
+ NXMutexInit,
+ NXMutexIsOwned,
+ NXMutexTestFlag,
+ NXPageAlloc,
+ NXPageFree,
+ NXProcessInterruptSet,
+ NXRdLock,
+ NXRead,
+ NXReadEx,
+ NXRemove,
+ NXRename,
+ NXRwLockAlloc,
+ NXRwLockDeinit,
+ NXRwLockDowngrade,
+ NXRwLockFree,
+ NXRwLockInit,
+ NXRwLockIsOwned,
+ NXRwLockUpgrade,
+ NXRwUnlock,
+ NXSeedRandom,
+ NXSemaAlloc,
+ NXSemaDeinit,
+ NXSemaFree,
+ NXSemaInit,
+ NXSemaPost,
+ NXSemaTryWait,
+ NXSemaWait,
+ NXSetAttr,
+ NXSetAttrWithHandle,
+ NXSetAttributes,
+ NXStrError,
+ NXThreadBind,
+ NXThreadContinue,
+ NXThreadCreate,
+ NXThreadCreateSx,
+ NXThreadDelay,
+ NXThreadDestroy,
+ NXThreadDetach,
+ NXThreadExit,
+ NXThreadGetBinding,
+ NXThreadGetContext,
+ NXThreadGetId,
+ NXThreadGetPriority,
+ NXThreadInterrupt,
+ NXThreadIsInterrupted,
+ NXThreadJoin,
+ NXThreadSetPriority,
+ NXThreadSuspend,
+ NXThreadSwapContext,
+ NXThreadUnbind,
+ NXThreadYield,
+ NXTimeOutCancel,
+ NXTimeOutSchedule,
+ NXTryLock,
+ NXTryRdLock,
+ NXTryWrLock,
+ NXUnlock,
+ NXVmDestroy,
+ NXVmExit,
+ NXVmGetId,
+ NXVmGetWorkerThreadConfig,
+ NXVmGetStringType,
+ NXVmJoin,
+ NXVmRegisterExitHandler,
+ NXVmSetWorkerThreadConfig,
+ NXVmSpawn,
+ NXVmUnregisterExitHandler,
+ NXWorkCancel,
+ NXWorkSchedule,
+ NXWrLock,
+ NXWrite,
+ NXWriteEx,
+ _set_vm_context,
+ nxAddTrustee,
+ nxCancelCheck,
+ nxCancelDisable,
+ nxCancelEnable,
+ nxDeleteTrustee,
+ nxExportInterface,
+ nxExportInterfaceWrapped,
+ nxGetEnviron,
+ nxScanTrustees,
+ nxThreadCreate,
+ nxUnexportInterfaceWrapped,
+ (LIBC)
+ LocToUniSize,
+ LocToUniTagFunc,
+ LocToUtf8Size,
+ UniDisposeTable,
+ UniGetHostCodePage,
+ UniGetMacintoshTable,
+ UniGetTable,
+ UniSetDefault,
+ UniToLocSize,
+ UniToUtf8Size,
+ UniToLocTagFunc,
+ Utf8ToLocSize,
+ Utf8ToUniSize,
+ asc2uni,
+ ascn2uni,
+ chr2lwr,
+ chr2upr,
+ dbcs_width,
+ loc2uni,
+ loc2unipath,
+ loc2utf8,
+ loc2utf8path,
+ locn2uni,
+ locn2unispecial,
+ locn2unispecial_legacy,
+ locn2utf8,
+ locnp2uni,
+ locnp2uni_nonull,
+ locnx2uni,
+ uni2asc,
+ uni2loc,
+ uni2locpath,
+ uni2lwr,
+ uni2mono,
+ uni2upr,
+ uni2utf8,
+ uni2utf8path,
+ unicase,
+ unicat,
+ unichr,
+ unicmp,
+ unicoll,
+ unicpy,
+ unicspn,
+ unidup,
+ uniicmp,
+ uniindex,
+ unilen,
+ unilist,
+ unilwr,
+ unin2asc,
+ unin2loc,
+ unin2locspecial,
+ unin2locspecial_legacy,
+ unin2lwr,
+ unin2mono,
+ unin2title,
+ unin2upr,
+ unin2utf8,
+ unincat,
+ unincmp,
+ unincoll,
+ unincpy,
+ uninicmp,
+ uninlen,
+ uninset,
+ uninp2loc,
+ uninp2loc_nonull,
+ uninx2loc,
+ unipbrk,
+ unirchr,
+ unirev,
+ uniset,
+ unisize,
+ unispn,
+ unistr,
+ unitok,
+ unitok_r,
+ unitype,
+ uniupr,
+ utf82loc,
+ utf82uni,
+ utf8n2loc,
+ utf8n2uni,
+ utf8nx2loc,
+ FreeLibrary,
+ GetLastError,
+ LoadLibrary,
+ SetLastError,
+ __isleap,
+ _exit,
+ _fildes_from_nsskey,
+ _fildes_type,
+ _fs_type,
+ abort,
+ accept,
+ access,
+ asctime,
+ asctime_r,
+ atexit,
+ barrier_dec,
+ barrier_destroy,
+ barrier_inc,
+ barrier_init,
+ barrier_wait,
+ bind,
+ brk,
+ build_username,
+ calendar2dos,
+ calloc,
+ cancel,
+ catclose,
+ catgets,
+ catopen,
+ cgetc,
+ cgets,
+ chdir,
+ chdir2,
+ chmod,
+ chsize,
+ chsize64,
+ clearenv,
+ clearerr,
+ clearscreen,
+ clock,
+ close,
+ close_ncp_session,
+ closedir,
+ closedir64,
+ closelog,
+ cond_broadcast,
+ cond_destroy,
+ cond_init,
+ cond_signal,
+ cond_timedwait,
+ cond_wait,
+ connect,
+ consoleprintf,
+ cprintf,
+ cputc,
+ cputs,
+ creat,
+ create_identity,
+ create_server_identity,
+ crypt,
+ cscanf,
+ ctime,
+ ctime_r,
+ delay,
+ delete_identity,
+ derivelocale,
+ dfs_close,
+ dfs_creat,
+ dfs_extend,
+ dfs_freelimbospace,
+ dfs_getfilemapinfo,
+ dfs_getvolblockinfo,
+ dfs_getvolmapinfo,
+ dfs_read,
+ dfs_readnowait,
+ dfs_seteof,
+ dfs_setlength,
+ dfs_sopen,
+ dfs_write,
+ dfs_writenowait,
+ difftime,
+ dos2calendar,
+ dup,
+ dup2,
+ encrypt,
+ eof,
+ exit,
+ fchdir,
+ fchmod,
+ fclose,
+ fcntl,
+ fdatasync,
+ fdopen,
+ feof,
+ ferror,
+ fflush,
+ fgetc,
+ fgetpos,
+ fgetpos64,
+ fgets,
+ fgetstat,
+ fgetwc,
+ fgetws,
+ fileno,
+ findnlmhandle,
+ flockfile,
+ flushenv,
+ fnmatch,
+ fopen,
+ fork,
+ fprintf,
+ fputc,
+ fputs,
+ fputwc,
+ fputws,
+ fread,
+ free,
+ freopen,
+ fscanf,
+ fscopy,
+ fseek,
+ fseek64,
+ fsetpos,
+ fsetpos64,
+ fstat,
+ fstatfs,
+ fsync,
+ ftell,
+ ftell64,
+ ftok,
+ ftruncate,
+ ftruncate64,
+ ftrylockfile,
+ funlockfile,
+ fwide,
+ fwprintf,
+ fwrite,
+ fwscanf,
+ get_identity,
+ getalternateconsole,
+ getbsize,
+ getc,
+ getc_unlocked,
+ getchar,
+ getchar_unlocked,
+ getcharacter,
+ getcmd,
+ getconsolehandle,
+ getcwd,
+ getcwdpath,
+ getdtablehi,
+ getdtablesize,
+ getegid,
+ getenv,
+ geteuid,
+ getgid,
+ getgrgid,
+ getgrnam,
+ gethostbyaddr,
+ gethostbyname,
+ gethostname,
+ getkey,
+ getnetwareconsole,
+ getnetwarelogger,
+ getpassword,
+ getpeername,
+ getpgrp,
+ getpid,
+ getppid,
+ getprotobyname,
+ getprotobynumber,
+ getpwnam,
+ getpwuid,
+ gets,
+ getscreenhandle,
+ getscreenmode,
+ getservbyname,
+ getservbyport,
+ getsockname,
+ getsockopt,
+ getstat,
+ getstat_with_namespace,
+ getstring,
+ getw,
+ gettimeofday,
+ getuid,
+ getwc,
+ getwchar,
+ glob,
+ globfree,
+ gmtime,
+ gmtime_r,
+ gotorowcol,
+ htonl,
+ htons,
+ iconv,
+ iconv_close,
+ iconv_open,
+ inet_addr,
+ inet_aton,
+ inet_ntoa,
+ ioctl,
+ is_valid_identity,
+ isatty,
+ kbhit,
+ kill,
+ listen,
+ localeconv,
+ localtime,
+ localtime_r,
+ lseek,
+ lseek64,
+ lstat,
+ ltime,
+ madvise,
+ malloc,
+ max,
+ mblen,
+ mbstowcs,
+ mbtowc,
+ mincore,
+ mkdir,
+ mkfifo,
+ mkgmtime,
+ mknod,
+ mktime,
+ mlock,
+ mlockall,
+ mmap,
+ mmap64,
+ mprotect,
+ msize,
+ msync,
+ munlock,
+ munlockall,
+ munmap,
+ mutex_destroy,
+ mutex_init,
+ mutex_lock,
+ mutex_trylock,
+ mutex_unlock,
+ mvalidrange,
+ nanosleep,
+ nl_langinfo,
+ ntohl,
+ ntohs,
+ open,
+ open_ncp_session,
+ opendir,
+ opendir64,
+ openlog,
+ pclose,
+ perror,
+ pipe,
+ pipe_open,
+ pipe_select,
+ popen,
+ pread,
+ pread64,
+ pressanykey,
+ pressenter,
+ pressescape,
+ printf,
+ processle,
+ processve,
+ procle,
+ procve,
+ pthread_atfork,
+ pthread_attr_destroy,
+ pthread_attr_getdetachstate,
+ pthread_attr_getinheritsched,
+ pthread_attr_getname_np,
+ pthread_attr_getschedparam,
+ pthread_attr_getschedpolicy,
+ pthread_attr_getscope,
+ pthread_attr_getstackaddr,
+ pthread_attr_getstacksize,
+ pthread_attr_init,
+ pthread_attr_setdetachstate,
+ pthread_attr_setinheritsched,
+ pthread_attr_setname_np,
+ pthread_attr_setschedparam,
+ pthread_attr_setschedpolicy,
+ pthread_attr_setscope,
+ pthread_attr_setstackaddr,
+ pthread_attr_setstacksize,
+ pthread_cancel,
+ pthread_cleanup_pop,
+ pthread_cleanup_push,
+ pthread_cond_broadcast,
+ pthread_cond_destroy,
+ pthread_cond_init,
+ pthread_cond_signal,
+ pthread_cond_timedwait,
+ pthread_cond_wait,
+ pthread_condattr_destroy,
+ pthread_condattr_getpshared,
+ pthread_condattr_init,
+ pthread_condattr_setpshared,
+ pthread_create,
+ pthread_detach,
+ pthread_equal,
+ pthread_exit,
+ pthread_getschedparam,
+ pthread_getspecific,
+ pthread_join,
+ pthread_key_create,
+ pthread_key_delete,
+ pthread_kill,
+ pthread_mutex_destroy,
+ pthread_mutex_init,
+ pthread_mutex_lock,
+ pthread_mutex_trylock,
+ pthread_mutex_unlock,
+ pthread_mutexattr_destroy,
+ pthread_mutexattr_getprioceiling,
+ pthread_mutexattr_getprotocol,
+ pthread_mutexattr_getpshared,
+ pthread_mutexattr_gettype,
+ pthread_mutexattr_init,
+ pthread_mutexattr_setprioceiling,
+ pthread_mutexattr_setprotocol,
+ pthread_mutexattr_setpshared,
+ pthread_mutexattr_settype,
+ pthread_once,
+ pthread_rwlock_destroy,
+ pthread_rwlock_init,
+ pthread_rwlock_rdlock,
+ pthread_rwlock_timedrdlock,
+ pthread_rwlock_timedwrlock,
+ pthread_rwlock_tryrdlock,
+ pthread_rwlock_trywrlock,
+ pthread_rwlock_unlock,
+ pthread_rwlock_wrlock,
+ pthread_rwlockattr_destroy,
+ pthread_rwlockattr_getpshared,
+ pthread_rwlockattr_init,
+ pthread_rwlockattr_setpshared,
+ pthread_self,
+ pthread_setcancelstate,
+ pthread_setcanceltype,
+ pthread_setschedparam,
+ pthread_setspecific,
+ pthread_sigmask,
+ pthread_testcancel,
+ pthread_yield,
+ purgeerasedfile,
+ putc,
+ putc_unlocked,
+ putchar,
+ putchar_unlocked,
+ putcharacter,
+ putenv,
+ puts,
+ putstring,
+ putwc,
+ putwchar,
+ pwrite,
+ pwrite64,
+ raise,
+ rand,
+ rand_r,
+ read,
+ readdir,
+ readdir64,
+ readdir_r,
+ readlink,
+ readv,
+ realloc,
+ realname,
+ recv,
+ recvfrom,
+ recvmsg,
+ regcomp,
+ regerror,
+ regexec,
+ regfree,
+ remove,
+ rename,
+ renamescreen,
+ rewind,
+ rewinddir,
+ rewinddir64,
+ ringbell,
+ rmdir,
+ rw_rdlock,
+ rw_tryrdlock,
+ rw_trywrlock,
+ rw_unlock,
+ rw_wrlock,
+ rwlock_destroy,
+ rwlock_init,
+ salvageerasedfile,
+ sbrk,
+ scanerasedfiles,
+ scanf,
+ sched_get_priority_max,
+ sched_get_priority_min,
+ sched_getparam,
+ sched_getscheduler,
+ sched_rr_get_interval,
+ sched_setparam,
+ sched_setscheduler,
+ sched_yield,
+ screenprintf,
+ select,
+ sem_destroy,
+ sem_getvalue,
+ sem_init,
+ sem_post,
+ sem_timedwait,
+ sem_trywait,
+ sem_wait,
+ sema_destroy,
+ sema_init,
+ sema_post,
+ sema_trywait,
+ sema_wait,
+ semctl,
+ semget,
+ semop,
+ send,
+ send_ncp,
+ sendfile,
+ sendmsg,
+ sendto,
+ set_pathname_format,
+ setbuf,
+ setcwd,
+ setcwd2,
+ setenv,
+ setgid,
+ setkey,
+ setlocale,
+ setlocale_r,
+ setlogmask,
+ setmode,
+ setpgid,
+ setscreenmode,
+ setsid,
+ setsockopt,
+ settimeofday,
+ setuid,
+ setvbuf,
+ shmat,
+ shmctl,
+ shmdt,
+ shmget,
+ shutdown,
+ sigaction,
+ sigaddset,
+ sigdelset,
+ sigemptyset,
+ sigfillset,
+ sigismember,
+ signal,
+ sigpending,
+ sigprocmask,
+ sigsuspend,
+ sigwait,
+ sleep,
+ snprintf,
+ socket,
+ sopen,
+ sprintf,
+ srand,
+ sscanf,
+ stackavail,
+ stackbase,
+ stat,
+ stat64,
+ statfs,
+ strcoll,
+ strdup,
+ strerror,
+ strerror_r,
+ strftime,
+ strftime_r,
+ strtok,
+ strxfrm,
+ swprintf,
+ swscanf,
+ sync,
+ syslog,
+ tcgetattr,
+ tcsetattr,
+ tell,
+ tell64,
+ tempnam,
+ thr_continue,
+ thr_create,
+ thr_exit,
+ thr_getconcurrency,
+ thr_getprio,
+ thr_getspecific,
+ thr_join,
+ thr_keycreate,
+ thr_minstack,
+ thr_self,
+ thr_setconcurrency,
+ thr_setprio,
+ thr_setspecific,
+ thr_sigsetmask,
+ thr_suspend,
+ thr_yield,
+ time,
+ times,
+ tmpfile,
+ tmpnam,
+ ttyname,
+ ttyname_r,
+ tzset,
+ umask,
+ uname,
+ ungetc,
+ ungetcharacter,
+ ungetkey,
+ ungettok,
+ ungetwc,
+ unlink,
+ unsetenv,
+ usleep,
+ utime,
+ vasprintf,
+ vconsoleprintf,
+ vcprintf,
+ vcscanf,
+ vfprintf,
+ vfscanf,
+ vfwprintf,
+ vfwscanf,
+ vprintf,
+ vscanf,
+ vscreenprintf,
+ vsnprintf,
+ vsprintf,
+ vsscanf,
+ vswprintf,
+ vswscanf,
+ vwprintf,
+ vwscanf,
+ wait,
+ waitpid,
+ want_posix_semantics,
+ wcstombs,
+ wctomb,
+ wherecol,
+ whererow,
+ whererowcol,
+ wmemcmp,
+ wmemcpy,
+ wmemset,
+ wprintf,
+ write,
+ writev,
+ wscanf,
+ xcalloc,
+ xfree,
+ xmalloc,
+ xrealloc

+ 9274 - 0
rtl/netwlibc/libc.pp

@@ -0,0 +1,9274 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2004 Armin Diehl, member of the Free Pascal
+    development team
+
+    Interface to Netware libc
+
+    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.
+
+ **********************************************************************}
+
+
+
+{$ifndef INCLUDED_FROM_SYSTEM}
+{$mode objfpc}
+unit libc;
+interface
+
+{ Netware libc interface
+  Translated from c ndk Armin Diehl 2004/09/02 }
+{$endif}
+
+const
+  libc_nlm='libc';
+  system_nlm='!netware';
+
+{ Pointers to basic pascal types, inserted by h2pas conversion program.}
+Type
+{$ifndef INCLUDED_FROM_SYSTEM}
+  PLongint  = ^Longint;
+  PSmallInt = ^SmallInt;
+  PByte     = ^Byte;
+  PWord     = ^Word;
+  PDWord    = ^DWord;
+  PDouble   = ^Double;
+{$endif}
+  PPPChar   = ^PPChar;
+  void      = pointer;
+  cint      = longint;
+
+{$PACKRECORDS C}
+
+// string.h
+// limits.h
+
+{ some limits wanted by POSIX...  }
+{ exact-width signed types...  }
+type
+
+   Pint8_t = ^int8_t;
+   int8_t = char;
+
+   Pint16_t = ^int16_t;
+   int16_t = smallint;
+
+   Pint64_t = ^int64_t;
+   int64_t = int64;
+{ exact-width unsigned types...  }
+
+   Puint64_t = ^uint64_t;
+   uint64_t = qword;
+{ lower and upper bound of exact width integer types...  }
+{ macros for minimum-width integer constants...  }
+{ minimum-width signed integer types...  }
+
+   Pint_least8_t = ^int_least8_t;
+   int_least8_t = char;
+
+   Pint_least16_t = ^int_least16_t;
+   int_least16_t = smallint;
+
+   Pint_least32_t = ^int_least32_t;
+   int_least32_t = longint;
+
+   Pint_least64_t = ^int_least64_t;
+   int_least64_t = int64;
+{ minimum-width unsigned integer types...  }
+
+   Puint_least8_t = ^uint_least8_t;
+   uint_least8_t = byte;
+
+   Puint_least16_t = ^uint_least16_t;
+   uint_least16_t = word;
+
+   Puint_least32_t = ^uint_least32_t;
+   uint_least32_t = dword;
+
+   Puint_least64_t = ^uint_least64_t;
+   uint_least64_t = qword;
+{ lower and upper bound of exact width integer types...  }
+{ fastest minimum-width signed integer types...  }
+
+   Pint_fast8_t = ^int_fast8_t;
+   int_fast8_t = char;
+
+   Pint_fast16_t = ^int_fast16_t;
+   int_fast16_t = smallint;
+
+   Pint_fast32_t = ^int_fast32_t;
+   int_fast32_t = longint;
+
+   Pint_fast64_t = ^int_fast64_t;
+   int_fast64_t = int64;
+{ fastest minimum-width unsigned integer types...  }
+
+   Puint_fast8_t = ^uint_fast8_t;
+   uint_fast8_t = byte;
+
+   Puint_fast16_t = ^uint_fast16_t;
+   uint_fast16_t = word;
+
+   Puint_fast32_t = ^uint_fast32_t;
+   uint_fast32_t = dword;
+
+   Puint_fast64_t = ^uint_fast64_t;
+   uint_fast64_t = qword;
+{ lower and upper bound of fastest minimum-width integer types...  }
+{ integer types capable of holding object pointer...  }
+
+   Pintptr_t = ^intptr_t;
+   intptr_t = longint;
+
+   Puintptr_t = ^uintptr_t;
+   uintptr_t = dword;
+{ limit of integer type capable of holding object pointer...  }
+{ maximum-width integer types...  }
+
+   Pintmax_t = ^intmax_t;
+   intmax_t = int64_t;
+
+   Puintmax_t = ^uintmax_t;
+   uintmax_t = uint64_t;
+{ macros for maximum-width integer constants...  }
+{ limits for other integer types...  }
+
+   Psize_t = ^size_t;
+   size_t = dword;
+{ type yielded by sizeof()  }
+
+   Pssize_t = ^ssize_t;
+   ssize_t = longint;
+{ signed byte counts for file I/O  }
+
+   Psize64_t = ^size64_t;
+   size64_t = uint64_t;
+{ used for 64-bit (long) file I/O  }
+
+   Pmode_t = ^mode_t;
+   mode_t = dword;
+{ file attributes, permissions  }
+
+   Poff_t = ^off_t;
+   off_t = longint;
+{ file offset value  }
+
+   Poff64_t = ^off64_t;
+   off64_t = int64_t;
+{ 64-bit (long) file offset value  }
+
+   Pino_t = ^ino_t;
+   ino_t = uint64_t;
+
+   Ppid_t = ^pid_t;
+   pid_t = longint;
+{ capable of holding a pointer or -1  }
+
+   Puid_t = ^uid_t;
+   uid_t = uint64_t;
+
+   Pgid_t = ^gid_t;
+   gid_t = uint64_t;
+
+   Pblksize_t = ^blksize_t;
+   blksize_t = uint64_t;
+
+   Pblkcnt_t = ^blkcnt_t;
+   blkcnt_t = uint64_t;
+
+   Pdev_t = ^dev_t;
+   dev_t = uint64_t;
+
+   Pnlink_t = ^nlink_t;
+   nlink_t = dword;
+
+   Pptrdiff_t = ^ptrdiff_t;
+   ptrdiff_t = longint;
+{ difference of two pointers  }
+{ everybody else until we hear differently...  }
+{ everybody else until we hear differently...  }
+
+   Pwchar_t = ^wchar_t;
+   wchar_t = word;
+   PPwchar_t = ^Pwchar_t;
+{-----------------------------------------------------------------------------
+** Definitions for the 'restrict' keyword which not all platforms support.
+ }
+{ consume the 'restrict' keyword as '__restrict'  }
+{-----------------------------------------------------------------------------
+ }
+{ prototypes for functions standard and nonstandard...  }
+
+
+function memchr(_para1:pointer; _para2:longint; _para3:size_t):pointer;cdecl;external libc_nlm name 'memchr';
+
+
+function memcmp(_para1:pointer; _para2:pointer; _para3:size_t):longint;cdecl;external libc_nlm name 'memcmp';
+
+function memcpy(__restrict:pointer; __restrict1:pointer; _para3:size_t):pointer;cdecl;external libc_nlm name 'memcpy';
+
+function memmove(_para1:pointer; _para2:pointer; _para3:size_t):pointer;cdecl;external libc_nlm name 'memmove';
+function memset(_para1:pointer; _para2:longint; _para3:size_t):pointer;cdecl;external libc_nlm name 'memset';
+
+
+function strcasecmp(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'strcasecmp';
+
+function strcat(__restrict:Pchar; __restrict1:Pchar):Pchar;cdecl;external libc_nlm name 'strcat';
+
+function strchr(_para1:Pchar; _para2:longint):Pchar;cdecl;external libc_nlm name 'strchr';
+
+
+function strcmp(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'strcmp';
+
+
+function strcoll(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'strcoll';
+
+function strcpy(__restrict:Pchar; __restrict1:Pchar):Pchar;cdecl;external libc_nlm name 'strcpy';
+
+
+function strcspn(_para1:Pchar; _para2:Pchar):size_t;cdecl;external libc_nlm name 'strcspn';
+function strerror(_para1:longint):Pchar;cdecl;external libc_nlm name 'strerror';
+
+function strlcat(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):size_t;cdecl;external libc_nlm name 'strlcat';
+
+function strlcpy(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):size_t;cdecl;external libc_nlm name 'strlcpy';
+
+function {$ifdef INCLUDED_FROM_SYSTEM}libc_strlen{$else}strlen{$endif}(_para1:Pchar):size_t;cdecl;external libc_nlm name 'strlen';
+
+
+function strncasecmp(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'strncasecmp';
+
+function strncat(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):Pchar;cdecl;external libc_nlm name 'strncat';
+
+
+function strncmp(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'strncmp';
+
+
+function strncoll(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'strncoll';
+
+function strncpy(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):Pchar;cdecl;external libc_nlm name 'strncpy';
+
+
+function strnicmp(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'strnicmp';
+function strnset(_para1:Pchar; _para2:longint; _para3:size_t):Pchar;cdecl;external libc_nlm name 'strnset';
+function strpbrk(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'strpbrk';
+function strrchr(_para1:Pchar; _para2:longint):Pchar;cdecl;external libc_nlm name 'strrchr';
+function strrev(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'strrev';
+function strset(_para1:Pchar; _para2:longint):Pchar;cdecl;external libc_nlm name 'strset';
+function strspn(_para1:Pchar; _para2:Pchar):size_t;cdecl;external libc_nlm name 'strspn';
+function strstr(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'strstr';
+function strtok(__restrict:Pchar; __restrict1:Pchar):Pchar;cdecl;external libc_nlm name 'strtok';
+function strxfrm(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):size_t;cdecl;external libc_nlm name 'strxfrm';
+{ POSIX and other functions...  }
+
+function strtok_r(__restrict:Pchar; __restrict1:Pchar; __restrict2:PPchar):Pchar;cdecl;external libc_nlm name 'strtok_r';
+function memicmp(_para1:pointer; _para2:pointer; _para3:size_t):longint;cdecl;external libc_nlm name 'memicmp';
+function stpcpy(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'stpcpy';
+function stricmp(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'stricmp';
+function strdup(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'strdup';
+function strecpy(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'strecpy';
+function strerror_r(_para1:longint; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'strerror_r';
+
+{$ifndef DisableArrayOfConst}
+function strlist(_para1:Pchar; _para2:Pchar; args:array of const):Pchar;cdecl;external libc_nlm name 'strlist';
+{$endif}
+function strlist(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'strlist';
+function strlwr(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'strlwr';
+function strrindex(_para1:Pchar; _para2:size_t; _para3:longint):Pchar;cdecl;external libc_nlm name 'strrindex';
+function strwhich(_para1:Pchar; _para2:longint; _para3:Pchar):Pchar;cdecl;external libc_nlm name 'strwhich';
+function strupr(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'strupr';
+procedure swab(_para1:pointer; _para2:pointer; _para3:size_t);cdecl;external libc_nlm name 'swab';
+procedure swaw(_para1:pointer; _para2:pointer; _para3:size_t);cdecl;external libc_nlm name 'swaw';
+procedure ungettok(__restrict:Pchar; __restrict1:Pchar);cdecl;external libc_nlm name 'ungettok';
+procedure ungettok_r(__restrict:Pchar; __restrict1:Pchar; __restrict2:PPchar);cdecl;external libc_nlm name 'ungettok_r';
+{ multibyte (double) interfaces for locale code page work...  }
+function Lstrbcpy(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):Pchar;cdecl;external libc_nlm name 'Lstrbcpy';
+function Lstrchr(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrchr';
+function Lstrcmp(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'Lstrcmp';
+function Lstrcoll(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'Lstrcoll';
+function Lstrcspn(_para1:Pchar; _para2:Pchar):size_t;cdecl;external libc_nlm name 'Lstrcspn';
+function Lstricmp(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'Lstricmp';
+function Lstrlen(_para1:Pchar):size_t;cdecl;external libc_nlm name 'Lstrlen';
+function Lstrlwr(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrlwr';
+function Lstrncat(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):Pchar;cdecl;external libc_nlm name 'Lstrncat';
+function Lstrncmp(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'Lstrncmp';
+function Lstrncoll(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'Lstrncoll';
+function Lstrncpy(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):Pchar;cdecl;external libc_nlm name 'Lstrncpy';
+function Lstrnicmp(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'Lstrnicmp';
+function Lstrpbrk(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrpbrk';
+function Lstrrchr(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrrchr';
+function Lstrrev(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrrev';
+function Lstrspn(_para1:Pchar; _para2:Pchar):size_t;cdecl;external libc_nlm name 'Lstrspn';
+function Lstrstr(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrstr';
+function Lstrtok_r(__restrict:Pchar; __restrict1:Pchar; __restrict2:PPchar):Pchar;cdecl;external libc_nlm name 'Lstrtok_r';
+function Lstrupr(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'Lstrupr';
+function Lstrxfrm(__restrict:Pchar; __restrict1:Pchar; _para3:size_t):size_t;cdecl;external libc_nlm name 'Lstrxfrm';
+{ length-preceeded string manipulation...  }
+function ASCIIZToLenStr(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'ASCIIZToLenStr';
+function ASCIIZToMaxLenStr(_para1:Pchar; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'ASCIIZToMaxLenStr';
+function LenStrCat(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'LenStrCat';
+function LenStrCmp(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'LenStrCmp';
+function LenStrCpy(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'LenStrCpy';
+function LenToASCIIZStr(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'LenToASCIIZStr';
+function strindex(_para1:Pchar; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'strindex';
+
+
+// stdarg.h
+
+  const
+     //EOF = -(1);
+     BUFSIZ = 8096;           { default buffer size--change with setbuf()  }
+     FOPEN_MAX = 1024;        { at least this many FILEs available         }
+     FILENAME_MAX = 1024;     { maximum characters in any path name        }
+                              { values for argument 'flags' to setvbuf()...}
+     _IONBF = $0010;          { unbuffered (e.g.: stdout and stderr)       }
+     _IOLBF = $0020;          { line buffered (e.g.: stdin)                }
+     _IOFBF = $0040;          { fully buffered (most files)                }
+                              { values for fseek()'s whence argument       }
+     SEEK_SET = 0;            { add 'offset' to beginning of file          }
+     SEEK_CUR = 1;            { add 'offset' to current position in file   }
+     SEEK_END = 2;            { add 'offset' to end of file                }
+                              { definitions for tmpnam() and tmpfil()      }
+     TMP_MAX = 1000000;       { "T-000000.TMP" to "T-999999.TMP"           }
+     L_tmpnam = 36;
+     P_tmpdir = 'sys:/tmp';
+  { FILE type definition (result is opaque)    }
+
+
+type
+
+   Pva_list = ^va_list;
+   va_list = char;
+
+   P_iobuf = ^_iobuf;
+   _iobuf = record
+        reserved : longint;
+     end;
+   TFILE = _iobuf;
+   PFILE = ^TFILE;
+   PPFILE = ^PFILE;
+
+   Pfpos_t = ^fpos_t;
+   fpos_t = longint;
+
+   Pfpos64_t = ^fpos64_t;
+   fpos64_t = off64_t;
+
+procedure clearerr(_para1:PFILE);cdecl;external libc_nlm name 'clearerr';
+function fclose(_para1:PFILE):longint;cdecl;external libc_nlm name 'fclose';
+function feof(_para1:PFILE):longint;cdecl;external libc_nlm name 'feof';
+function ferror(_para1:PFILE):longint;cdecl;external libc_nlm name 'ferror';
+function fflush(_para1:PFILE):longint;cdecl;external libc_nlm name 'fflush';
+function fgetc(_para1:PFILE):longint;cdecl;external libc_nlm name 'fgetc';
+function fgetpos(_para1:PFILE; _para2:Pfpos_t):longint;cdecl;external libc_nlm name 'fgetpos';
+function fgets(_para1:Pchar; _para2:longint; _para3:PFILE):Pchar;cdecl;external libc_nlm name 'fgets';
+
+
+function fopen(__restrict:Pchar; __restrict1:Pchar):PFILE;cdecl;external libc_nlm name 'fopen';
+{$ifndef DisableArrayOfConst}
+function fprintf(__restrict:PFILE; __restrict1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'fprintf';
+{$endif}
+function fprintf(__restrict:PFILE; __restrict1:Pchar):longint;cdecl;external libc_nlm name 'fprintf';
+function fputc(_para1:longint; _para2:PFILE):longint;cdecl;external libc_nlm name 'fputc';
+
+function fputs(__restrict:Pchar; __restrict1:PFILE):longint;cdecl;external libc_nlm name 'fputs';
+function fread(__restrict:pointer; _para2:size_t; _para3:size_t; __restrict1:PFILE):size_t;cdecl;external libc_nlm name 'fread';
+
+
+function freopen(__restrict:Pchar; __restrict1:Pchar; __restrict2:PFILE):PFILE;cdecl;external libc_nlm name 'freopen';
+{$ifndef DisableArrayOfConst}
+function fscanf(__restrict:PFILE; __restrict1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'fscanf';
+{$endif}
+function fscanf(__restrict:PFILE; __restrict1:Pchar):longint;cdecl;external libc_nlm name 'fscanf';
+function fseek(fp:PFILE; offset:longint; whence:longint):longint;cdecl;external libc_nlm name 'fseek';
+
+function fsetpos(_para1:PFILE; _para2:Pfpos_t):longint;cdecl;external libc_nlm name 'fsetpos';
+function ftell(_para1:PFILE):longint;cdecl;external libc_nlm name 'ftell';
+
+function fwrite(__restrict:pointer; _para2:size_t; _para3:size_t; __restrict1:PFILE):size_t;cdecl;external libc_nlm name 'fwrite';
+function getc(_para1:PFILE):longint;cdecl;external libc_nlm name 'getc';
+function getchar:longint;cdecl;external libc_nlm name 'getchar';
+function gets(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'gets';
+procedure {$ifdef INCLUDED_FROM_SYSTEM}libc_perror{$else}perror{$endif}(_para1:Pchar);cdecl;external libc_nlm name 'perror';
+
+{$ifndef DisableArrayOfConst}
+function printf(__restrict:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'printf';
+{$endif}
+function printf(__restrict:Pchar):longint;cdecl;external libc_nlm name 'printf';
+function putc(_para1:longint; _para2:PFILE):longint;cdecl;external libc_nlm name 'putc';
+function putchar(_para1:longint):longint;cdecl;external libc_nlm name 'putchar';
+function puts(_para1:Pchar):longint;cdecl;external libc_nlm name 'puts';
+function remove(_para1:Pchar):longint;cdecl;external libc_nlm name 'remove';
+function rename(_para1:Pchar; _para2:Pchar):longint;cdecl;external libc_nlm name 'rename';
+procedure rewind(_para1:PFILE);cdecl;external libc_nlm name 'rewind';
+
+{$ifndef DisableArrayOfConst}
+function scanf(__restrict:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'scanf';
+{$endif}
+function scanf(__restrict:Pchar):longint;cdecl;external libc_nlm name 'scanf';
+procedure setbuf(__restrict:PFILE; __restrict1:Pchar);cdecl;external libc_nlm name 'setbuf';
+function setvbuf(__restrict:PFILE; __restrict1:Pchar; _para3:longint; _para4:size_t):longint;cdecl;external libc_nlm name 'setvbuf';
+{$ifndef DisableArrayOfConst}
+function sprintf(__restrict:Pchar; __restrict1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'sprintf';
+{$endif}
+function sprintf(__restrict:Pchar; __restrict1:Pchar):longint;cdecl;external libc_nlm name 'sprintf';
+{$ifndef DisableArrayOfConst}
+function snprintf(__restrict:Pchar; n:size_t; __restrict1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'snprintf';
+{$endif}
+function snprintf(__restrict:Pchar; n:size_t; __restrict1:Pchar):longint;cdecl;external libc_nlm name 'snprintf';
+
+{$ifndef DisableArrayOfConst}
+function sscanf(__restrict:Pchar; __restrict1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'sscanf';
+{$endif}
+function sscanf(__restrict:Pchar; __restrict1:Pchar):longint;cdecl;external libc_nlm name 'sscanf';
+function tmpfile:PFILE;cdecl;external libc_nlm name 'tmpfile';
+function tmpnam(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'tmpnam';
+function ungetc(_para1:longint; _para2:PFILE):longint;cdecl;external libc_nlm name 'ungetc';
+
+function vfprintf(__restrict:PFILE; __restrict1:Pchar; _para3:va_list):longint;cdecl;external libc_nlm name 'vfprintf';
+
+function vfscanf(__restrict:PFILE; __restrict1:Pchar; _para3:va_list):longint;cdecl;external libc_nlm name 'vfscanf';
+
+function vprintf(__restrict:Pchar; _para2:va_list):longint;cdecl;external libc_nlm name 'vprintf';
+
+function vscanf(__restrict:Pchar; _para2:va_list):longint;cdecl;external libc_nlm name 'vscanf';
+
+function vsnprintf(__restrict:Pchar; n:size_t; __restrict1:Pchar; _para4:va_list):longint;cdecl;external libc_nlm name 'vsnprintf';
+
+function vsprintf(__restrict:Pchar; __restrict1:Pchar; _para3:va_list):longint;cdecl;external libc_nlm name 'vsprintf';
+
+
+function vsscanf(__restrict:Pchar; __restrict1:Pchar; _para3:va_list):longint;cdecl;external libc_nlm name 'vsscanf';
+{ functions underlying macro support...  }
+function ___stdin:PPFILE;cdecl;external libc_nlm name '___stdin';
+function ___stdout:PPFILE;cdecl;external libc_nlm name '___stdout';
+function ___stderr:PPFILE;cdecl;external libc_nlm name '___stderr';
+function ___cin:PPFILE;cdecl;external libc_nlm name '___cin';
+function ___cout:PPFILE;cdecl;external libc_nlm name '___cout';
+{ POSIX-defined and other additions...  }
+
+function fdopen(_para1:longint; __restrict:Pchar):PFILE;cdecl;external libc_nlm name 'fdopen';
+function fileno(_para1:PFILE):longint;cdecl;external libc_nlm name 'fileno';
+procedure flockfile(_para1:PFILE);cdecl;external libc_nlm name 'flockfile';
+function ftrylockfile(_para1:PFILE):longint;cdecl;external libc_nlm name 'ftrylockfile';
+procedure funlockfile(_para1:PFILE);cdecl;external libc_nlm name 'funlockfile';
+function getc_unlocked(_para1:PFILE):longint;cdecl;external libc_nlm name 'getc_unlocked';
+function getchar_unlocked:longint;cdecl;external libc_nlm name 'getchar_unlocked';
+function getw(_para1:PFILE):longint;cdecl;external libc_nlm name 'getw';
+function pclose(stream:PFILE):longint;cdecl;external libc_nlm name 'pclose';
+
+
+function popen(command:Pchar; mode:Pchar):PFILE;cdecl;external libc_nlm name 'popen';
+function putc_unlocked(c:longint; _para2:PFILE):longint;cdecl;external libc_nlm name 'putc_unlocked';
+function putchar_unlocked(c:longint):longint;cdecl;external libc_nlm name 'putchar_unlocked';
+
+
+function tempnam(dirpath:Pchar; prefix:Pchar):Pchar;cdecl;external libc_nlm name 'tempnam';
+{ nonstandard (transitional) addtions for 64-bit file I/O...  }
+function fgetpos64(_para1:PFILE; _para2:Pfpos64_t):longint;cdecl;external libc_nlm name 'fgetpos64';
+function fseek64(fp:PFILE; offset:fpos64_t; whence:longint):longint;cdecl;external libc_nlm name 'fseek64';
+
+function fsetpos64(_para1:PFILE; _para2:Pfpos64_t):longint;cdecl;external libc_nlm name 'fsetpos64';
+function ftell64(_para1:PFILE):off64_t;cdecl;external libc_nlm name 'ftell64';
+{ hard-wired console I/O support (cannot be redirected)...  }
+function cgetc:longint;cdecl;external libc_nlm name 'cgetc';
+function cgets(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'cgets';
+
+{$ifndef DisableArrayOfConst}
+function cprintf(_para1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'cprintf';
+{$endif}
+function cprintf(_para1:Pchar):longint;cdecl;external libc_nlm name 'cprintf';
+function cputc(_para1:longint):longint;cdecl;external libc_nlm name 'cputc';
+
+function cputs(_para1:Pchar):longint;cdecl;external libc_nlm name 'cputs';
+
+{$ifndef DisableArrayOfConst}
+function cscanf(__restrict:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'cscanf';
+{$endif}
+function cscanf(__restrict:Pchar):longint;cdecl;external libc_nlm name 'cscanf';
+
+function vcprintf(__restrict:Pchar; _para2:va_list):longint;cdecl;external libc_nlm name 'vcprintf';
+
+function vcscanf(__restrict:Pchar; _para2:va_list):longint;cdecl;external libc_nlm name 'vcscanf';
+
+function vasprintf(__restrict:PPchar; __restrict1:Pchar; _para3:va_list):longint;cdecl;external libc_nlm name 'vasprintf';
+{ defined as macros in both C and C++...  }
+{ UNIX 98/POSIX.1-2002 defined additions  }
+
+
+// stdlib.h
+{ pshpack1.h }
+{ turn on 1-byte packing...  }
+
+  const
+     EXIT_FAILURE = -(1);
+     EXIT_SUCCESS = 0;
+     RAND_MAX = 32767;
+
+
+type
+
+   Pdiv_t = ^div_t;
+   div_t = record
+        quot : longint;
+        rem : longint;
+     end;
+
+   Pldiv_t = ^ldiv_t;
+   ldiv_t = record
+        quot : longint;
+        rem : longint;
+     end;
+
+   Plldiv_t = ^lldiv_t;
+   lldiv_t = record
+        quot : int64_t;
+        rem : int64_t;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+type TCDeclProcedure = procedure; cdecl;
+
+procedure abort;cdecl;external libc_nlm name 'abort';
+// function {$ifdef INCLUDED_FROM_SYSTEM}libc_abs{$else}abs{$endif}(_para1:longint):longint;cdecl;external libc_nlm name 'abs';
+function atexit(_para1:TCDeclProcedure ):longint;cdecl;external libc_nlm name 'atexit';
+
+function atof(_para1:Pchar):double;cdecl;external libc_nlm name 'atof';
+
+function atoi(_para1:Pchar):longint;cdecl;external libc_nlm name 'atoi';
+
+function atol(_para1:Pchar):longint;cdecl;external libc_nlm name 'atol';
+
+function atoll(_para1:Pchar):int64_t;cdecl;external libc_nlm name 'atoll';
+
+
+
+
+//!! function bsearch(_para1:pointer; _para2:pointer; _para3:size_t; _para4:size_t; _para5:function (_para1:pointer; _para2:pointer):longint):pointer;cdecl;external libc_nlm name 'bsearch';
+function calloc(_para1:size_t; _para2:size_t):pointer;cdecl;external libc_nlm name 'calloc';
+function __CW_div(_para1:longint; _para2:longint):div_t;cdecl;external libc_nlm name '__CW_div';
+procedure libc_exit(status:longint);cdecl;external libc_nlm name 'exit';
+procedure free(_para1:pointer);cdecl;external libc_nlm name 'free';
+
+function getenv(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'getenv';
+function labs(_para1:longint):longint;cdecl;external libc_nlm name 'labs';
+function __CW_ldiv(_para1:longint; _para2:longint):ldiv_t;cdecl;external libc_nlm name '__CW_ldiv';
+function llabs(_para1:int64_t):int64_t;cdecl;external libc_nlm name 'llabs';
+function __CW_lldiv(_para1:int64_t; _para2:int64_t):lldiv_t;cdecl;external libc_nlm name '__CW_lldiv';
+function malloc(_para1:size_t):pointer;cdecl;external libc_nlm name 'malloc';
+function mblen(_para1:Pchar; _para2:size_t):longint;cdecl;external libc_nlm name 'mblen';
+function mbstowcs(_para1:Pwchar_t; _para2:Pchar; _para3:size_t):size_t;cdecl;external libc_nlm name 'mbstowcs';
+function mbtowc(_para1:Pwchar_t; _para2:Pchar; _para3:size_t):longint;cdecl;external libc_nlm name 'mbtowc';
+
+type TQSortFunc = function (_para1:pointer; _para2:pointer):longint; cdecl;
+procedure qsort(_para1:pointer; _para2:size_t; _para3:size_t; _para4:TQSortFunc);cdecl;external libc_nlm name 'qsort';
+function rand:longint;cdecl;external libc_nlm name 'rand';
+function realloc(_para1:pointer; _para2:size_t):pointer;cdecl;external libc_nlm name 'realloc';
+procedure srand(_para1:dword);cdecl;external libc_nlm name 'srand';
+function strtod(__restrict:Pchar; __restrict1:PPchar):double;cdecl;external libc_nlm name 'strtod';
+function strtol(__restrict:Pchar; __restrict1:PPchar; _para3:longint):longint;cdecl;external libc_nlm name 'strtol';
+function strtoll(__restrict:Pchar; __restrict1:PPchar; _para3:longint):int64_t;cdecl;external libc_nlm name 'strtoll';
+function strtoul(__restrict:Pchar; __restrict1:PPchar; _para3:longint):dword;cdecl;external libc_nlm name 'strtoul';
+function strtoull(__restrict:Pchar; __restrict1:PPchar; _para3:longint):uint64_t;cdecl;external libc_nlm name 'strtoull';
+function system(_para1:Pchar):longint;cdecl;external libc_nlm name 'system';
+function wcstombs(__restrict:Pchar; __restrict1:Pwchar_t; _para3:size_t):size_t;cdecl;external libc_nlm name 'wcstombs';
+function wctomb(_para1:Pchar; _para2:wchar_t):longint;cdecl;external libc_nlm name 'wctomb';
+function alloca(_para1:size_t):pointer;cdecl;external libc_nlm name 'alloca';
+function clearenv:longint;cdecl;external libc_nlm name 'clearenv';
+function getcmd(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'getcmd';
+function flushenv(_para1:Pchar; _para2:longint):longint;cdecl;external libc_nlm name 'flushenv';
+function getbsize(_para1:Plongint; _para2:Plongint):Pchar;cdecl;external libc_nlm name 'getbsize';
+function htol(_para1:Pchar):dword;cdecl;external libc_nlm name 'htol';
+function itoa(_para1:longint; _para2:Pchar; _para3:longint):Pchar;cdecl;external libc_nlm name 'itoa';
+function itoab(_para1:dword; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'itoab';
+function ltoa(_para1:longint; _para2:Pchar; _para3:longint):Pchar;cdecl;external libc_nlm name 'ltoa';
+function lltoa(_para1:int64_t; _para2:Pchar; _para3:longint):Pchar;cdecl;external libc_nlm name 'lltoa';
+function _lrotr(_para1:dword; _para2:dword):dword;cdecl;external libc_nlm name '_lrotr';
+function _lrotl(_para1:dword; _para2:dword):dword;cdecl;external libc_nlm name '_lrotl';
+function mkdtemp(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'mkdtemp';
+function mkstemp(_para1:Pchar):longint;cdecl;external libc_nlm name 'mkstemp';
+function mktemp(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'mktemp';
+function msize(_para1:pointer):size_t;cdecl;external libc_nlm name 'msize';
+function multibyte:longint;cdecl;external libc_nlm name 'multibyte';
+function mvalidrange(_para1:pointer; _para2:size_t):longint;cdecl;external libc_nlm name 'mvalidrange';
+function nextmb(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'nextmb';
+function prevmb(_para1:Pchar):Pchar;cdecl;external libc_nlm name 'prevmb';
+function putenv(_para1:Pchar):longint;cdecl;external libc_nlm name 'putenv';
+function rand_r(_para1:Pdword):longint;cdecl;external libc_nlm name 'rand_r';
+function _rotr(_para1:dword; _para2:dword):dword;cdecl;external libc_nlm name '_rotr';
+function _rotl(_para1:dword; _para2:dword):dword;cdecl;external libc_nlm name '_rotl';
+function rotl8(_para1:byte; _para2:longint):byte;cdecl;external libc_nlm name 'rotl8';
+function rotl16(_para1:word; _para2:longint):word;cdecl;external libc_nlm name 'rotl16';
+function rotl32(_para1:dword; _para2:longint):dword;cdecl;external libc_nlm name 'rotl32';
+function rotl64(_para1:uint64_t; _para2:longint):uint64_t;cdecl;external libc_nlm name 'rotl64';
+function rotr8(_para1:byte; _para2:longint):byte;cdecl;external libc_nlm name 'rotr8';
+function rotr16(_para1:word; _para2:longint):word;cdecl;external libc_nlm name 'rotr16';
+function rotr32(_para1:dword; _para2:longint):dword;cdecl;external libc_nlm name 'rotr32';
+function rotr64(_para1:uint64_t; _para2:longint):uint64_t;cdecl;external libc_nlm name 'rotr64';
+function setenv(_para1:Pchar; _para2:Pchar; _para3:longint):longint;cdecl;external libc_nlm name 'setenv';
+procedure setkey(_para1:Pchar);cdecl;external libc_nlm name 'setkey';
+function stackavail:size_t;cdecl;external libc_nlm name 'stackavail';
+function stackbase:pointer;cdecl;external libc_nlm name 'stackbase';
+function stackwatermark:size_t;cdecl;external libc_nlm name 'stackwatermark';
+function strtoi(_para1:Pchar; _para2:longint):longint;cdecl;external libc_nlm name 'strtoi';
+function truncmb(_para1:Pchar; _para2:size_t):Pchar;cdecl;external libc_nlm name 'truncmb';
+function ultoa(_para1:dword; _para2:Pchar; _para3:longint):Pchar;cdecl;external libc_nlm name 'ultoa';
+function ulltoa(_para1:uint64_t; _para2:Pchar; _para3:longint):Pchar;cdecl;external libc_nlm name 'ulltoa';
+function unsetenv(name:Pchar):longint;cdecl;external libc_nlm name 'unsetenv';
+function utoa(_para1:dword; _para2:Pchar; _para3:longint):Pchar;cdecl;external libc_nlm name 'utoa';
+function valuemb(_para1:Pchar):longint;cdecl;external libc_nlm name 'valuemb';
+{ atomic functions...  }
+procedure atomic_add(addr:Pdword; value:dword);cdecl;external libc_nlm name 'atomic_add';
+function atomic_bts(addr:Pdword; offset:dword):dword;cdecl;external libc_nlm name 'atomic_bts';
+function atomic_btr(addr:Pdword; offset:dword):dword;cdecl;external libc_nlm name 'atomic_btr';
+procedure atomic_dec(addr:Pdword);cdecl;external libc_nlm name 'atomic_dec';
+procedure atomic_inc(addr:Pdword);cdecl;external libc_nlm name 'atomic_inc';
+procedure atomic_sub(addr:Pdword; value:dword);cdecl;external libc_nlm name 'atomic_sub';
+function atomic_xchg(addr:Pdword; value:dword):dword;cdecl;external libc_nlm name 'atomic_xchg';
+procedure atomic_or(addr:Pdword; value:dword);cdecl;external libc_nlm name 'atomic_or';
+procedure atomic_xor(addr:Pdword; value:dword);cdecl;external libc_nlm name 'atomic_xor';
+procedure atomic_and(addr:Pdword; value:dword);cdecl;external libc_nlm name 'atomic_and';
+function atomic_xchgadd(addr:Pdword; value:dword):dword;cdecl;external libc_nlm name 'atomic_xchgadd';
+function atomic_cmpxchg(addr:Pdword; cmpvalue:dword; newvalue:dword):dword;cdecl;external libc_nlm name 'atomic_cmpxchg';
+procedure atomic64_inc(addr:Puint64_t);cdecl;external libc_nlm name 'atomic64_inc';
+procedure atomic64_dec(addr:Puint64_t);cdecl;external libc_nlm name 'atomic64_dec';
+procedure atomic64_add(addr:Puint64_t; value:uint64_t);cdecl;external libc_nlm name 'atomic64_add';
+procedure atomic64_sub(addr:Puint64_t; value:uint64_t);cdecl;external libc_nlm name 'atomic64_sub';
+function atomic64_xchg(addr:Puint64_t; value:uint64_t):uint64_t;cdecl;external libc_nlm name 'atomic64_xchg';
+function atomic64_xchgadd(addr:Puint64_t; value:uint64_t):uint64_t;cdecl;external libc_nlm name 'atomic64_xchgadd';
+function atomic64_cmpxchg(addr:Puint64_t; cmpvalue:uint64_t; newvalue:uint64_t):uint64_t;cdecl;external libc_nlm name 'atomic64_cmpxchg';
+{ compiler-specific implementations of alloca()...  }
+function max(a:longint; b:longint):longint;cdecl;external libc_nlm name 'max';
+function min(a:longint; b:longint):longint;cdecl;external libc_nlm name 'min';
+
+
+// stropts.h
+// sys/ioctl.h
+// unistd.h
+// sys/types.h
+
+type
+
+   Puchar_t = ^uchar_t;
+   uchar_t = byte;
+
+   Pushort_t = ^ushort_t;
+   ushort_t = word;
+
+   Puint_t = ^uint_t;
+   uint_t = dword;
+
+   Pulong_t = ^ulong_t;
+   ulong_t = dword;
+
+   Pu_char = ^u_char;
+   u_char = byte;
+
+   Pu_short = ^u_short;
+   u_short = word;
+
+   Pu_int = ^u_int;
+   u_int = dword;
+
+   Pu_long = ^u_long;
+   u_long = dword;
+
+   Pcaddr_t = ^caddr_t;
+   caddr_t = char;
+
+   Puseconds_t = ^useconds_t;
+   useconds_t = uint64_t;
+
+   Psuseconds_t = ^suseconds_t;
+   suseconds_t = int64_t;
+
+   Pu_int8_t = ^u_int8_t;
+   u_int8_t = byte;
+
+   Pu_int16_t = ^u_int16_t;
+   u_int16_t = word;
+
+   Pu_int32_t = ^u_int32_t;
+   u_int32_t = dword;
+
+   Pu_int64_t = ^u_int64_t;
+   u_int64_t = uint64_t;
+
+function getpid:pid_t;cdecl;external libc_nlm name 'getpid';
+function getppid:pid_t;cdecl;external libc_nlm name 'getppid';
+function getuid:uid_t;cdecl;external libc_nlm name 'getuid';
+function geteuid:uid_t;cdecl;external libc_nlm name 'geteuid';
+function getgid:gid_t;cdecl;external libc_nlm name 'getgid';
+function getegid:gid_t;cdecl;external libc_nlm name 'getegid';
+function setuid(uid:uid_t):longint;cdecl;external libc_nlm name 'setuid';
+function setgid(gid:gid_t):longint;cdecl;external libc_nlm name 'setgid';
+function getpgrp:pid_t;cdecl;external libc_nlm name 'getpgrp';
+function setsid:pid_t;cdecl;external libc_nlm name 'setsid';
+function setpgid(pid:pid_t; pgid:pid_t):longint;cdecl;external libc_nlm name 'setpgid';
+
+function FpGetpid:pid_t;cdecl;external libc_nlm name 'getpid';
+function FpGetppid:pid_t;cdecl;external libc_nlm name 'getppid';
+function FpGetuid:uid_t;cdecl;external libc_nlm name 'getuid';
+function FpGeteuid:uid_t;cdecl;external libc_nlm name 'geteuid';
+function FpGetgid:gid_t;cdecl;external libc_nlm name 'getgid';
+function FpGetegid:gid_t;cdecl;external libc_nlm name 'getegid';
+function FpSetuid(uid:uid_t):longint;cdecl;external libc_nlm name 'setuid';
+function FpSetgid(gid:gid_t):longint;cdecl;external libc_nlm name 'setgid';
+function FpSetpgrp:pid_t;cdecl;external libc_nlm name 'getpgrp';
+function FpSetsid:pid_t;cdecl;external libc_nlm name 'setsid';
+function FpSetpgid(pid:pid_t; pgid:pid_t):longint;cdecl;external libc_nlm name 'setpgid';
+
+
+// sys/unistd.h
+
+type
+  TFilDes = Array [0..1] of cInt;
+  pFilDes = ^TFilDes;
+
+  const
+     R_OK = 1;
+  { test for write permission                  }
+     W_OK = 2;
+  { test for execute permission                }
+     X_OK = 4;
+  { test for existence of file                 }
+     F_OK = 8;
+  { values for 'whence' in lseek()...                                  }
+  { set file pointer to 'offset'               }
+    // SEEK_SET = 0;
+  { set file pointer to current plus 'offset'  }
+     // SEEK_CUR = 1;
+  { set file pointer to EOF plus 'offset'      }
+     // SEEK_END = 2;
+  { old Berkeley names...                                              }
+     L_SET = SEEK_SET;
+     L_INCR = SEEK_CUR;
+     L_XTND = SEEK_END;
+  { test using effective ids                   }
+     EFF_ONLY_OK = 8;
+  { descriptor underlying 'stdin'              }
+     STDIN_FILENO = 0;
+  { ibid for 'stdout'                          }
+     STDOUT_FILENO = 1;
+  { ibid for 'stderr'                          }
+     STDERR_FILENO = 2;
+     _POSIX_THREAD_SAFE_FUNCTIONS = 1;
+     _POSIX_THREAD_ATTR_STACKADDR = 1;
+     _POSIX_THREAD_ATTR_STACKSIZE = 1;
+     _POSIX_MAPPED_FILES = 1;
+     _POSIX_MEMLOCK = 1;
+     _POSIX_MEMLOCK_RANGE = 1;
+     _POSIX_MEMORY_PROTECTION = 1;
+     _POSIX_SYNCHRONIZED_IO = 1;
+     _POSIX_FSYNC = 1;
+     _POSIX_ASYNC_IO = -(1);
+     _POSIX_CHOWN_RESTRICTED = -(1);
+     _POSIX_NO_TRUNC = -(1);
+     _POSIX_PRIO_IO = -(1);
+     _POSIX_SYNC_IO = 1;
+     _POSIX_VDISABLE = 0;
+
+
+function access(path:Pchar; mode:longint):longint;cdecl;external libc_nlm name 'access';
+function FpAccess(path:Pchar; mode:longint):longint;cdecl;external libc_nlm name 'access';
+function alarm(seconds:dword):dword;cdecl;external libc_nlm name 'alarm';
+
+function FpChdir(path:Pchar):longint;cdecl;external libc_nlm name 'chdir';
+function {$ifdef INCLUDED_FROM_SYSTEM}libc_chsize{$else}chsize{$endif}(fildes:longint; size:size_t):longint;cdecl;external libc_nlm name 'chsize';
+function FpChsize(fildes:longint; size:size_t):longint;cdecl;external libc_nlm name 'chsize';
+function FpClose(fildes:longint):longint;cdecl;external libc_nlm name 'close';
+
+
+function crypt(key:Pchar; salt:Pchar):Pchar;cdecl;external libc_nlm name 'crypt';
+function dup(fildes:longint):longint;cdecl;external libc_nlm name 'dup';
+function Fpdup(fildes:longint):longint;cdecl;external libc_nlm name 'dup';
+function dup2(fildes1:longint; fildes2:longint):longint;cdecl;external libc_nlm name 'dup2';
+function Fpdup2(fildes1:longint; fildes2:longint):longint;cdecl;external libc_nlm name 'dup2';
+type TArr064char = array [0..63] of char;
+procedure encrypt(block:TArr064char; edflag:longint);cdecl;external libc_nlm name 'encrypt';
+procedure _exit(status:longint);cdecl;external libc_nlm name '_exit';
+procedure FpExit(status:longint);cdecl;external libc_nlm name '_exit';
+function fchdir(fildes:longint):longint;cdecl;external libc_nlm name 'fchdir';
+function fdatasync(fildes:longint):longint;cdecl;external libc_nlm name 'fdatasync';
+function fork:pid_t;cdecl;external libc_nlm name 'fork';
+function fsync(fildes:longint):longint;cdecl;external libc_nlm name 'fsync';
+function fpathconf(fildes:longint; name:longint):longint;cdecl;external libc_nlm name 'fpathconf';
+function ftruncate(fildes:longint; len:off_t):longint;cdecl;external libc_nlm name 'ftruncate';
+function getcwd(path:Pchar; len:size_t):Pchar;cdecl;external libc_nlm name 'getcwd';
+function gethostid:longint;cdecl;external libc_nlm name 'gethostid';
+(* Const before declarator ignored *)
+
+function getopt(argc:longint; argv:array of Pchar; optstr:Pchar):longint;cdecl;external libc_nlm name 'getopt';
+{$ifndef DisableArrayOfConst}
+function Fpioctl(_para1:longint; _para2:longint; args:array of const):longint;cdecl;external libc_nlm name 'ioctl';
+{$endif}
+function Fpioctl(_para1:longint; _para2:longint):longint;cdecl;external libc_nlm name 'ioctl';
+function isatty(fildes:longint):longint;cdecl;external libc_nlm name 'isatty';
+function lseek(fildes:longint; offset:off_t; whence:longint):off_t;cdecl;external libc_nlm name 'lseek';
+function fplseek(fildes:longint; offset:off_t; whence:longint):off_t;cdecl;external libc_nlm name 'lseek';
+
+function pathconf(path:Pchar; name:longint):longint;cdecl;external libc_nlm name 'pathconf';
+//!!function pipe(fildes:array[0..1] of longint):longint;cdecl;external libc_nlm name 'pipe';
+function FpPipe(var fildes:TFilDes):cInt;cdecl;external libc_nlm name 'pipe';
+function pread(fildes:longint; buf:pointer; nbytes:size_t; off:off_t):ssize_t;cdecl;external libc_nlm name 'pread';
+
+function pwrite(fildes:longint; buf:pointer; nbytes:size_t; off:off_t):ssize_t;cdecl;external libc_nlm name 'pwrite';
+function FpRead(fildes:longint; buf:pointer; nbytes:size_t):ssize_t;cdecl;external libc_nlm name 'read';
+function FpRead(fildes:longint; var buf; nbytes:size_t):ssize_t;cdecl;external libc_nlm name 'read';
+
+function Fprmdir(path:Pchar):longint;cdecl;external libc_nlm name 'rmdir';
+procedure sync;cdecl;external libc_nlm name 'sync';
+function sysconf(name:longint):longint;cdecl;external libc_nlm name 'sysconf';
+
+function unlink(path:Pchar):longint;cdecl;external libc_nlm name 'unlink';
+function FpUnlink(path:Pchar):longint;cdecl;external libc_nlm name 'unlink';
+
+function {$ifdef INCLUDED_FROM_SYSTEM}libc_write{$else}_write{$endif}(fildes:longint; buf:pointer; nbytes:size_t):ssize_t;cdecl;external libc_nlm name 'write';
+function FpWrite(fildes:longint; buf:pointer; nbytes:size_t):ssize_t;cdecl;external libc_nlm name 'write';
+function FpWrite(fildes:longint; var buf; nbytes:size_t):ssize_t;cdecl;external libc_nlm name 'write';
+{ appeared in BSD...  }
+function brk(endds:pointer):longint;cdecl;external libc_nlm name 'brk';
+function getdtablehi:longint;cdecl;external libc_nlm name 'getdtablehi';
+function getdtablesize:longint;cdecl;external libc_nlm name 'getdtablesize';
+function getpagesize:longint;cdecl;external libc_nlm name 'getpagesize';
+
+function readlink(path:Pchar; buf:Pchar; bufsize:size_t):longint;cdecl;external libc_nlm name 'readlink';
+function FpReadlink(path:Pchar; buf:Pchar; bufsize:size_t):longint;cdecl;external libc_nlm name 'readlink';
+function sbrk(incr:intptr_t):pointer;cdecl;external libc_nlm name 'sbrk';
+{ nonstandard additions (see also fsio.h)...  }
+function cancel(t_id:longint):longint;cdecl;external libc_nlm name 'cancel';
+function confstr(name:longint; buf:Pchar; len:size_t):size_t;cdecl;external libc_nlm name 'confstr';
+function delay(milliseconds:dword):longint;cdecl;external libc_nlm name 'delay';
+function sethostid(hostid:longint):longint;cdecl;external libc_nlm name 'sethostid';
+function setmode(fildes:longint; oflag:longint):longint;cdecl;external libc_nlm name 'setmode';
+function sleep(seconds:dword):dword;cdecl;external libc_nlm name 'sleep';
+function FpSleep(seconds:dword):dword;cdecl;external libc_nlm name 'sleep';
+function usleep(useconds:useconds_t):longint;cdecl;external libc_nlm name 'usleep';
+{ nonstandard (transitional) addtions for 64-bit file I/O...  }
+function chsize64(fildes:longint; size:size64_t):longint;cdecl;external libc_nlm name 'chsize64';
+function ftruncate64(fildes:longint; len:off64_t):longint;cdecl;external libc_nlm name 'ftruncate64';
+function lseek64(fildes:longint; offset:off64_t; whence:longint):off64_t;cdecl;external libc_nlm name 'lseek64';
+function pread64(fildes:longint; buf:pointer; nbytes:size_t; off:off64_t):ssize_t;cdecl;external libc_nlm name 'pread64';
+
+function pwrite64(fildes:longint; buf:pointer; nbytes:size_t; off:off64_t):ssize_t;cdecl;external libc_nlm name 'pwrite64';
+function tell64(fildes:longint):off64_t;cdecl;external libc_nlm name 'tell64';
+function ____environ:PPPchar;cdecl;external libc_nlm name '____environ';
+function ___optarg:PPchar;cdecl;external libc_nlm name '___optarg';
+function ___optind:Plongint;cdecl;external libc_nlm name '___optind';
+function ___opterr:Plongint;cdecl;external libc_nlm name '___opterr';
+function ___optopt:Plongint;cdecl;external libc_nlm name '___optopt';
+function ___optreset:Plongint;cdecl;external libc_nlm name '___optreset';
+function want_posix_semantics(timestamp:longint):longint;cdecl;external libc_nlm name 'want_posix_semantics';
+{
+** Prototype for libraries writing their own start-up and shut-down code. This
+** is not an interface, but only a prototype for code furnished by the UNIX-
+** style NLM library. The presence of these is noted by the prelude object.
+ }
+function _init:longint;cdecl;external libc_nlm name '_init';
+function _fini:longint;cdecl;external libc_nlm name '_fini';
+{ globals for getopt() implementation...  }
+{ the prototype for ioctl() is in unistd.h...  }
+
+
+// sys/byteorder.h
+function htonl(_para1:dword):dword;cdecl;external libc_nlm name 'htonl';
+function htons(_para1:word):word;cdecl;external libc_nlm name 'htons';
+function ntohl(_para1:dword):dword;cdecl;external libc_nlm name 'ntohl';
+function ntohs(_para1:word):word;cdecl;external libc_nlm name 'ntohs';
+
+
+// sys/cdefs.h
+// sys/dir.h
+// dirent.h
+// sys/mode.h
+
+{ POSIX file types...  }
+{ POSIX file modes: owner (user) permission...  }
+{ POSIX file modes: group permission...  }
+{ POSIX file modes: other permission...  }
+{ POSIX setuid(), setgid(), and sticky...  }
+{ for use with stat(), readdir(), chmod(), mkdir(), etc.  }
+{ NetWare-specific additions to the upper half of mode_t...  }
+{ values for field 'd_type'...  }
+
+{ pshpack1.h }
+{ turn on 1-byte packing...  }
+
+  const
+     S_IFMT = $F000;
+  { first-in/first-out (FIFO/pipe)            }
+     S_IFIFO = $1000;
+  { character-special file (tty/console)      }
+     S_IFCHR = $2000;
+  { directory                                 }
+     S_IFDIR = $4000;
+  { blocking device (unused)                  }
+     S_IFBLK = $6000;
+  { regular                                   }
+     S_IFREG = $8000;
+  { symbolic link (unused)                    }
+     S_IFLNK = $A000;
+  { Berkeley socket                           }
+     S_IFSOCK = $C000;
+     S_IRWXU = $01C0;
+     S_IRUSR = $0100;
+     S_IWUSR = $0080;
+     S_IXUSR = $0040;
+     S_IREAD = S_IRUSR;
+     S_IWRITE = S_IWUSR;
+     S_IEXEC = S_IXUSR;
+  { POSIX file modes: group permission...  }
+     S_IRWXG = $0038;
+     S_IRGRP = $0020;
+     S_IWGRP = $0010;
+     S_IXGRP = $0008;
+  { POSIX file modes: other permission...  }
+     S_IRWXO = $0007;
+     S_IROTH = $0004;
+     S_IWOTH = $0002;
+     S_IXOTH = $0001;
+  { POSIX setuid(), setgid(), and sticky...  }
+     S_ISUID = $0800;
+     S_ISGID = $0400;
+     S_ISVTX = $0200;
+  { for use with stat(), readdir(), chmod(), mkdir(), etc.  }
+  { NetWare-specific additions to the upper half of mode_t...  }
+     M_A_RDONLY          = $00010000;    // read-only entry
+     M_A_HIDDEN          = $00020000;    // hidden entry
+     M_A_SYSTEM          = $00040000;    // system entry
+     M_A_SUBDIR          = $00080000;    // is Subdir
+     M_A_ARCH            = $00100000;    // file has been archived
+     M_A_SHARE           = $00200000;    // file is shared
+     M_A_TRANS           = $00400000;    // file transactions are tracked
+     M_A_IMMPURG         = $00800000;    // purge deleted file immediately
+     M_A_NORENAM         = $01000000;    // inhibit renaming
+     M_A_NODELET         = $02000000;    // inhibit deletion
+     M_A_NOCOPY          = $04000000;    // inhibit copying
+     M_A_IMMCOMPRESS     = $08000000;    // compress immediately
+     M_A_FILE_COMPRESSED = $10000000;    // file is compressed
+     M_A_DONT_COMPRESS   = $20000000;    // inhibit compression
+     M_A_CANT_COMPRESS   = $40000000;    // file cannot be compressed
+     M_A_BITS_SIGNIFICANT= $80000000;    // these M_A_- bits are important
+
+     DT_UNKNOWN = 0;
+     DT_TTY = 1;           { console (won't occur) }
+     DT_REG = S_IFREG;     { normal file }
+     DT_DIR = S_IFDIR;     { subdirectory }
+     DT_FIFO = S_IFIFO;    { first-in/first-out (FIFO/pipe) }
+     DT_SOCK = S_IFSOCK;   { socket (won't occur) }
+     DT_CHR = S_IFCHR;     { character-special file (unused)}
+     DT_BLK = S_IFBLK;     { blocking device (unused) }
+     DT_LNK = S_IFLNK;     { symbolic or hard link (won't occur) }
+
+
+type
+
+   Pdirent = ^Tdirent;
+   Tdirent = record
+        d_userspec : dword;
+        d_flags    : dword;
+        d_type     : mode_t;
+        d_mode     : mode_t;
+        d_ino      : ino_t;
+        d_size     : off64_t;
+        d_spare    : array[0..54] of dword;
+        d_pad1     : byte;
+        d_pad2     : byte;
+        d_pad3     : byte;
+        d_namelen  : byte;
+        d_name     : array[0..(255 + 1)-1] of char;
+     end;
+    PPdirent = ^Pdirent;
+   //DIR = dirent;
+   //PDIR = ^DIR;
+   //TDir = Dir;
+{ sizeof(struct dirent) == 0x200 (512.)  }
+
+(** unsupported pragma#pragma pack()*)
+
+
+function closedir(dirp:Pdirent):longint;cdecl;external libc_nlm name 'closedir';
+function opendir(pathName:Pchar):Pdirent;cdecl;external libc_nlm name 'opendir';
+function readdir(dirp:Pdirent):Pdirent;cdecl;external libc_nlm name 'readdir';
+function readdir_r(dirp:Pdirent; entry:Pdirent; result:PPdirent):longint;cdecl;external libc_nlm name 'readdir_r';
+procedure rewinddir(dirp:Pdirent);cdecl;external libc_nlm name 'rewinddir';
+
+function Fpclosedir(dirp:Pdirent):longint;cdecl;external libc_nlm name 'closedir';
+function Fpopendir(pathName:Pchar):Pdirent;cdecl;external libc_nlm name 'opendir';
+function Fpreaddir(dirp:Pdirent):Pdirent;cdecl;external libc_nlm name 'readdir';
+function Fpreaddir_r(dirp:Pdirent; entry:Pdirent; result:PPdirent):longint;cdecl;external libc_nlm name 'readdir_r';
+procedure Fprewinddir(dirp:Pdirent);cdecl;external libc_nlm name 'rewinddir';
+
+// sys/file.h
+// fcntl.h
+
+{ 'cmd' values for fcntl()...                                               }
+const
+ F_GETFL      = 1;        // get file status flags
+ F_SETFL      = 2;        // set file status flags
+ F_DUPFD      = 3;        // duplicate file descriptor
+ F_GETFD      = 4;        // get file descriptor flags
+ F_SETFD      = 5;        // set file descriptor flags
+ F_SETLK      = 6;        // set record locking info
+ F_SETLK64    = 16;       // set record locking info (64-bit)
+ F_GETLK      = 7;        // get record locking info
+ F_GETLK64    = 17;       // get record locking info (64-bit)
+ F_SETLKW     = 8;        // get record locking info; wait if blocked
+ F_SETLKW64   = 18;       // get record locking info (64-bit)
+ F_CLOEXEC    = 9;        // close on execute
+
+// values for 'l_type' field of 'struct flock'...
+ F_RDLCK      = 1;        // shared or read lock
+ F_WRLCK      = 2;        // exclusive or write lock
+ F_UNLCK      = 3;        // unlock
+
+// values for 'oflag' in open()...
+ O_RDONLY     =$00000000; // open for read only
+ O_WRONLY     =$00000001; // open for write only
+ O_RDWR       =$00000002; // open for read and write
+ O_ACCMODE    =$00000003; // access flags mask
+ O_reserved1  =$00000004; // reserved
+ O_reserved2  =$00000008; // reserved
+ O_APPEND     =$00000010; // writes done at end of file
+ O_CREAT      =$00000020; // create new file
+ O_TRUNC      =$00000040; // truncate existing file
+ O_EXCL       =$00000080; // exclusive open
+ O_NOCTTY     =$00000100; // no controlling terminal--unsupported
+ O_BINARY     =$00000200; // binary file--all files
+ O_NDELAY     =$00000400; // nonblocking flag
+ O_reserved3  =$00000800; // reserved
+ O_SYNC       =$00001000; // synchronized I/O file integrity
+ O_DSYNC      =$00002000; // synchronized I/O data integrity
+ O_RSYNC      =$00004000; // synchronized read I/O
+ O_NONBLOCK   = O_NDELAY;   // alias
+ FD_CLOEXEC   =$00008000;   // parent closes after call to process()
+ O_UPDATE     =$00010000;   // keep legacy files updated
+ O_FIFO       =$00100000;   // opening one end of a FIFO [non-standard]
+
+// value for third argument when 'cmd' is F_SETFL in fcntl()...
+ FNDELAY      = O_NDELAY;   // fcntl() non-blocking I/O
+
+// 'shflag' values for sopen()...
+ SH_DENYRW    = $00000010; // deny read/write mode
+ SH_DENYWR    = $00000020; // deny write mode
+ SH_DENYRD    = $00000030; // deny read mode
+ SH_DENYNO    = $00000040; // deny none mode
+
+type
+   Pflock = ^flock;
+   flock = record
+        l_pid : pid_t;                { process ID of owner, get with F_GETLK       }
+        l_tid : pid_t;                { thread ID of owner, get with F_GETLK        }
+        l_type : smallint;            { F_RDLCK or F_WRLCK                          }
+        l_whence : smallint;          { flag for starting offset                    }
+        ________spare : longint;      { unused                                      }
+        ________reserved1 : longint;  { padding to resemble 64-bit structure        }
+        l_start : off_t;              { relative offset in bytes                    }
+        ________reserved2 : longint;  { padding to resemble 64-bit structure        }
+        l_len : off_t;                { size; if 0, then until EOF                  }
+     end;
+
+   Pflock64 = ^flock64;
+   flock64 = record                   { with F_GETLK64, F_SETLK64, FSETLKW64        }
+        l_pid : pid_t;                { process ID of owner, get with F_GETLK       }
+        l_tid : pid_t;                { thread ID of owner, get with F_GETLK        }
+        l_type : smallint;            { F_RDLCK or F_WRLCK                          }
+        l_whence : smallint;          { flag for starting offset                    }
+        ________spare : longint;      { unused                                      }
+        l_start : off64_t;            { relative offset in bytes                    }
+        l_len : off64_t;              { size; if 0, then until EOF                  }
+     end;
+
+function creat(path:Pchar; mode:mode_t):longint;cdecl;external libc_nlm name 'creat';
+{$ifndef DisableArrayOfConst}
+function fcntl(fildes:longint; cmd:longint; args:array of const):longint;cdecl;external libc_nlm name 'fcntl';
+{$endif}
+function fcntl(fildes:longint; cmd:longint):longint;cdecl;external libc_nlm name 'fcntl';
+{$ifndef DisableArrayOfConst}
+function open(path:Pchar; oflag:longint; args:array of const):longint;cdecl;external libc_nlm name 'open';
+{$endif}
+function open(path:Pchar; oflag:longint):longint;cdecl;external libc_nlm name 'open';
+function open(path:Pchar; oflag,mode:longint):longint;cdecl;external libc_nlm name 'open';
+function FpOpen(path:Pchar; oflag:longint):longint;cdecl;external libc_nlm name 'open';
+function FpOpen(path:Pchar; oflag,mode:longint):longint;cdecl;external libc_nlm name 'open';
+
+function pipe_open(path:Pchar; oflag:longint):longint;cdecl;external libc_nlm name 'pipe_open';
+function pipe_open(path:Pchar; oflag,mode:longint):longint;cdecl;external libc_nlm name 'pipe_open';
+{$ifndef DisableArrayOfConst}
+function sopen(path:Pchar; oflag:longint; shflag:longint; args:array of const):longint;cdecl;external libc_nlm name 'sopen';
+{$endif}
+function sopen(path:Pchar; oflag:longint; shflag:longint):longint;cdecl;external libc_nlm name 'sopen';
+
+
+// sys/filio.h
+{ defines for ioctl()...  }
+// sys/ipc.h
+
+{ mode bits...  }
+{ keys...  }
+{ control commands for semctl() and shmctl()...  }
+type
+
+   Pkey_t = ^key_t;
+   key_t = longint;
+{ owner                              }
+{ owner                              }
+{ creator                            }
+{ creator                            }
+{ read/write permission              }
+   Pipc_perm = ^ipc_perm;
+   ipc_perm = record
+        uid : uid_t;
+        gid : gid_t;
+        cuid : uid_t;
+        cgid : gid_t;
+        mode : mode_t;
+     end;
+
+
+
+function ftok(path:Pchar; id:longint):key_t;cdecl;external libc_nlm name 'ftok';
+
+
+// sys/mman.h
+
+{ return value of mmap() in case of error...  }
+{ 'flags' values for mlockall()...  }
+{ 'protection' values for mmap()...  }
+{ 'flags' values for mmap()...  }
+{ 'flags' values for msync()...  }
+{ 'advice' to madvice()...  }
+{ effectual dummies that will never do anything...  }
+
+function mlock(addr:pointer; len:size_t):longint;cdecl;external libc_nlm name 'mlock';
+function mlockall(flags:longint):longint;cdecl;external libc_nlm name 'mlockall';
+function munlock(addr:pointer; len:size_t):longint;cdecl;external libc_nlm name 'munlock';
+function munlockall:longint;cdecl;external libc_nlm name 'munlockall';
+function mprotect(addr:pointer; len:size_t; prot:longint):longint;cdecl;external libc_nlm name 'mprotect';
+function madvise(addr:pointer; len:size_t; advice:longint):longint;cdecl;external libc_nlm name 'madvise';
+
+
+
+// sys/param.h
+// sys/stat.h
+// time.h
+type
+
+   Pclock_t = ^clock_t;
+   clock_t = dword;
+   TClock  = clock_t;
+
+   Ptime_t = ^time_t;
+   time_t = longint;
+   Ttime  = time_t;
+
+{ turn on 1-byte packing...  }
+
+type
+   Ptm = ^Ttm;
+   Ttm = record                // ANSI/ISO 'broken-down' time
+        tm_sec   : longint;    // seconds after the minute [0..59]
+        tm_min   : longint;    // minutes after the hour [0..59]
+        tm_hour  : longint;    // hours since midnight [0..23]
+        tm_mday  : longint;    // days of the month [1..31]
+        tm_mon   : longint;    // months since January [0..11]
+        tm_year  : longint;    // years since 1900 [0..ì]
+        tm_wday  : longint;    // days since Sunday [0..6]
+        tm_yday  : longint;    // days since first of January [0..365]
+        tm_isdst : longint;    // on summer time (-1 unknown, 0 no, !0 yes)
+     end;
+
+   Ptimespec = ^Ttimespec;
+   Ttimespec = record        // time expressed in seconds and nanoseconds
+        tv_sec  : time_t;    // seconds
+        tv_nsec : longint;   // nanoseconds
+     end;
+   timespec_t = Ttimespec;
+   Ptimespec_t = ^timespec_t;
+   timestrc_t = Ttimespec;
+   Ptimestrc_t = ^timestrc_t;
+{ timer period                               }
+{ timer expiration                           }
+
+   Pitimerspec = ^Titimerspec;
+   Titimerspec = record
+        it_interval : Ttimespec;
+        it_value    : Ttimespec;
+     end;
+   itimerspec_t = Titimerspec;
+   Pitimerspec_t = ^itimerspec_t;
+{ DOS 'broken-down' time                     }
+{ two-second increments only                 }
+{ 0-59                                       }
+{ 0-23                                       }
+{ 1-31                                       }
+{ 1-12                                       }
+{ years since 1980 (limit: 0-119)            }
+   Pdos_tm = ^Tdos_tm;
+   Tdos_tm = record
+        flag0 : longint;
+     end;
+
+
+const
+   bm_dos_tm_bisecond = $1F;
+   bp_dos_tm_bisecond = 0;
+   bm_dos_tm_minute = $7E0;
+   bp_dos_tm_minute = 5;
+   bm_dos_tm_hour = $F800;
+   bp_dos_tm_hour = 11;
+   bm_dos_tm_day = $1F0000;
+   bp_dos_tm_day = 16;
+   bm_dos_tm_month = $1E00000;
+   bp_dos_tm_month = 21;
+   bm_dos_tm_year = $FE000000;
+   bp_dos_tm_year = 25;
+
+{$ifndef INCLUDED_FROM_SYSTEM}
+function bisecond(var a : Tdos_tm) : word;
+procedure set_bisecond(var a : Tdos_tm; __bisecond : word);
+function minute(var a : Tdos_tm) : word;
+procedure set_minute(var a : Tdos_tm; __minute : word);
+function hour(var a : Tdos_tm) : word;
+procedure set_hour(var a : Tdos_tm; __hour : word);
+function day(var a : Tdos_tm) : word;
+procedure set_day(var a : Tdos_tm; __day : word);
+function month(var a : Tdos_tm) : word;
+procedure set_month(var a : Tdos_tm; __month : word);
+function year(var a : Tdos_tm) : word;
+procedure set_year(var a : Tdos_tm; __year : word);
+{$endif}
+
+
+type
+   Pdos_d = ^Tdos_d;
+   Tdos_d = packed record   // DOS date separated from time
+        time : word;        // time fields
+        date : word;        // date fields
+     end;
+
+{ utility for passing DOS time               }
+{ scalar for passing as argument             }
+{ separated-out DOS time and date            }
+{ broken-down DOS time and date              }
+   Pdos_tm_u = ^Tdos_tm_u;
+   Tdos_tm_u = record
+       case longint of
+          0 : ( long_dt : dword );
+          1 : ( struct_dt : Tdos_d );
+          2 : ( struct_tm : Tdos_tm );
+       end;
+
+{============================================================================
+=  Novell Software Development Kit
+=
+=  Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
+=
+=  This work is subject to U.S. and international copyright laws and treaties.
+=  Use and redistribution of this work is subject  to  the  license  agreement
+=  accompanying  the  software  development kit (SDK) that contains this work.
+=  However, no part of this work may be revised and/or  modified  without  the
+=  prior  written consent of Novell, Inc. Any use or exploitation of this work
+=  without authorization could subject the perpetrator to criminal  and  civil
+=  liability.
+=
+=  Source(s): Novell Header
+=
+=  poppack.h
+==============================================================================
+ }
+
+(** unsupported pragma#pragma pack()*)
+
+
+function asctime(localtime:Ptm):Pchar;cdecl;external libc_nlm name 'asctime';
+function asctime(var localtime:Ttm):Pchar;cdecl;external libc_nlm name 'asctime';
+function clock:clock_t;cdecl;external libc_nlm name 'clock';
+
+function ctime(calendar:Ptime_t):Pchar;cdecl;external libc_nlm name 'ctime';
+function ctime(var calendar:Ttime):Pchar;cdecl;external libc_nlm name 'ctime';
+function difftime(t1, t2:Ttime):double;cdecl;external libc_nlm name 'difftime';
+
+function gmtime(calendar:Ptime_t):Ptm;cdecl;external libc_nlm name 'gmtime';
+function gmtime(var calendar:Ttime):Ptm;cdecl;external libc_nlm name 'gmtime';
+
+function localtime(calendar:Ptime_t):Ptm;cdecl;external libc_nlm name 'localtime';
+function localtime(var calendar:Ttime):Ptm;cdecl;external libc_nlm name 'localtime';
+function mktime(localtime:Ptm):time_t;cdecl;external libc_nlm name 'mktime';
+function mktime(var localtime:Ttm):time_t;cdecl;external libc_nlm name 'mktime';
+
+//size_t strftime ( char * __restrict s, size_t, const char * __restrict format,
+//size_t strftime ( char * __restrict s, size_t, const char * __restrict format,
+//                      const tm * __restrict localtime );
+
+function time(calendar:Ptime_t):time_t;cdecl;external libc_nlm name 'time';
+function time(var calendar:Ttime):time_t;cdecl;external libc_nlm name 'time';
+function ___clocks_per_sec:longint;cdecl;external libc_nlm name '___clocks_per_sec';
+{ POSIX data and helper functions...  }
+function ___daylight:Plongint;cdecl;external libc_nlm name '___daylight';
+function ___daylightOnOff:Plongint;cdecl;external libc_nlm name '___daylightOnOff';
+function ___daylightOffset:Ptime_t;cdecl;external libc_nlm name '___daylightOffset';
+function ___timezone:Ptime_t;cdecl;external libc_nlm name '___timezone';
+function ___tzname:PPchar;cdecl;external libc_nlm name '___tzname';
+function __isleap(year:longint):longint;cdecl;external libc_nlm name '__isleap';
+procedure tzset;cdecl;external libc_nlm name 'tzset';
+{ POSIX-defined reentrant additions...  }
+
+function asctime_r(localtime:Ptm; timestr:Pchar):Pchar;cdecl;external libc_nlm name 'asctime_r';
+function asctime_r(var localtime:Ttm; timestr:Pchar):Pchar;cdecl;external libc_nlm name 'asctime_r';
+
+function ctime_r(calendar:Ptime_t; timestr:Pchar):Pchar;cdecl;external libc_nlm name 'ctime_r';
+function ctime_r(var calendar:Ttime; timestr:Pchar):Pchar;cdecl;external libc_nlm name 'ctime_r';
+
+function gmtime_r(calendar:Ptime_t; localtime:Ptm):Ptm;cdecl;external libc_nlm name 'gmtime_r';
+function gmtime_r(var calendar:Ttime; localtime:Ptm):Ptm;cdecl;external libc_nlm name 'gmtime_r';
+
+function localtime_r(calendar:Ptime_t; localtime:Ptm):Ptm;cdecl;external libc_nlm name 'localtime_r';
+function localtime_r(var calendar:Ttime; var localtime:Ttm):Ptm;cdecl;external libc_nlm name 'localtime_r';
+{ Single UNIX Specification additions...  }
+
+function nanosleep(rqtp, rmtp:Ptimespec):longint;cdecl;external libc_nlm name 'nanosleep';
+function nanosleep(var rqtp, rmtp:Ttimespec):longint;cdecl;external libc_nlm name 'nanosleep';
+{ Novell-defined additions...  }
+function ltime(calendar:Ptime_t):time_t;cdecl;external libc_nlm name 'ltime';
+function ltime(var calendar:Ttime):time_t;cdecl;external libc_nlm name 'ltime';
+function mkgmtime(gmtime:Ptm):time_t;cdecl;external libc_nlm name 'mkgmtime';
+function mkgmtime(var gmtime:Ttm):time_t;cdecl;external libc_nlm name 'mkgmtime';
+function dos2calendar(dostime:Tdos_d):time_t;cdecl;external libc_nlm name 'dos2calendar';
+function calendar2dos(calendar:time_t):Tdos_d;cdecl;external libc_nlm name 'calendar2dos';
+
+
+// sys/time.h
+// sys/timeval.h
+// sys/times.h
+
+type
+   Ptms = ^Ttms;
+   Ttms = record                        { describes CPU time used by process, children  }
+        tms_utime  : clock_t;           { user CPU time }
+        tms_stime  : clock_t;           { system CPU time (identical to 'tms_utime')    }
+        tms_cutime : clock_t;           { unimplemented }
+        tms_cstime : clock_t;           { unimplemented }
+     end;
+
+   Ptimezone = ^Ttimezone;
+   Ttimezone = record                   { returned by gettimeofday() }
+        tz_secondswest : time_t;        { seconds west of UTC }
+        tz_minuteswest : longint;       { minutes west of UTC (GMT) }
+        tz_dsttime     : longint;       { nonzero if DST is ever in effect }
+     end;
+
+{
+** Normally this functions fills struct tms with several time values. Most of
+** the time it is very important to have only the return value, that is the
+** realtime that has been elapsed.
+ }
+
+function times(__buffer:Ptms):clock_t;cdecl;external libc_nlm name 'times';
+function times(var __buffer:Ttms):clock_t;cdecl;external libc_nlm name 'times';
+{ turn on 1-byte packing...  }
+
+{ this structure is returned by gettimeofday() and used in select()...  }
+type
+   Ptimeval = ^Ttimeval;
+   Ttimeval = record
+        tv_sec  : longint;
+        tv_usec : longint;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ operations on struct timeval; note timercmp() does not work for >= or <=  }
+
+function gettimeofday(tp:Ptimeval; tpz:Ptimezone):longint;cdecl;external libc_nlm name 'gettimeofday';
+function settimeofday(tp:Ptimeval; tpz:Ptimezone):longint;cdecl;external libc_nlm name 'settimeofday';
+
+function gettimeofday(var tp:Ttimeval; var tpz:Ttimezone):longint;cdecl;external libc_nlm name 'gettimeofday';
+function settimeofday(var tp:Ttimeval; var tpz:Ttimezone):longint;cdecl;external libc_nlm name 'settimeofday';
+
+
+{ turn on 1-byte packing...  }
+
+type
+   Pstat = ^Tstat;
+   Tstat = record
+        st_userspec: dword;                         // untouched by stat()
+        st_flags   : dword;                         // flags for this entry
+        st_mode    : mode_t;                        // emulated file mode
+        st_spare1  : dword;
+        st_gen     : uint64_t;                      // generation number of inode
+        st_ino     : ino_t;                         // directory entry number
+        st_dev     : dev_t;                         // volume number
+        st_rdev    : dev_t;                         // device type (always 0)
+        st_size    : off64_t;                       // total file size
+        st_spare2  : uint64_t;
+        st_blocks  : blkcnt_t;                      // count of blocks allocated to file
+        st_blksize : blksize_t;                     // block size for allocation--files only
+        st_nlink   : nlink_t;                       // count of hard links (always 1)
+        st_spare3  : array[0..2] of dword;
+        st_uid     : uid_t;                         // owner (object) identity
+        st_gid     : gid_t;                         // group-id (always 0)
+        st_bid     : uid_t;                         // identity of last archiver
+        st_mid     : uid_t;                         // identity of last updator
+        st_atim    : timespec_t;                    // last access date--files only
+        st_mtim    : timespec_t;                    // last modify date and time
+        st_ctim    : timespec_t;                    // last file attributes modification
+        st_btim    : timespec_t;                    // last archived date and time
+                                                    // NOT returned by stat() or fstat()...
+        st_rights  : dword;                         // NetWare rights
+        st_spare4  : array[0..2] of dword;
+        st_name    : array[0..(255 + 1)-1] of char; // object name as if from readdir()
+        st_spare5  : array[0..19] of dword;
+     end;
+
+{ sizeof(struct stat) == 0x200 (512.)      }
+
+(** unsupported pragma#pragma pack()*)
+
+
+function chmod(path:Pchar; mode:mode_t):longint;cdecl;external libc_nlm name 'chmod';
+function fchmod(fildes:longint; mode:mode_t):longint;cdecl;external libc_nlm name 'fchmod';
+
+function fstat(fildes:longint; buf:Pstat):longint;cdecl;external libc_nlm name 'fstat';
+function fstat(fildes:longint; var buf:Tstat):longint;cdecl;external libc_nlm name 'fstat';
+
+function lstat(path:Pchar; buf:Pstat):longint;cdecl;external libc_nlm name 'lstat';
+function lstat(path:Pchar; var buf:Tstat):longint;cdecl;external libc_nlm name 'lstat';
+
+function Fpmkdir(pathname:Pchar; mode:mode_t):longint;cdecl;external libc_nlm name 'mkdir';
+
+function mkfifo(pathname:Pchar; mode:mode_t):longint;cdecl;external libc_nlm name 'mkfifo';
+function mknod(path:Pchar; mode:mode_t; dev:dev_t):longint;cdecl;external libc_nlm name 'mknod';
+function realname(pathname:Pchar; name:Pchar):longint;cdecl;external libc_nlm name 'realname';
+function stat(path:Pchar; buf:Pstat):longint;cdecl;external libc_nlm name 'stat';
+function stat(path:Pchar; var buf:Tstat):longint;cdecl;external libc_nlm name 'stat';
+function umask(cmask:mode_t):mode_t;cdecl;external libc_nlm name 'umask';
+{
+** The following value is not really correct, but it is a value that has been
+** used for a long time seems to be usable. Normally, NOFILE should not be used
+** anyway.
+ }
+{ bit map related macros...   }
+{ macros for counting and rounding...  }
+{ supplementary macros for min/max...   }
+{ unit of sys/stat.h `st_blocks'...   }
+
+
+// sys/select.h
+
+{
+** Including file may make this bigger or smaller as long as the FD_- macros
+** are faithfully used.
+ }
+type
+
+   Pfd_set = ^Tfd_set;
+   Tfd_set = record
+        fd_count : longint;
+        fd_array : array[0..63] of longint;
+     end;
+{ heterogeneous select calls (socket+pipe) unsupported on NetWare...  }
+
+
+function pipe_select(nfds:longint; readfds, writefds, exceptfds:Pfd_set; timeout:Ptimeval):longint;cdecl;external libc_nlm name 'pipe_select';
+function pipe_select(nfds:longint; var readfds, writefds, exceptfds:Tfd_set; var timeout:Ttimeval):longint;cdecl;external libc_nlm name 'pipe_select';
+
+function select(nfds:longint; readfds:Pfd_set; writefds:Pfd_set; exceptfds:Pfd_set; timeout:Ptimeval):longint;cdecl;external libc_nlm name 'select';
+function select(nfds:longint; var readfds, writefds, exceptfds:Tfd_set; var timeout:Ttimeval):longint;cdecl;external libc_nlm name 'select';
+function FpSelect(nfds:longint; readfds:Pfd_set; writefds:Pfd_set; exceptfds:Pfd_set; timeout:Ptimeval):longint;cdecl;external libc_nlm name 'select';
+function FpSelect(nfds:longint; var readfds, writefds, exceptfds:Tfd_set; var timeout:Ttimeval):longint;cdecl;external libc_nlm name 'select';
+function ___fd_isset(fd:longint; _set:Pfd_set):longint;cdecl;external libc_nlm name '___fd_isset';
+function ___fd_isset(fd:longint; var _set:Tfd_set):longint;cdecl;external libc_nlm name '___fd_isset';
+
+
+// sys/sem.h
+
+{ semctl() command definitions...  }
+{ semaphore text map address        }
+{ pid of last operation             }
+{ count awaiting (semval > cval)    }
+{ count awaiting (semval == 0)      }
+type
+   Psem = ^Tsem;
+   Tsem = record
+        semval  : ushort_t;
+        semadj  : ushort_t;
+        sempid  : pid_t;
+        semncnt : ushort_t;
+        semzcnt : ushort_t;
+        semptr  : pointer;       // semaphore on which this is based
+     end;
+   TSemaphore = Tsem;
+   PSemaphore = Psem;
+
+   Psemid_ds = ^Tsemid_ds;
+   Tsemid_ds = record
+        sem_perm    : ipc_perm;
+        sem_base    : Psem;       // pointer to first semaphore in set
+        sem_nsems   : word;       // number of semaphores in set
+        sem_otime   : time_t;     // last semop time
+        sem_ctime   : time_t;     // last change time
+        sem_ptr     : pointer;    // actual underlying semaphore
+        sem_realkey : longint;    // 'real' semaphore key
+     end;
+
+   Psembuf = ^Tsembuf;
+   Tsembuf = record
+        sem_num : word;           // Number
+        sem_op  : smallint;       // operation
+        sem_flg : smallint;       // flags
+     end;
+
+   Psemun = ^Tsemun;
+   Tsemun = record
+       case longint of
+          0 : ( val : longint );
+          1 : ( buf : Psemid_ds );
+          2 : ( _array : Pword );
+       end;
+
+{$ifndef DisableArrayOfConst}
+function semctl(semid:longint; semnum:longint; cmd:longint; args:array of const):longint;cdecl;external libc_nlm name 'semctl';
+{$endif}
+function semctl(semid:longint; semnum:longint; cmd:longint):longint;cdecl;external libc_nlm name 'semctl';
+function semget(key:key_t; nsems:longint; semflag:longint):longint;cdecl;external libc_nlm name 'semget';
+function semop(semid:longint; sops:Psembuf; nsops:size_t):longint;cdecl;external libc_nlm name 'semop';
+function semop(semid:longint; var sops:Tsembuf; nsops:size_t):longint;cdecl;external libc_nlm name 'semop';
+
+
+// sys/sendfile.h
+
+function sendfile(out_fd,in_fd:longint; offset:Poff_t; count:size_t):ssize_t;cdecl;external libc_nlm name 'sendfile';
+function sendfile64(out_fd,in_fd:longint; offset:Poff64_t; count:size_t):ssize_t;cdecl;external libc_nlm name 'sendfile64';
+
+
+// sys/shm.h
+
+type
+
+   Pshmatt_t = ^shmatt_t;
+   shmatt_t = dword;
+{ turn on 1-byte packing...  }
+
+{ size of segment in bytes               }
+{ process ID of last shared operation    }
+{ process ID of creator                  }
+{ number of current attaches             }
+{ time of last shmat()                   }
+{ time of last shmdt()                   }
+{ time of last change by shmctl()        }
+{ operation permission structure         }
+type
+   Pshmid_ds = ^shmid_ds;
+   shmid_ds = record
+        shm_segsz : size_t;
+        shm_lpid : pid_t;
+        shm_cpid : pid_t;
+        shm_nattch : shmatt_t;
+        shm_atime : time_t;
+        shm_dtime : time_t;
+        shm_ctime : time_t;
+        shm_spare1 : longint;
+        shm_perm : ipc_perm;
+        shm_spare2 : array[0..2] of longint;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+
+function shmat(shmid:longint; shmaddr:pointer; shmflag:longint):pointer;cdecl;external libc_nlm name 'shmat';
+function shmctl(shmid:longint; cmd:longint; buf:Pshmid_ds):longint;cdecl;external libc_nlm name 'shmctl';
+
+function shmdt(shmaddr:pointer):longint;cdecl;external libc_nlm name 'shmdt';
+function shmget(key:key_t; size:size_t; shmflag:longint):longint;cdecl;external libc_nlm name 'shmget';
+
+// signal.h
+
+    const
+       SIGABRT = 1;
+       SIGFPE = 2;
+       SIGILL = 3;
+       SIGINT = 4;
+       SIGSEGV = 5;
+       SIGTERM = 6;
+       SIGPOLL = 7;
+    { currently unimplemented POSIX-mandated signals  }
+       SIGKILL  = 11;
+       SIGSPARE = 12;
+       SIGALRM  = 13;
+       SIGCHILD = 14;
+       SIGCHLD  = SIGCHILD;
+       SIGCONT  = 15;
+       SIGHUP   = 16;
+       SIGPIPE  = 17;
+       SIGQUIT  = 18;
+       SIGSTOP  = 19;
+       SIGTSTP  = 20;
+       SIGTTIN  = 21;
+       SIGTTOU  = 22;
+       SIGUSR1  = 23;
+       SIGUSR2  = 24;
+       SIGUSR3  = 25;
+       SIGUSR4  = 26;
+       SIGUSR5  = 27;
+       SIGUSR6  = 28;
+       SIGUSR7  = 29;
+    { Novell-defined signals  }
+       SIG_FINI         = 30;
+       SIG_LOCALECHANGE = 31;
+       NSIG             = 32;
+       SIG_BLOCK        = $00000000;
+       SIG_UNBLOCK      = $00000001;
+       SIG_SETMASK      = $FFFFFFFF;
+//       SIGEMPTYSET      = $0000000000000000;
+       SIGFULLSET       = $FFFFFFFFFFFFFFFF;
+
+
+type
+
+   Psig_atomic_t = ^sig_atomic_t;
+   sig_atomic_t = longint;
+
+   Psigset_t = ^sigset_t;
+   sigset_t = uint64_t;
+{ flags for sa_flags in struct sigaction  }
+   Psigaction = ^sigaction;
+   sigaction = record
+        sa_handler : procedure (_para1:longint);cdecl;
+        sa_mask : sigset_t;
+        sa_flags : longint;
+     end;
+
+type TCDeclProc1LIntPara = procedure (_para1:longint); cdecl;
+function _raise(_para1:longint):longint;cdecl;external libc_nlm name 'raise';
+function signal(sig:longint; func:TCDeclProc1LIntPara):TCDeclProc1LIntPara;cdecl;external libc_nlm name 'signal';
+
+function sigwait(_set:Psigset_t; sig:Plongint):longint;cdecl;external libc_nlm name 'sigwait';
+{ signal vector functions...  }
+
+//!! function sigaction(sig:longint; act:Psigaction; oact:Psigaction):longint;cdecl;external libc_nlm name 'sigaction';
+
+function sigaddset(_para1:Psigset_t; _para2:longint):longint;cdecl;external libc_nlm name 'sigaddset';
+
+function sigdelset(_para1:Psigset_t; _para2:longint):longint;cdecl;external libc_nlm name 'sigdelset';
+
+function sigismember(_para1:Psigset_t; _para2:longint):longint;cdecl;external libc_nlm name 'sigismember';
+function sigfillset(_para1:Psigset_t):longint;cdecl;external libc_nlm name 'sigfillset';
+function sigemptyset(_para1:Psigset_t):longint;cdecl;external libc_nlm name 'sigemptyset';
+function sigpending(_set:Psigset_t):longint;cdecl;external libc_nlm name 'sigpending';
+
+function sigsuspend(mask:Psigset_t):longint;cdecl;external libc_nlm name 'sigsuspend';
+
+function sigprocmask(how:longint; act:Psigset_t; oldact:Psigset_t):longint;cdecl;external libc_nlm name 'sigprocmask';
+function kill(pid:pid_t; sig:longint):longint;cdecl;external libc_nlm name 'kill';
+
+
+// sys/socket.h
+// sys/uio.h
+{ turn on 1-byte packing...  }
+
+type
+
+   Piovec = ^iovec;
+   iovec = record
+        iov_base : caddr_t;
+        iov_len : longint;
+     end;
+   iovec_t = iovec;
+   Piovec_t = ^iovec_t;
+{============================================================================
+=  Novell Software Development Kit
+=
+=  Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
+=
+=  This work is subject to U.S. and international copyright laws and treaties.
+=  Use and redistribution of this work is subject  to  the  license  agreement
+=  accompanying  the  software  development kit (SDK) that contains this work.
+=  However, no part of this work may be revised and/or  modified  without  the
+=  prior  written consent of Novell, Inc. Any use or exploitation of this work
+=  without authorization could subject the perpetrator to criminal  and  civil
+=  liability.
+=
+=  Source(s): Novell Header
+=
+=  poppack.h
+==============================================================================
+ }
+
+(** unsupported pragma#pragma pack()*)
+
+
+function readv(fildes:longint; iov:Piovec; iovcnt:longint):ssize_t;cdecl;external libc_nlm name 'readv';
+
+function writev(fildes:longint; iov:Piovec; iovcnt:longint):ssize_t;cdecl;external libc_nlm name 'writev';
+{ socket types...  }
+{ option flags per-socket...  }
+{ additional options, not kept in so_options...  }
+{ additional option to be used with level IPPROTO_TCP...  }
+{ level number for get/setsockopt() to apply to socket itself...  }
+{ address families  }
+{ protocol families, same as address families for now...  }
+{ values for shutdown() 'how'...  }
+{============================================================================
+=  Novell Software Development Kit
+=
+=  Copyright (C) 1999-2001 Novell, Inc. All Rights Reserved.
+=
+=  This work is subject to U.S. and international copyright laws and treaties.
+=  Use and redistribution of this work is subject  to  the  license  agreement
+=  accompanying  the  software  development kit (SDK) that contains this work.
+=  However, no part of this work may be revised and/or  modified  without  the
+=  prior  written consent of Novell, Inc. Any use or exploitation of this work
+=  without authorization could subject the perpetrator to criminal  and  civil
+=  liability.
+=
+=  Source(s): Novell Header
+=
+=  pshpack1.h
+==============================================================================
+ }
+{
+** Note:
+**
+** The Novell NDK headers for NKS/LibC contain structures that are explicitly
+** hand-packed for best use on the platform in question (usually IA32). To
+** avoid the impredictability encountered when compiling with different
+** compilers, these headers rely on 1-byte packing.
+ }
+{ this header sets packing to 1 for different compilers  }
+{ save off the previous packing directive in a compiler specific way...  }
+{ turn on 1-byte packing...  }
+
+{ structure used for manipulating linger option...  }
+{ option on/off                          }
+{ linger time                            }
+type
+   Plinger = ^linger;
+   linger = record
+        l_onoff : longint;
+        l_linger : longint;
+     end;
+
+{ structure used to define addresses for bind(), connect(), etc...  }
+
+   Psa_family_t = ^sa_family_t;
+   sa_family_t = word;
+{ address family                         }
+{ up to 14 bytes of direct address       }
+   Psockaddr = ^sockaddr;
+   sockaddr = record
+        sa_family : sa_family_t;
+        sa_data : array[0..13] of char;
+     end;
+
+{ used by kernel to pass protocol info.  }
+{    in raw sockets                      }
+{ address family                         }
+{ protocol                               }
+   Psockproto = ^sockproto;
+   sockproto = record
+        sp_family : word;
+        sp_protocol : word;
+     end;
+
+
+   Psocklen_t = ^socklen_t;
+   socklen_t = dword;
+{
+** SUS' and BSD 4.4 message passing. struct msghdr has an additional field
+** (msg_flags) and slightly different fieldnames over what we used to
+** promote. msg_accrights(len) is done differently.
+ }
+{ optional address                       }
+{ size of address                        }
+{ scatter/gather array                   }
+{ count of elements in msg_iov           }
+{ access rights sent/received            }
+   Pmsghdr = ^msghdr;
+   msghdr = record
+        msg_name : caddr_t;
+        msg_namelen : socklen_t;
+        msg_iov : Piovec;
+        msg_iovlen : longint;
+        msg_accrights : caddr_t;
+        msg_accrightslen : socklen_t;
+        msg_flags : longint;
+     end;
+
+{
+** POSIX 1003.1g: Ancillary data object information consisting of a sequence
+** of pairs of (cmsghdr, cmsg_data[1]).
+ }
+{ data byte count including header       }
+{ originating protocol                   }
+{ protocol-specific type                 }
+   Pcmsghdr = ^cmsghdr;
+   cmsghdr = record
+        cmsg_len : socklen_t;
+        cmsg_level : longint;
+        cmsg_type : longint;
+     end;
+
+
+(** unsupported pragma#pragma pack()*)
+
+function accept(s:longint; addr:Psockaddr; len:Psize_t):longint;cdecl;external libc_nlm name 'accept';
+
+function bind(s:longint; addr:Psockaddr; _para3:size_t):longint;cdecl;external libc_nlm name 'bind';
+
+function connect(s:longint; addr:Psockaddr; len:size_t):longint;cdecl;external libc_nlm name 'connect';
+function getpeername(s:longint; addr:Psockaddr; len:Psize_t):longint;cdecl;external libc_nlm name 'getpeername';
+function getsockname(s:longint; addr:Psockaddr; len:Psize_t):longint;cdecl;external libc_nlm name 'getsockname';
+function getsockopt(s:longint; level:longint; optname:longint; optval:pointer; optlen:Psize_t):longint;cdecl;external libc_nlm name 'getsockopt';
+function listen(s:longint; backlog:longint):longint;cdecl;external libc_nlm name 'listen';
+function recv(s:longint; buf:pointer; len:size_t; flags:longint):ssize_t;cdecl;external libc_nlm name 'recv';
+function recvfrom(s:longint; buf:pointer; len:size_t; flags:longint; from:Psockaddr;
+           fromlen:Psize_t):ssize_t;cdecl;external libc_nlm name 'recvfrom';
+function recvmsg(s:longint; msg:Pmsghdr; flags:longint):ssize_t;cdecl;external libc_nlm name 'recvmsg';
+
+function send(s:longint; msg:pointer; len:size_t; flags:longint):ssize_t;cdecl;external libc_nlm name 'send';
+
+function sendmsg(s:longint; _para2:Pmsghdr; flags:longint):ssize_t;cdecl;external libc_nlm name 'sendmsg';
+
+
+function sendto(s:longint; msg:pointer; len:size_t; flags:longint; _to:Psockaddr;
+           tolen:size_t):ssize_t;cdecl;external libc_nlm name 'sendto';
+
+function setsockopt(s:longint; level:longint; optname:longint; optval:pointer; optlen:size_t):longint;cdecl;external libc_nlm name 'setsockopt';
+function shutdown(s:longint; how:longint):longint;cdecl;external libc_nlm name 'shutdown';
+function socket(domain:longint; _type:longint; protocol:longint):longint;cdecl;external libc_nlm name 'socket';
+
+
+// sys/sockio.h
+// sys/stat.h
+{ turn on 1-byte packing...  }
+
+{ file system type               }
+{ fragment size                  }
+{ block size                     }
+{ total number of blocks         }
+{ count of free blocks           }
+{ total number of file nodes     }
+{ count of free file nodes       }
+{ server name                    }
+{ volume name                    }
+{ pack name                      }
+type
+   Pstatfs = ^Tstatfs;
+   Tstatfs = record
+        f_fstyp  : longint;
+        f_frsize : size_t;
+        f_bsize  : blksize_t;
+        f_blocks : blkcnt_t;
+        f_bfree  : uint64_t;
+        f_files  : uint64_t;
+        f_ffree  : uint64_t;
+        f_fspare : array[0..1] of uint64_t;
+        f_fserver: array[0..(48 + 4)-1] of char;
+        f_fname  : array[0..(16 + 4)-1] of char;
+        f_fpack  : array[0..19] of char;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+
+//!! function statfs(path:Pchar; buf:Pstatfs):longint;cdecl;external libc_nlm name 'statfs';
+function fstatfs(fildes:longint; buf:Pstatfs):longint;cdecl;external libc_nlm name 'fstatfs';
+function fstatfs(fildes:longint; var buf:Tstatfs):longint;cdecl;external libc_nlm name 'fstatfs';
+
+// sys/ttydefaults.h
+
+{ system wide defaults for terminal state, mostly for porting help  }
+{ defaults on "first" open...  }
+{ control character defaults...  }
+{ compatibility:  }
+// sys/un.h
+
+{ used in place of struct sockaddr_t to define addresses for UNIX domain...  }
+type
+   Psockaddr_un = ^sockaddr_un;
+   sockaddr_un = record
+        sun_family : sa_family_t;
+        sun_path : array[0..510] of char;
+     end;
+
+// ======= sys/utsname.h ===============================================
+
+{ turn on 1-byte packing...  }
+
+// (request) bits for uname2()...
+const
+   UNAME_NLMMODULE      = $00000001;  // nlmmodule (if it can be gotten)
+   UNAME_POSIXFIELDS    = $00000002;  // POSIX fields (see sys/utsname.h)
+   UNAME_LIBVERSION     = $00000004;  // libminor/major/revision/threshold
+   UNAME_FSVERSION      = $00000008;  // major/minor/revision/service pack
+   UNAME_NETWAREVERSION = $00000010;  // netware_major/minor/revision
+   UNAME_SERVERNAME     = $00000020;  // servername
+   UNAME_CLUSTERNAME    = $00000040;  // clustername
+   UNAME_LANGINFO       = $00000080;  // languagename/alt/id/altid/codepage
+   UNAME_NLMMESSAGES    = $00000100;  // nlmmessagecount/table
+   UNAME_NLMVERSION     = $00000200;  // nlmmajor/minor/revision
+   UNAME_NLMINFO        = $00000400;  // nlmtimer/loadflags
+   UNAME_NLMNAME        = $00000800;  // nlmname
+   UNAME_NLMLOADPATH    = $00001000;  // nlmloadpath
+   UNAME_NLMCOPYRIGHT   = $00002000;  // nlmcopyright
+   UNAME_NLMDESCRIPTION = $00004000;  // nlmdescription
+   UNAME_NLMCOMMANDLINE = $00008000;  // nlmcommandline
+   UNAME_NDSTREENAME    = $00010000;  // treename
+   UNAME_NLMCODEANDDATA = $00020000;  // code and datastart/-length
+
+type
+   Putsname = ^Tutsname;
+   Tutsname = record
+        userspec         : longint;     // untouched by uname()
+                                        // Novell fields
+                                        // Standard C Library implementation:
+        libmajor         : longint;     //   major version number
+        libminor         : longint;     //   minor version number
+        librevision      : longint;     //   revision number
+                                        // NetWare OS implementation
+        major            : longint;     //   major version number
+        minor            : longint;     //   minor version number
+        revision         : longint;     //   revision number
+                                        // NetWare C Library implementation
+        libthreshold     : longint;     //   functionality and semantics timestamp
+                                        // NetWare product distribution
+        servicepack      : longint;
+        netware_major    : longint;
+        netware_minor    : longint;
+        netware_revision : longint;
+        servername       : array[0..63] of char;
+        clustername      : array[0..63] of char;
+        languagename     : array[0..31] of char;  // Server current language name
+        altlanguagename  : array[0..31] of char;  // NLM's current language name
+        languageid       : longint;
+        altlanguageid    : longint;
+        codepage         : longint;
+        reserved1        : longint;
+        reserved2        : array[0..3] of longint;
+        nlmmodule        : pointer;              // NetWare-loadable module (NLM) handle
+        nlmmajor         : longint;
+        nlmminor         : longint;
+        nlmrevision      : longint;
+        nlmtimer         : time_t;               // module's date and time stamp in UTC
+        nlmcommandline   : Pchar;
+        nlmmessagecount  : size_t;
+        nlmmessagetable  : ^Pchar;
+        nlmname          : array[0..35] of char;
+        nlmloadpath      : array[0..255] of char;
+        nlmcopyright     : array[0..255] of char;
+        nlmdescription   : array[0..127] of char;
+        nlmloadflags     : longint;
+        reserved3        : longint;
+        release          : array[0..15] of char;
+        version          : array[0..15] of char;
+        sysname          : array[0..15] of char;
+        machine          : array[0..15] of char;
+        nodename         : array[0..15] of char;
+        treename         : array[0..95] of char; // name of NDS tree
+        codeoffset       : pointer;
+        codelength       : size_t;
+        dataoffset       : pointer;
+        datalength       : size_t;
+        reserved4        : array[0..27] of longint;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+function uname(name:Putsname):longint;cdecl;external libc_nlm name 'uname';
+function uname(var name:Tutsname):longint;cdecl;external libc_nlm name 'uname';
+function uname2(handle:pointer; info:Putsname; bits:dword):longint;cdecl;external libc_nlm name 'uname2';
+function uname2(handle:pointer; var info:Tutsname; bits:dword):longint;cdecl;external libc_nlm name 'uname2';
+
+
+// sys/wait.h
+
+function wait(stat_loc:Plongint):pid_t;cdecl;external libc_nlm name 'wait';
+function wait(var stat_loc:longint):pid_t;cdecl;external libc_nlm name 'wait';
+function waitpid(pid:pid_t; stat_loc:Plongint; options:longint):pid_t;cdecl;external libc_nlm name 'waitpid';
+function waitpid(pid:pid_t; var stat_loc:longint; options:longint):pid_t;cdecl;external libc_nlm name 'waitpid';
+
+// arpa/inet.h
+// netinet/in.h
+
+{ protocols...  }
+{ port/socket numbers: network standard functions  }
+{ port/socket numbers: host specific functions...  }
+{ UNIX TCP sockets...   }
+{ UNIX UDP sockets...  }
+{
+** Ports numbered less than IPPORT_RESERVED are reserved for privileged
+** processes like 'root.'
+ }
+{ link numbers...  }
+{
+** Definitions of bits in Internet address integers. On subnets, the
+** decomposition of addresses to host and net parts is done according
+** to subnet mask, not the masks here.
+ }
+{ options for use with [gs]etsockopt at IP level...  }
+{ macro to stuff the loopback address into an Internet address...  }
+{ address testing macros...  }
+{ type definitions...  }
+type
+   Pin_addr = ^in_addr;
+   in_addr = record
+        S_un : record
+            case longint of
+               0 : ( S_un_b : record
+                    s_b1 : byte;
+                    s_b2 : byte;
+                    s_b3 : byte;
+                    s_b4 : byte;
+                 end );
+               1 : ( S_un_w : record
+                    s_w1 : word;
+                    s_w2 : word;
+                 end );
+               2 : ( S_addr : dword );
+            end;
+     end;
+
+   //!! in_addr = in_addr_t;
+{ socket address, internet style    }
+   Psockaddr_in = ^sockaddr_in;
+   sockaddr_in = record
+        sin_family : smallint;
+        sin_port : u_short;
+        sin_addr : in_addr;
+        sin_zero : array[0..7] of char;
+     end;
+
+   //!! sockaddr_in = sockaddr_in_t;
+   Pin6_addr = ^in6_addr;
+   in6_addr = record
+        in6a_u : record
+            case longint of
+               0 : ( bytes : array[0..15] of u_char );
+               1 : ( shorts : array[0..7] of u_short );
+               2 : ( words : array[0..3] of u_long );
+            end;
+     end;
+
+   Psockaddr_in6 = ^sockaddr_in6;
+   sockaddr_in6 = record
+        sin6_family : smallint;
+        sin6_port : u_short;
+        sin6_flowinfo : u_long;
+        sin6_addr : in6_addr;
+        sin6_scope_id : u_long;
+     end;
+
+{ for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP...  }
+{ IP multicast address of group    }
+{ local IP address of interface    }
+   Pip_mreq = ^ip_mreq;
+   ip_mreq = record
+        imr_multiaddr : in_addr;
+        imr_interface : in_addr;
+     end;
+
+{ data...  }
+
+  var
+     in6addr_any : in6_addr;cvar;external;
+
+     in6addr_loopback : in6_addr;cvar;external;
+
+
+function inet_addr(_string:Pchar):dword;cdecl;external libc_nlm name 'inet_addr';
+function inet_aton(cp:Pchar; addr:Pin_addr):longint;cdecl;external libc_nlm name 'inet_aton';
+function inet_makeaddr(net_num:in_addr; loc_addr:in_addr):in_addr;cdecl;external libc_nlm name 'inet_makeaddr';
+function inet_network(_string:Pchar):in_addr;cdecl;external libc_nlm name 'inet_network';
+function inet_ntoa(addr:in_addr):Pchar;cdecl;external libc_nlm name 'inet_ntoa';
+function inet_ntop(af:longint; src:pointer; dst:Pchar; size:size_t):Pchar;cdecl;external libc_nlm name 'inet_ntop';
+function inet_pton(af:longint; cp:Pchar; ap:pointer):longint;cdecl;external libc_nlm name 'inet_pton';
+
+
+// netinet/in.h
+
+{ User-settable options (used with setsockopt). }
+
+
+// nks/defs.h
+
+  const
+     NX_MAX_KEYS = 64;
+     NX_MAX_OBJECT_NAME_LEN = 31;
+     NX_INTR1 = 0;
+     NX_INTR2 = 1;
+     NX_INTR3 = 2;
+     NX_INTR4 = 3;
+     NX_INTR5 = 4;
+     NX_INTR6 = 5;
+     NX_INTR7 = 6;
+     NX_INTR8 = 7;
+     NX_INTR9 = 8;
+     NX_INTR10 = 9;
+     NX_INTR11 = 10;
+     NX_INTR12 = 11;
+     NX_INTR13 = 12;
+     NX_INTR14 = 13;
+     NX_INTR15 = 14;
+     NX_INTR16 = 15;
+     NX_INTR17 = 16;
+     NX_INTR18 = 17;
+     NX_INTR19 = 18;
+     NX_INTR20 = 19;
+     NX_INTR21 = 20;
+     NX_INTR22 = 21;
+     NX_INTR23 = 22;
+     NX_INTR24 = 23;
+     NX_INTR25 = 24;
+     NX_INTR26 = 25;
+     NX_INTR27 = 26;
+     NX_INTR28 = 27;
+     NX_INTR29 = 28;
+     NX_INTR30 = 29;
+     NX_INTR31 = 30;
+     NX_INTR32 = 31;
+     NX_INTR33 = 32;
+     NX_INTR34 = 33;
+     NX_INTR35 = 34;
+     NX_INTR36 = 35;
+     NX_INTR37 = 36;
+     NX_INTR38 = 37;
+     NX_INTR39 = 38;
+     NX_INTR40 = 39;
+     NX_INTR41 = 40;
+     NX_INTR42 = 41;
+     NX_INTR43 = 42;
+     NX_INTR44 = 43;
+     NX_INTR45 = 44;
+     NX_INTR46 = 45;
+     NX_INTR47 = 46;
+     NX_INTR48 = 47;
+     NX_INTR49 = 48;
+     NX_INTR50 = 49;
+     NX_INTR51 = 50;
+     NX_INTR52 = 51;
+     NX_INTR53 = 52;
+     NX_INTR54 = 53;
+     NX_INTR55 = 54;
+     NX_INTR56 = 55;
+     NX_INTR57 = 56;
+     NX_INTR58 = 57;
+     NX_INTR59 = 58;
+     NX_INTR60 = 59;
+     NX_INTR61 = 60;
+     NX_INTR62 = 61;
+     NX_INTR63 = 62;
+     NX_INTR64 = 63;
+
+
+type
+
+   PNXBool_t = ^NXBool_t;
+   NXBool_t = longint;
+
+   PNXVmId_t = ^NXVmId_t;
+   NXVmId_t = longint;
+{ values for NXInterruptId_t...  }
+
+
+// nks/dirio.h
+// nks/fsio.h
+// unilib.h
+
+  const
+     UNI_ERR_MEM_ALLOC = -(494);
+  { nonexistant rule table handle      }
+     UNI_ERR_BAD_HANDLE = -(496);
+  { table corruption detected          }
+     UNI_ERR_TABLE_CORRUPT = -(498);
+  { insufficient room in string        }
+     UNI_ERR_TOO_FEW_BYTES = -(500);
+  { unable to open data file           }
+     UNI_ERR_FILE_OPEN = -(501);
+  {                                    }
+     UNI_ERR_FILE_EXIST = -(502);
+  { unable to read data file           }
+     UNI_ERR_FILE_READ = -(504);
+  { functional stub only               }
+     UNI_ERR_UNIMPLEMENTED = -(505);
+  { premature end-of-string            }
+     UNI_ERR_PREMATURE_END = -(506);
+  { discovered during translation      }
+     UNI_ERR_UNMAPPABLE_CHAR = -(532);
+  { invalid UTF-8 character sequence   }
+     UNI_ERR_INVALID_UTF8_SEQ = $FFFF;
+  { the local, default rule table for argument 'table' below...  }
+  { respective to local codepage       }
+     UNI_LOCAL_DEFAULT = -(1);
+  { 'noMapFlag' values; when no mapping found...  }
+  { return UNI_ERR_UNMAPPABLE_CHAR     }
+     UNI_MAP_NO_CHAR = 0;
+  { use value in 'noMapChar' unless 0  }
+     UNI_MAP_CHAR = 1;
+  { use 'noMapFunc' if non-nil         }
+     UNI_MAP_BY_FUNC = 1;
+  { use character itself               }
+     UNI_MAP_SELF = 2;
+  { no-map character if 'noMapChar' 0  }
+     UNI_NOMAP_DEFAULT = '?';
+  { character classification (UniClass_t)...  }
+  { no classification                      }
+     UNI_UNDEF = $00000000;
+  { control character                      }
+     UNI_CNTRL = $00000001;
+  { non-printing space                     }
+     UNI_SPACE = $00000002;
+  { printing (visible) character           }
+     UNI_PRINT = $00000004;
+  { dingbats, special symbols, et al.      }
+     UNI_SPECIAL = $00000008;
+  { general punctuation                    }
+     UNI_PUNCT = $00000010;
+  { decimal digit                          }
+     UNI_DIGIT = $00000020;
+  { hexadecimal digit                      }
+     UNI_XDIGIT = $00000040;
+  { reserved for future use                }
+     UNI_RESERVED1 = $00000080;
+  { lower-case if applicable               }
+     UNI_LOWER = $00000100;
+  { upper-case if applicable               }
+     UNI_UPPER = $00000200;
+  { reserved for future use                }
+     UNI_RESERVED2 = $00000400;
+  { non-number, non-punctuation including: }
+     UNI_ALPHA = $00000800;
+  { Latin-based                            }
+     UNI_LATIN = $00001000;
+  { Greek                                  }
+     UNI_GREEK = $00002000;
+  { Cyrillic                               }
+     UNI_CYRILLIC = $00004000;
+  { Hebrew                                 }
+     UNI_HEBREW = $00008000;
+  { Arabic                                 }
+     UNI_ARABIC = $00010000;
+  { Chinese/Japanese/Korean characters     }
+     UNI_CJK = $00020000;
+  { Devanagari, Bengali, Tamil, et al.     }
+     UNI_INDIAN = $00040000;
+  { southeast Asia: Thai, Lao              }
+     UNI_SEASIA = $00080000;
+  { cent. Asia: Armenian Tibetain, Georg.  }
+     UNI_CENASIA = $00100000;
+  { none of the above                      }
+     UNI_OTHER = $80000000;
+
+
+type
+   Punicode_t = ^unicode_t;
+   unicode_t = wchar_t;
+   PPunicode_t = ^Punicode_t;
+
+   PUniRuleTable_t = ^UniRuleTable_t;
+   UniRuleTable_t = longint;
+{ more a cookie than anything else      }
+
+   PUniClass_t = ^UniClass_t;
+   UniClass_t = dword;
+{ Unicode character classification       }
+{ for uni2mono(), unicase(), et al.      }
+{ default monocasing as implemented      }
+{ character is not 'alphabetic'          }
+{ character has no case                  }
+{ emphatically upper case                }
+{ emphatically lower case                }
+
+   PUniCase_t = ^UniCase_t;
+   UniCase_t =  Longint;
+   Const
+     UNI_CASE_DEFAULT = $FFFFFFFD;
+     UNI_CASE_NONE = $FFFFFFFE;
+     UNI_CASE_AMBIGUOUS = $FFFFFFFF;
+     UNI_CASE_UPPER = $00000000;
+     UNI_CASE_LOWER = $00000001;
+     UNI_CASE_TITLE = $00000002;
+
+{ unmappable character handling function types...  }
+
+type
+
+   Loc2UniNoMapFunc_t = function (dest:PPunicode_t; remaining:size_t; src:PPchar; userParm:pointer):longint;cdecl;
+
+
+   Loc2Utf8NoMapFunc_t = function (dest:PPchar; remaining:size_t; src:PPchar; userParm:pointer):longint;cdecl;
+
+
+   Utf82LocNoMapFunc_t = function (dest:PPchar; remaining:size_t; src:PPchar; userParm:pointer):longint;cdecl;
+
+
+   Utf82UniNoMapFunc_t = function (dest:PPchar; remaining:size_t; src:PPunicode_t; userParm:pointer):longint;cdecl;
+
+
+   Uni2LocNoMapFunc_t = function (dest:PPchar; remaining:size_t; src:PPunicode_t; userParm:pointer):longint;cdecl;
+
+
+   Uni2Utf8NoMapFunc_t = function (dest:PPchar; remaining:size_t; src:PPunicode_t; userParm:pointer):longint;cdecl;
+{ rule table management...  }
+
+function UniGetTable(codePage:longint; table:PUniRuleTable_t):longint;cdecl;external libc_nlm name 'UniGetTable';
+
+function UniGetMacintoshTable(name:Pchar; table:PUniRuleTable_t):longint;cdecl;external libc_nlm name 'UniGetMacintoshTable';
+function UniSetDefault(table:UniRuleTable_t):longint;cdecl;external libc_nlm name 'UniSetDefault';
+function UniDisposeTable(table:UniRuleTable_t):longint;cdecl;external libc_nlm name 'UniDisposeTable';
+function UniGetHostCodePage:longint;cdecl;external libc_nlm name 'UniGetHostCodePage';
+{ translation between local and other codepages, Unicode and UTF-8...  }
+
+function loc2uni(table:UniRuleTable_t; dest:Punicode_t; src:Pchar; noMapCh:unicode_t; noMapFlag:longint):longint;cdecl;external libc_nlm name 'loc2uni';
+
+function loc2unipath(table:UniRuleTable_t; dest:Punicode_t; src:Pchar; dryRunSize:Psize_t):longint;cdecl;external libc_nlm name 'loc2unipath';
+
+function locn2uni(table:UniRuleTable_t; dest:Punicode_t; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapCh:unicode_t; noMapFlag:longint):longint;cdecl;external libc_nlm name 'locn2uni';
+function locnp2uni(table:UniRuleTable_t; target:PPunicode_t; destLen:Psize_t; source:PPchar; srcLen:size_t;
+           noMapCh:unicode_t; noMapFlag:longint):longint;cdecl;external libc_nlm name 'locnp2uni';
+
+function locnx2uni(table:UniRuleTable_t; dest:Punicode_t; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapFunc:Loc2UniNoMapFunc_t; noMapFuncParm:pointer; noMapFlag:longint):longint;cdecl;external libc_nlm name 'locnx2uni';
+
+function locnx2unipath(table:UniRuleTable_t; dest:Punicode_t; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapFunc:Loc2UniNoMapFunc_t; noMapFuncParm:pointer; noMapFlag:longint; dryRunSize:Psize_t):longint;cdecl;external libc_nlm name 'locnx2unipath';
+
+function locn2unispecial(handle:UniRuleTable_t; dest:Punicode_t; destLen:Psize_t; src:Pchar; srcLen:size_t):longint;cdecl;external libc_nlm name 'locn2unispecial';
+
+function loc2utf8(handle:UniRuleTable_t; dest:Pchar; src:Pchar; noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'loc2utf8';
+
+function loc2utf8path(table:UniRuleTable_t; dest:Pchar; src:Pchar; dryRunSize:Psize_t):longint;cdecl;external libc_nlm name 'loc2utf8path';
+
+function locn2utf8(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'locn2utf8';
+
+function locnx2utf8(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapFunc:Loc2Utf8NoMapFunc_t; noMapFuncParm:pointer; noMapFlag:longint):longint;cdecl;external libc_nlm name 'locnx2utf8';
+
+function uni2loc(table:UniRuleTable_t; dest:Pchar; src:Punicode_t; noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'uni2loc';
+
+function uni2locpath(table:UniRuleTable_t; dest:Pchar; src:Punicode_t; dryRunSize:Psize_t):longint;cdecl;external libc_nlm name 'uni2locpath';
+
+function unin2loc(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Punicode_t; srcLen:size_t;
+           noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'unin2loc';
+function uninp2loc(table:UniRuleTable_t; target:PPchar; destLen:Psize_t; source:PPunicode_t; srcLen:size_t;
+           noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'uninp2loc';
+
+function uninx2loc(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Punicode_t; srcLen:size_t;
+           noMapFunc:Uni2LocNoMapFunc_t; noMapFuncParm:pointer; noMapFlag:longint):longint;cdecl;external libc_nlm name 'uninx2loc';
+
+function uninx2locpath(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Punicode_t; srcLen:size_t;
+           noMapFunc:Uni2LocNoMapFunc_t; noMapFuncParm:pointer; noMapFlag:longint; dryRunSize:Psize_t):longint;cdecl;external libc_nlm name 'uninx2locpath';
+
+function unin2locspecial(handle:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Punicode_t; srcLen:size_t):longint;cdecl;external libc_nlm name 'unin2locspecial';
+
+function uni2utf8(dest:Pchar; src:Punicode_t):longint;cdecl;external libc_nlm name 'uni2utf8';
+
+function uni2utf8path(dest:Pchar; src:Punicode_t; dryRunSize:Psize_t):longint;cdecl;external libc_nlm name 'uni2utf8path';
+
+function unin2utf8(dest:Pchar; destLen:Psize_t; src:Punicode_t; srcLen:size_t):longint;cdecl;external libc_nlm name 'unin2utf8';
+
+function utf82loc(handle:UniRuleTable_t; dest:Pchar; src:Pchar; noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'utf82loc';
+
+function utf8n2loc(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapCh:char; noMapFlag:longint):longint;cdecl;external libc_nlm name 'utf8n2loc';
+
+function utf8nx2loc(table:UniRuleTable_t; dest:Pchar; destLen:Psize_t; src:Pchar; srcLen:size_t;
+           noMapFunc:Utf82LocNoMapFunc_t; noMapFuncParm:pointer; noMapFlag:longint):longint;cdecl;external libc_nlm name 'utf8nx2loc';
+
+function utf82uni(dest:Punicode_t; src:Pchar):longint;cdecl;external libc_nlm name 'utf82uni';
+
+function utf8n2uni(dest:Punicode_t; destLen:Psize_t; src:Pchar; srcLen:size_t):longint;cdecl;external libc_nlm name 'utf8n2uni';
+{ quick, 7-bit ASCII-capable translations--not preferred set...  }
+
+function asc2uni(dest:Punicode_t; src:Pchar):Punicode_t;cdecl;external libc_nlm name 'asc2uni';
+
+function ascn2uni(dest:Punicode_t; src:Pchar; nbytes:size_t):Punicode_t;cdecl;external libc_nlm name 'ascn2uni';
+
+function uni2asc(dest:Pchar; src:Punicode_t):Pchar;cdecl;external libc_nlm name 'uni2asc';
+
+function unin2asc(dest:Pchar; src:Punicode_t; nchars:size_t):Pchar;cdecl;external libc_nlm name 'unin2asc';
+{ default 'noMapFunc' for X-translation to ensure round-trip conversion...  }
+
+function LocToUniTagFunc(dest:PPunicode_t; remaining:size_t; src:PPchar; userParm:pointer):longint;cdecl;external libc_nlm name 'LocToUniTagFunc';
+
+function UniToLocTagFunc(dest:PPchar; remaining:size_t; src:PPunicode_t; userParm:pointer):longint;cdecl;external libc_nlm name 'UniToLocTagFunc';
+{ string size calculation...  }
+
+function LocToUniSize(table:UniRuleTable_t; str:Pchar; unmappedCharSize:size_t; noMapFlag:longint; uniBufSize:Psize_t):longint;cdecl;external libc_nlm name 'LocToUniSize';
+
+function LocToUtf8Size(table:UniRuleTable_t; str:Pchar; unmappedCharSize:size_t; noMapFlag:longint; utf8BufSize:Psize_t):longint;cdecl;external libc_nlm name 'LocToUtf8Size';
+
+function UniToLocSize(table:UniRuleTable_t; str:Punicode_t; unmappedCharSize:size_t; noMapFlag:longint; locBufSize:Psize_t):longint;cdecl;external libc_nlm name 'UniToLocSize';
+
+function UniToUtf8Size(str:Punicode_t; utf8BufSize:Psize_t):longint;cdecl;external libc_nlm name 'UniToUtf8Size';
+
+function Utf8ToLocSize(table:UniRuleTable_t; str:Pchar; unmappedCharSize:size_t; noMapFlag:longint; locBufSize:Psize_t):longint;cdecl;external libc_nlm name 'Utf8ToLocSize';
+
+function Utf8ToUniSize(str:Pchar; uniBufSize:Psize_t):longint;cdecl;external libc_nlm name 'Utf8ToUniSize';
+{-----------------------------------------------------------------------------
+** Little utility functions. These are not to be preferred over the interfaces
+** from wchar.h.
+ }
+{ utility to measure width of a character in a codepage...  }
+
+function dbcs_width(codepage:longint; str:Pchar):longint;cdecl;external libc_nlm name 'dbcs_width';
+{ classification...  }
+function unitype(ch:unicode_t):UniClass_t;cdecl;external libc_nlm name 'unitype';
+{ collation...  }
+
+
+function unicoll(s1:Punicode_t; s2:Punicode_t):longint;cdecl;external libc_nlm name 'unicoll';
+
+
+function unincoll(s1:Punicode_t; s2:Punicode_t; n:size_t):longint;cdecl;external libc_nlm name 'unincoll';
+{ casing...  }
+function unicase(ch:unicode_t):UniCase_t;cdecl;external libc_nlm name 'unicase';
+
+function uni2mono(dest:Punicode_t; src:Punicode_t; casing:UniCase_t):Punicode_t;cdecl;external libc_nlm name 'uni2mono';
+
+function unin2mono(dest:Punicode_t; src:Punicode_t; casing:UniCase_t; destLen:size_t):Punicode_t;cdecl;external libc_nlm name 'unin2mono';
+function chr2upr(ch:unicode_t):unicode_t;cdecl;external libc_nlm name 'chr2upr';
+function chr2lwr(ch:unicode_t):unicode_t;cdecl;external libc_nlm name 'chr2lwr';
+function chr2title(ch:unicode_t):unicode_t;cdecl;external libc_nlm name 'chr2title';
+function unilwr(_string:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unilwr';
+function uniupr(_string:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'uniupr';
+
+function uni2lwr(dest:Punicode_t; src:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'uni2lwr';
+
+function unin2lwr(dest:Punicode_t; src:Punicode_t; destLen:size_t):Punicode_t;cdecl;external libc_nlm name 'unin2lwr';
+
+function uni2upr(dest:Punicode_t; src:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'uni2upr';
+
+function unin2upr(dest:Punicode_t; src:Punicode_t; destLen:size_t):Punicode_t;cdecl;external libc_nlm name 'unin2upr';
+
+function uni2title(dest:Punicode_t; src:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'uni2title';
+
+function unin2title(dest:Punicode_t; src:Punicode_t; destLen:size_t):Punicode_t;cdecl;external libc_nlm name 'unin2title';
+{ length...  }
+
+function unilen(_string:Punicode_t):size_t;cdecl;external libc_nlm name 'unilen';
+
+function uninlen(_string:Punicode_t; max:size_t):size_t;cdecl;external libc_nlm name 'uninlen';
+
+function unisize(_string:Punicode_t):size_t;cdecl;external libc_nlm name 'unisize';
+{ copying...  }
+
+function unicpy(tgt:Punicode_t; src:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unicpy';
+
+function unincpy(tgt:Punicode_t; src:Punicode_t; n:size_t):Punicode_t;cdecl;external libc_nlm name 'unincpy';
+function uniset(base:Punicode_t; ch:unicode_t):Punicode_t;cdecl;external libc_nlm name 'uniset';
+function uninset(base:Punicode_t; ch:unicode_t; n:size_t):Punicode_t;cdecl;external libc_nlm name 'uninset';
+{ concatenation...  }
+
+function unicat(tgt:Punicode_t; src:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unicat';
+
+function unincat(tgt:Punicode_t; src:Punicode_t; n:size_t):Punicode_t;cdecl;external libc_nlm name 'unincat';
+
+{$ifndef DisableArrayOfConst}
+function unilist(tgt:Punicode_t; s1:Punicode_t; args:array of const):Punicode_t;cdecl;external libc_nlm name 'unilist';
+{$endif}
+function unilist(tgt:Punicode_t; s1:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unilist';
+{ comparison...  }
+
+
+function unicmp(s1:Punicode_t; s2:Punicode_t):longint;cdecl;external libc_nlm name 'unicmp';
+
+
+function uniicmp(s1:Punicode_t; s2:Punicode_t):longint;cdecl;external libc_nlm name 'uniicmp';
+
+
+function unincmp(s1:Punicode_t; s2:Punicode_t; n:size_t):longint;cdecl;external libc_nlm name 'unincmp';
+
+
+function uninicmp(s1:Punicode_t; s2:Punicode_t; n:size_t):longint;cdecl;external libc_nlm name 'uninicmp';
+{ character matching, indexing and miscellaneous...  }
+
+function unichr(_string:Punicode_t; ch:unicode_t):Punicode_t;cdecl;external libc_nlm name 'unichr';
+function unirchr(_string:Punicode_t; ch:unicode_t):Punicode_t;cdecl;external libc_nlm name 'unirchr';
+function uniindex(_string:Punicode_t; search:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'uniindex';
+function unistr(as1:Punicode_t; as2:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unistr';
+function unirev(base:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unirev';
+function unispn(_string:Punicode_t; charset:Punicode_t):size_t;cdecl;external libc_nlm name 'unispn';
+function unicspn(_string:Punicode_t; charset:Punicode_t):size_t;cdecl;external libc_nlm name 'unicspn';
+function unipbrk(s1:Punicode_t; s2:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unipbrk';
+function unitok(_string:Punicode_t; sepset:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unitok';
+function unitok_r(_string:Punicode_t; sepset:Punicode_t; lasts:PPunicode_t):Punicode_t;cdecl;external libc_nlm name 'unitok_r';
+function unidup(s1:Punicode_t):Punicode_t;cdecl;external libc_nlm name 'unidup';
+// nks/time.h
+
+{ values for 'epoch' for NXGetTime()...  }
+{ values for 'units' for NXGetTime()...  }
+{ turn on 1-byte packing...  }
+
+type
+
+   PNXTime_t = ^NXTime_t;
+   NXTime_t = uint64_t;
+
+   PNXTimerVal_t = ^NXTimerVal_t;
+   NXTimerVal_t = record
+        tvPeriod : dword;
+        tvCurrent : dword;
+     end;
+
+   PNXTimeOut_t = ^NXTimeOut_t;
+   NXTimeOut_t = record
+        reserved1 : array[0..3] of dword;
+        toRoutine : procedure (_para1:pointer);cdecl;
+        toArg : pointer;
+        toTimerVal : NXTimerVal_t;
+        reserved2 : array[0..15] of dword;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ Time and time-out...  }
+
+function NXTimeOutCancel(tout:PNXTimeOut_t; wait:NXBool_t; status:PNXBool_t):longint;cdecl;external libc_nlm name 'NXTimeOutCancel';
+function NXTimeOutSchedule(tout:PNXTimeOut_t):longint;cdecl;external libc_nlm name 'NXTimeOutSchedule';
+function NXGetTime(epoch:longint; units:longint; time:PNXTime_t):longint;cdecl;external libc_nlm name 'NXGetTime';
+
+
+// nks/thread.h
+// nks/plat.h
+type
+
+   PNXCpuId_t = ^NXCpuId_t;
+   NXCpuId_t = longint;
+{ Platform-specific services...  }
+
+function NXGetCacheLineSize:size_t;cdecl;external libc_nlm name 'NXGetCacheLineSize';
+function NXGetCpuCount:dword;cdecl;external libc_nlm name 'NXGetCpuCount';
+function NXGetCpuId:NXCpuId_t;cdecl;external libc_nlm name 'NXGetCpuId';
+function NXGetPageSize:size_t;cdecl;external libc_nlm name 'NXGetPageSize';
+function NXSeedRandom(width:size_t; seed:pointer):longint;cdecl;external libc_nlm name 'NXSeedRandom';
+function NXGetSystemTick:dword;cdecl;external libc_nlm name 'NXGetSystemTick';
+{ values for thread priority...  }
+{ values for thread context flags...  }
+{ values for thread flags...  }
+{ value returned that specifies that the thread is unbound  }
+{ value passed to NXThreadBind to bind it to the current CPU  }
+{ return from NXThreadGetId indicating no-context or other error  }
+
+{ turn on 1-byte packing...  }
+
+type
+
+   PNXContext_t = ^NXContext_t;
+   NXContext_t = void;
+
+   PNXWorkId_t = ^NXWorkId_t;
+   NXWorkId_t = longint;
+
+   PNXKey_t = ^NXKey_t;
+   NXKey_t = longint;
+
+   PNXThreadId_t = ^NXThreadId_t;
+   NXThreadId_t = longint;
+
+   PNXInterruptId_t = ^NXInterruptId_t;
+   NXInterruptId_t = longint;
+
+   PNXInterruptSet_t = ^NXInterruptSet_t;
+   NXInterruptSet_t = uint64_t;
+
+   PNXContextState_t = ^NXContextState_t;
+   NXContextState_t =  Longint;
+   Const
+     NX_CTXSTATE_INIT = $FFFFFFFF;
+     NX_CTXSTATE_BOUND = $00000001;
+     NX_CTXSTATE_UNBOUND = $00000000;
+
+type
+
+   PNXContextInfo_t = ^NXContextInfo_t;
+   NXContextInfo_t = record
+        ciState : NXContextState_t;
+        ciFunc : procedure (_para1:pointer);cdecl;
+        ciArg : pointer;
+        ciPriority : longint;
+        ciStackSize : size_t;
+        ciFlags : dword;
+     end;
+
+   PlwWork = ^lwWork;
+   lwWork = record
+        reserved : array[0..6] of pointer;
+        lwWorkFunc : procedure (_para1:PlwWork; _para2:pointer);cdecl;
+        lwAppRef : pointer;
+     end;
+   NXLwWork_t = lwWork;
+   PNXLwWork_t = ^NXLwWork_t;
+
+(** unsupported pragma#pragma pack()*)
+{ Context management...  }
+
+type TCDeclProc1PtrArg = procedure (_para1:pointer); cdecl;
+
+function NXContextAlloc(start_routine:TCDeclProc1PtrArg; arg:pointer; priority:longint; stackSize:size_t; flags:dword;
+           error:Plongint):NXContext_t;cdecl;external libc_nlm name 'NXContextAlloc';
+function NXContextFree(ctx:NXContext_t):longint;cdecl;external libc_nlm name 'NXContextFree';
+function NXContextGet:NXContext_t;cdecl;external libc_nlm name 'NXContextGet';
+function NXContextGetInfo(ctx:NXContext_t; info:PNXContextInfo_t):longint;cdecl;external libc_nlm name 'NXContextGetInfo';
+function NXContextGetName(ctx:NXContext_t; name:Pchar; len:size_t):longint;cdecl;external libc_nlm name 'NXContextGetName';
+function NXContextReinit(ctx:NXContext_t; start_routine:TCDeclProc1PtrArg; arg:pointer; priority:longint; flags:dword):longint;cdecl;external libc_nlm name 'NXContextReinit';
+
+function NXContextSetName(ctx:NXContext_t; name:Pchar):longint;cdecl;external libc_nlm name 'NXContextSetName';
+{ Key-value pairs (per-context data)...  }
+type TCdeclProc = procedure; cdecl;
+function NXKeyCreate(_destructor: TCDeclProc; value:pointer; key:PNXKey_t):longint;cdecl;external libc_nlm name 'NXKeyCreate';
+function NXKeyDelete(key:NXKey_t):longint;cdecl;external libc_nlm name 'NXKeyDelete';
+function NXKeyGetValue(key:NXKey_t; value:Ppointer):longint;cdecl;external libc_nlm name 'NXKeyGetValue';
+function NXKeySetValue(key:NXKey_t; value:pointer):longint;cdecl;external libc_nlm name 'NXKeySetValue';
+{ Thread management...  }
+function NXThreadBind(cpu_id:NXCpuId_t):longint;cdecl;external libc_nlm name 'NXThreadBind';
+function NXThreadContinue(tid:NXThreadId_t):longint;cdecl;external libc_nlm name 'NXThreadContinue';
+function NXThreadCreate(ctx:NXContext_t; flags:dword; idp:PNXThreadId_t):longint;cdecl;external libc_nlm name 'NXThreadCreate';
+function NXThreadCreateSx(start_routine:TCDeclProc1PtrArg; arg:pointer; thread_flags:dword; ctx:PNXContext_t; thr:PNXThreadId_t):longint;cdecl;external libc_nlm name 'NXThreadCreateSx';
+procedure NXThreadDelay(delay:dword);cdecl;external libc_nlm name 'NXThreadDelay';
+function NXThreadDestroy(tid:NXThreadId_t):longint;cdecl;external libc_nlm name 'NXThreadDestroy';
+function NXThreadDetach(tid:NXThreadId_t):longint;cdecl;external libc_nlm name 'NXThreadDetach';
+procedure NXThreadExit(status:pointer);cdecl;external libc_nlm name 'NXThreadExit';
+function NXThreadGetBinding:NXCpuId_t;cdecl;external libc_nlm name 'NXThreadGetBinding';
+function NXThreadGetContext(tid:NXThreadId_t; ctx:PNXContext_t):longint;cdecl;external libc_nlm name 'NXThreadGetContext';
+function NXThreadGetId:NXThreadId_t;cdecl;external libc_nlm name 'NXThreadGetId';
+function NXThreadGetPriority(tid:NXThreadId_t; priority:Plongint):longint;cdecl;external libc_nlm name 'NXThreadGetPriority';
+function NXThreadInterrupt(tid:NXThreadId_t; interId:NXInterruptId_t):longint;cdecl;external libc_nlm name 'NXThreadInterrupt';
+function NXThreadIsInterrupted(_set:PNXInterruptSet_t):NXBool_t;cdecl;external libc_nlm name 'NXThreadIsInterrupted';
+function NXThreadJoin(wait_for:NXThreadId_t; departed_thread:PNXThreadId_t; status:Ppointer):longint;cdecl;external libc_nlm name 'NXThreadJoin';
+function NXThreadSetPriority(tid:NXThreadId_t; priority:longint):longint;cdecl;external libc_nlm name 'NXThreadSetPriority';
+function NXThreadSuspend(tid:NXThreadId_t):longint;cdecl;external libc_nlm name 'NXThreadSuspend';
+function NXThreadSwapContext(newctx:NXContext_t; prevctx:PNXContext_t):longint;cdecl;external libc_nlm name 'NXThreadSwapContext';
+function NXThreadUnbind:longint;cdecl;external libc_nlm name 'NXThreadUnbind';
+procedure NXThreadYield;cdecl;external libc_nlm name 'NXThreadYield';
+function nxThreadCreate(start_routine:TCDeclProc1PtrArg; flags:dword; arg:pointer; ctxp:PNXContext_t; idp:PNXThreadId_t):longint;cdecl;external libc_nlm name 'nxThreadCreate';
+{ Work-to-dos...  }
+function NXDelayedWorkSchedule(ctx:NXContext_t; timerval:PNXTimerVal_t; bind:NXBool_t; wid:PNXWorkId_t):longint;cdecl;external libc_nlm name 'NXDelayedWorkSchedule';
+function NXLwWorkCancel(work:PNXLwWork_t):longint;cdecl;external libc_nlm name 'NXLwWorkCancel';
+function NXLwWorkSchedule(reserved:pointer; work:PNXLwWork_t; bind:NXBool_t):longint;cdecl;external libc_nlm name 'NXLwWorkSchedule';
+function NXWorkCancel(wid:NXWorkId_t; wait:NXBool_t; status:PNXBool_t):longint;cdecl;external libc_nlm name 'NXWorkCancel';
+function NXWorkSchedule(context:NXContext_t; bind:NXBool_t; wid:PNXWorkId_t):longint;cdecl;external libc_nlm name 'NXWorkSchedule';
+{ Miscellaneous...  }
+function NXProcessInterruptSet(_set:PNXInterruptSet_t; id:NXInterruptId_t; processed_id:PNXInterruptId_t):NXBool_t;cdecl;external libc_nlm name 'NXProcessInterruptSet';
+{ values and masks for file modes...  }
+{ values and masks for file operations...  }
+{ for NXDeviceOpen() and NXConsoleOpen()...  }
+{ aliases for above...  }
+{ open flags...  }
+{ sharing flags...  }
+{ delegation type...  }
+{ flush flags...  }
+{ values and masks for access flags...  }
+{ values for setting file length...  }
+{ values for file byte-range locking flags...  }
+
+
+{ turn on 1-byte packing...  }
+
+  const
+     NX_MAX_NAME_LEN = 255;
+  { (big! --this isn't used yet)  }
+{$define NX_MAX_FILESIZE}
+  { values and masks for file modes...  }
+     NX_O_RDONLY = $00000000;
+     NX_O_WRONLY = $00000001;
+     NX_O_RDWR = $00000002;
+     NX_O_ACCMODE = $00000003;
+  { values and masks for file operations...  }
+     NX_O_APPEND = $00000010;
+     NX_O_CREAT = $00000020;
+     NX_O_TRUNC = $00000040;
+     NX_O_EXCL = $00000080;
+     NX_O_TRANS = $00000100;
+     NX_O_NONBLOCK = $00000400;
+     NX_O_OPMODE = $000005E0;
+  { for NXDeviceOpen() and NXConsoleOpen()...  }
+     NX_O_SCROLLABLE = $00000800;
+  { aliases for above...  }
+     NX_O_CREATE = NX_O_CREAT;
+     NX_O_TRUNCATE = NX_O_TRUNC;
+     NX_O_EXCLUSIVE = NX_O_EXCL;
+  { open flags...  }
+     NX_OFLAG_DIRECTIO = $00010000;
+     NX_OFLAG_CRONLY = $00020000;
+     NX_OFLAG_BACKUP = $00040000;
+     NX_OFLAG_RESTORE = $00080000;
+     NX_OFLAG_EXTEND = $00100000;
+     NX_OFLAG_SYNCWR = $00200000;
+     NX_OFLAG_ATOMIC_RW = $00400000;
+     NX_OFLAG_NOTRAVERSE_LINK = $00800000;
+     NX_OFLAG_MASK = $00FF0000;
+  { sharing flags...  }
+     NX_SHARE_DENYNO = $00000000;
+     NX_SHARE_DENYRD = $00100000;
+     NX_SHARE_DENYWR = $00200000;
+     NX_SHARE_DENYALL = $00400000;
+     NX_SHARE_MASK = $00700000;
+  { delegation type...  }
+     NX_DELEG_NONE = $00000000;
+  { flush flags...  }
+     NX_FLUSH_DATA = $00000001;
+     NX_FLUSH_METADATA = $00000002;
+     NX_FLUSH_ASYNC = $00000004;
+  { values and masks for access flags...  }
+     NX_R_OK = $00000001;
+     NX_W_OK = $00000002;
+     NX_X_OK = $00000004;
+     NX_F_OK = $00000008;
+  { values for setting file length...  }
+     NX_FOP_RETURN_EXTEND = $00000001;
+     NX_FOP_RETURN_TRUNC_FREE = $00000002;
+     NX_FOP_RETURN_SPARSE = $00000004;
+  { values for file byte-range locking flags...  }
+     NX_RANGE_LOCK_SHARED = $00000001;
+     NX_RANGE_LOCK_EXCL = $00000002;
+     NX_RANGE_LOCK_CHECK = $00000004;
+     NX_RANGE_LOCK_TRYLOCK = $00000008;
+     NX_RANGE_LOCK_COURTESY = $00000010;
+     NX_RANGE_LOCK_CANCEL = $00000020;
+     NX_RANGE_LOCK_POSIX = $00000040;
+
+
+
+type
+   //Pfsio = ^fsio;
+   //fsio = record
+       {undefined structure}
+    // end;
+
+
+   PNXMode_t = ^NXMode_t;
+   NXMode_t = dword;
+
+   PNXOFlags_t = ^NXOFlags_t;
+   NXOFlags_t = dword;
+
+   PNXShareMode_t = ^NXShareMode_t;
+   NXShareMode_t = dword;
+
+   PNXOffset_t = ^NXOffset_t;
+   NXOffset_t = uint64_t;
+{ (file offsets and lengths)  }
+
+   PNXSOffset_t = ^NXSOffset_t;
+   NXSOffset_t = int64_t;
+
+   PNXLockToken_t = ^NXLockToken_t;
+   NXLockToken_t = uint64_t;
+
+   PNXHandle_t = ^NXHandle_t;
+   NXHandle_t = longint;
+
+   PNXPathCtx_t = ^NXPathCtx_t;
+   NXPathCtx_t = longint;
+
+   PNXDelegType_t = ^NXDelegType_t;
+   NXDelegType_t = longint;
+
+   PNXAsyncId_t = ^NXAsyncId_t;
+   NXAsyncId_t = void;
+{ I/O objects supported...  }
+
+   PNXObjType_t = ^NXObjType_t;
+   NXObjType_t =  Longint;
+   Const
+     NX_OBJ_UNKNOWN = $FFFFFFFF;
+     NX_OBJ_DEFAULT = $FFFFFFFE;
+     NX_OBJ_FILE = $FFFFFFFD;
+     NX_OBJ_DIR = $FFFFFFFC;
+     NX_OBJ_FIFO = $FFFFFFFB;
+     NX_OBJ_DEVICE = $FFFFFFFA;
+     NX_OBJ_CONSOLE = $FFFFFFF9;
+     NX_OBJ_SYMLINK = $FFFFFFF8;
+
+type
+
+   PNXGuid_t = ^NXGuid_t;
+   NXGuid_t = record
+       case longint of
+          0 : ( guid_field : array[0..1] of uint64_t );
+       end;
+
+   PNXFid_t = ^NXFid_t;
+   NXFid_t = record
+        fidFsId : NXGuid_t;
+        fidFileId : array[0..1] of uint64_t;
+     end;
+
+   PNXUpCallReason_t = ^NXUpCallReason_t;
+   NXUpCallReason_t =  Longint;
+   Const
+     NX_UPCALL_UNKNOWN = $FFFFFFFF;
+     NX_UPCALL_DELEGRECALL = $00000000;
+     NX_UPCALL_BACKUPIMMINENT = $00000001;
+
+ Const
+     NX_LOCK_RANGE_UNKNOWN = 2147483647;
+     NX_LOCK_RANGE_FORWARD = 1;
+     NX_LOCK_RANGE_BACKWARD = 2;
+
+type
+
+   NXFsUpCall_t = procedure (fileHandle:NXHandle_t; reason:NXUpCallReason_t; parm:pointer);cdecl;
+{ generic filesystem name if used            }
+{ Macintosh data stream (data or resource)   }
+
+   PNXDataStream_t = ^NXDataStream_t;
+   NXDataStream_t = record
+       case longint of
+          0 : ( name : pointer );
+          1 : ( macintoshId : dword );
+       end;
+{ based on which 'fosPathname' is understood }
+
+{ relative to 'fosPathCtx'                   }
+{ NX_O_RDONLY, NX_O_RDWR, etc.               }
+{ NX_OFLAG_SYNCWR, NX_OFLAG_DIRECTIO, etc.   }
+{ NX_SHARE_DENYRD, NX_DENY_ALL, etc.         }
+{ contiguous file block allocation hint      }
+{ contiguous file block allocation hint      }
+{ delegation type: NX_DELEG_NONE             }
+{ data stream (if not part of fosPathname)   }
+{ called to warn of delegation revocation    }
+{ description of successful conclusion       }
+{ actual grant of delegation                 }
+{ returns FID of opened file                 }
+{ time of last access                        }
+{ time of last modification                  }
+{ time of file creation                     }
+{ time of last back-up                       }
+{ length of file at open                     }
+{ create/open operation results              }
+
+   PNXFileOpenSpec_t = ^NXFileOpenSpec_t;
+   NXFileOpenSpec_t = record
+        fosPathCtx : NXPathCtx_t;
+        fosPathname : pointer;
+        fosMode : NXMode_t;
+        fosOFlags : NXOFlags_t;
+        fosShareMode : NXShareMode_t;
+        fosExtentSize : size_t;
+        reserved1 : dword;
+        fosDelegType : NXDelegType_t;
+        fosDataStream : NXDataStream_t;
+        fosUpCallFunc : NXFsUpCall_t;
+        fosResult : record
+             actionTaken : NXMode_t;
+             delegType : NXDelegType_t;
+             fid : NXFid_t;
+             accessTime : NXTime_t;
+             modifyTime : NXTime_t;
+             creationTime : NXTime_t;
+             archiveTime : NXTime_t;
+             length : NXOffset_t;
+          end;
+        reserved2 : dword;
+        reserved3 : dword;
+     end;
+   Pfsio = ^fsio;
+   NXIoComp_t = function (ioInfo:Pfsio):longint;cdecl;
+{ length of I/O buffer                       }
+{ pointer to data for I/O operation          }
+{ application-maintained reference           }
+
+   PNXIoVec_t = ^NXIoVec_t;
+   NXIoVec_t = record
+        ivLength : size_t;
+        reserved : dword;
+        ivBuffer : pointer;
+        ivOpRef : pointer;
+     end;
+{ I/O objects supported...  }
+{ For Internal Use Only                }
+
+   PNXLockRange_t = ^NXLockRange_t;
+   NXLockRange_t =  Longint;
+
+
+{ application-maintained reference           }
+{ file, FIFO, console, device, etc. handle   }
+{ I/O flags and hints                        }
+{ hint as to remaining number of bytes      }
+{ from NXFileRangeLockEx()                   }
+{ completion function if asynchronous        }
+{ only for non-file system operations        }
+{ offset at which to begin I/O               }
+{ number of records in vector                }
+{ IN/OUT: I/O operation record vector        }
+{ OUT: asynchronous transaction ID           }
+{ OUT: for asynchronous use                  }
+{ OUT: total bytes written or read           }
+
+   fsio = record
+        ioAppRef : pointer;
+        ioHandle : NXHandle_t;
+        ioFlags : dword;
+        reserved : dword;
+        ioRemainingHint : NXOffset_t;
+        ioLockToken : NXLockToken_t;
+        ioCompletion : NXIoComp_t;
+        ioTimeOut : dword;
+        ioOffset : NXOffset_t;
+        ioVecCount : longint;
+        ioVector : PNXIoVec_t;
+        ioAsyncID : NXAsyncId_t;
+        ioStatus : longint;
+        ioProcessed : NXOffset_t;
+     end;
+   NXIo_t = fsio;
+   PNXIo_t = ^NXIo_t;
+{ in file (0-based)                         }
+{ magnitude of range                        }
+{ NX_LOCK_RANGE_FORWARD, ...                }
+{ usually 0; reserved to server apps        }
+{ in use only with NX_RANGE_LOCK_NETWARE    }
+
+   PNXFileLockDesc_t = ^NXFileLockDesc_t;
+   NXFileLockDesc_t = record
+        ldOffset : NXOffset_t;
+        ldLength : NXOffset_t;
+        ldDirection : NXLockRange_t;
+        ldToken : NXLockToken_t;
+        ldHandle : NXHandle_t;
+        reserved : dword;
+     end;
+
+   NXLockUpCall_t = procedure (fileHandle:NXHandle_t; appRef:pointer; lockDesc:PNXFileLockDesc_t);cdecl;
+{ application-maintained reference          }
+{ handle on which file was opened           }
+{ mandatory (TRUE) or merely advisory?     }
+{ NX_RANGE_LOCK_EXCL, etc.                  }
+{ maximum time to wait for lock             }
+{ call-back by file system to release lock  }
+{ info. on existing conflicting lock  }
+{ info. for VM holding conflicting lock }
+{ count of locks described in array         }
+{ array of lock descriptions                }
+
+   PNXFileRangeLockSpec_t = ^NXFileRangeLockSpec_t;
+   NXFileRangeLockSpec_t = record
+        rlsAppRef : pointer;
+        rlsHandle : NXHandle_t;
+        rlsMandatory : NXBool_t;
+        rlsFlags : dword;
+        rlsTimeOut : dword;
+        rlsUpCall : NXLockUpCall_t;
+        rlsConflictLockVm : NXVmId_t;
+        rlsConflictLock : NXFileLockDesc_t;
+        rlsVecCount : longint;
+        rlsDescVec : PNXFileLockDesc_t;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ File I/O...  }
+
+function NXClose(handle:NXHandle_t):longint;cdecl;external libc_nlm name 'NXClose';
+function NXFileAllocExtentWithHandle(fileHandle:NXHandle_t; offset:NXOffset_t; length:NXOffset_t; flags:dword):longint;cdecl;external libc_nlm name 'NXFileAllocExtentWithHandle';
+function NXFileCancelIo(async_id:NXAsyncId_t; wait:NXBool_t; status:PNXBool_t):longint;cdecl;external libc_nlm name 'NXFileCancelIo';
+function NXFileFlushBuffers(fileHandle:NXHandle_t; flags:dword; offset:NXOffset_t; length:NXOffset_t):longint;cdecl;external libc_nlm name 'NXFileFlushBuffers';
+
+function NXFileGetLength(pathCtx:NXPathCtx_t; pathname:pointer; length:PNXOffset_t):longint;cdecl;external libc_nlm name 'NXFileGetLength';
+function NXFileGetLengthWithHandle(fileHandle:NXHandle_t; length:PNXOffset_t):longint;cdecl;external libc_nlm name 'NXFileGetLengthWithHandle';
+
+function NXFileOpen(pathCtx:NXPathCtx_t; pathname:pointer; mode:NXMode_t; fileHandle:PNXHandle_t):longint;cdecl;external libc_nlm name 'NXFileOpen';
+function NXFileOpenEx(openSpec:PNXFileOpenSpec_t; fileHandle:PNXHandle_t):longint;cdecl;external libc_nlm name 'NXFileOpenEx';
+function NXFileRangeLock(fileHandle:NXHandle_t; flags:dword; offset:NXOffset_t; length:NXSOffset_t):longint;cdecl;external libc_nlm name 'NXFileRangeLock';
+function NXFileRangeLockEx(lockSpec:NXFileRangeLockSpec_t):longint;cdecl;external libc_nlm name 'NXFileRangeLockEx';
+function NXFileRangeUnlock(fileHandle:NXHandle_t; flags:dword; offset:NXOffset_t; length:NXSOffset_t):longint;cdecl;external libc_nlm name 'NXFileRangeUnlock';
+function NXFileRangeUnlockEx(lockSpec:NXFileRangeLockSpec_t):longint;cdecl;external libc_nlm name 'NXFileRangeUnlockEx';
+function NXFileRemoveWithHandle(handle:NXHandle_t):longint;cdecl;external libc_nlm name 'NXFileRemoveWithHandle';
+
+function NXFileRenameWithHandle(fileHandle:NXHandle_t; targetPathCtx:NXPathCtx_t; newname:pointer; overwrite:NXBool_t):longint;cdecl;external libc_nlm name 'NXFileRenameWithHandle';
+function NXFileSetLength(pathCtx:NXPathCtx_t; pathname:pointer; length:NXOffset_t; flags:dword):longint;cdecl;external libc_nlm name 'NXFileSetLength';
+function NXFileSetLengthWithHandle(fileHandle:NXHandle_t; length:NXOffset_t; flags:dword):longint;cdecl;external libc_nlm name 'NXFileSetLengthWithHandle';
+function NXRead(handle:NXHandle_t; offset:NXOffset_t; length:size_t; address:pointer; flags:dword;
+           bytesRead:Psize_t):longint;cdecl;external libc_nlm name 'NXRead';
+function NXReadEx(ioInfo:PNXIo_t; ioAsyncId:PNXAsyncId_t):longint;cdecl;external libc_nlm name 'NXReadEx';
+
+function NXRemove(pathCtx:NXPathCtx_t; pathname:pointer):longint;cdecl;external libc_nlm name 'NXRemove';
+
+
+function NXRename(sourcePathCtx:NXPathCtx_t; oldname:pointer; targetPathCtx:NXPathCtx_t; newname:pointer; overwrite:NXBool_t):longint;cdecl;external libc_nlm name 'NXRename';
+
+function NXWrite(handle:NXHandle_t; offset:NXOffset_t; length:size_t; address:pointer; flags:dword;
+           bytesWritten:Psize_t):longint;cdecl;external libc_nlm name 'NXWrite';
+function NXWriteEx(ioInfo:PNXIo_t; ioAsyncId:PNXAsyncId_t):longint;cdecl;external libc_nlm name 'NXWriteEx';
+{ Additional I/O (including FIFOs, devices, etc.)...  }
+
+function NXDeviceOpen(pathCtx:NXPathCtx_t; name:pointer; mode:NXMode_t; shareMode:NXShareMode_t; flags:dword;
+           ioBlockSize:Psize_t; deviceHandle:PNXHandle_t):longint;cdecl;external libc_nlm name 'NXDeviceOpen';
+
+function NXFifoOpen(pathCtx:NXPathCtx_t; pathname:pointer; mode:NXMode_t; fifoSize:size_t; fifoHandle:PNXHandle_t):longint;cdecl;external libc_nlm name 'NXFifoOpen';
+function NXIoSetBlockingState(handle:NXHandle_t; blocking:NXBool_t):longint;cdecl;external libc_nlm name 'NXIoSetBlockingState';
+function NXIoGetOpenMode(handle:NXHandle_t; mode:PNXMode_t):longint;cdecl;external libc_nlm name 'NXIoGetOpenMode';
+
+
+function NXLinkCreate(srcPathCtx:NXPathCtx_t; source:pointer; tgtPathCtx:PNXPathCtx_t; target:pointer; _type:longint):longint;cdecl;external libc_nlm name 'NXLinkCreate';
+
+
+function NXLinkCreateSymbolic(srcPathCtx:NXPathCtx_t; linkname:pointer; target:pointer):longint;cdecl;external libc_nlm name 'NXLinkCreateSymbolic';
+{ macro for useful alias...  }
+{ basic change bits for NXSetAttr()...  }
+{ flag values for NXDirAttr_t and NXDeEnum_t, etc...  }
+{ deEffectiveRights bits  }
+
+{ turn on 1-byte packing...  }
+
+  { basic change bits for NXSetAttr()...  }
+
+  const
+     NX_DIRENT_EFFECTIVERIGHTS = $0000000000000001;
+     NX_DIRENT_FLAGS = $0000000000000002;
+     NX_DIRENT_OWNERID = $0000000000000004;
+     NX_DIRENT_CREATETIME = $0000000000000008;
+     NX_DIRENT_CHANGETIME = $0000000000000010;
+     NX_DIRENT_ACCESSTIME = $0000000000000020;
+     NX_DIRENT_MODIFYTIME = $0000000000000040;
+     NX_DIRENT_ATTRIBUTES = $0000000000000080;
+     NX_DIRENT_RESERVED1 = $0000000000000100;
+     NX_DIRENT_RESERVED2 = $0000000000000200;
+     NX_DIRENT_RESERVED3 = $0000000000000400;
+     NX_DIRENT_RESERVED4 = $0000000000000800;
+  { flag values for NXDirAttr_t and NXDeEnum_t, etc...  }
+     NX_DEFLAGS_COMPRESSED = $00000001;
+     NX_DEFLAGS_ENCRYPTED = $00000002;
+     NX_DEFLAGS_TEMPORARY = $00000004;
+     NX_DEFLAGS_MIGRATED = $00000008;
+     NX_DEFLAGS_DELETED = $00000010;
+     NX_DEFLAGS_SPARSE = $00000020;
+  { deEffectiveRights bits  }
+     NX_READ_EXISTING_FILE = $00000001;
+     NX_WRITE_EXISTING_FILE = $00000002;
+     NX_CREATE_NEW_ENTRY = $00000008;
+     NX_DELETE_EXISTING_ENTRY = $00000010;
+     NX_CHANGE_ACCESS_CONTROL = $00000020;
+     NX_SEE_FILES = $00000040;
+     NX_MODIFY_ENTRY = $00000080;
+     NX_SUPERVISOR_PRIVILEGES = $00000100;
+     NX_ACCESS_RIGHTS_MASK = $000001FB;
+
+
+
+type
+
+   PNXChangeBits_t = ^NXChangeBits_t;
+   NXChangeBits_t = uint64_t;
+{ pathname format (PNF) enumeration         }
+{ use PNF in effect at open                 }
+{ generic NKS pathname format               }
+{ DOS                                       }
+{ Macintosh/AFP 3.0                         }
+{ UNIX/NFS                                  }
+{ Windows NT, OS/2                          }
+{ Novell Storage Services (NSS)             }
+
+   PNXPathFormat_t = ^NXPathFormat_t;
+   NXPathFormat_t =  Longint;
+   Const
+     NX_PNF_DEFAULT = 2147483647;
+     NX_PNF_NKS = 0;
+     NX_PNF_DOS = 1;
+     NX_PNF_MAC = 2;
+     NX_PNF_UNIX = 4;
+     NX_PNF_WIN = 5;
+     NX_PNF_NSS = 7;
+
+{ basic attribute information              }
+{ filename                                 }
+{ extended file system information         }
+type
+
+   PNXDeLevel_t = ^NXDeLevel_t;
+   NXDeLevel_t =  Longint;
+   Const
+     NX_DELEVEL_BASIC = $7FFFFFFF;
+     NX_DELEVEL_NAME_ONLY = $80000000;
+     NX_DELEVEL_EXTENDED = $80000001;
+
+{ marking place in directory enumeration    }
+{ all private to implementation             }
+type
+
+   PNXDirMark_t = ^NXDirMark_t;
+   NXDirMark_t = record
+        mark : array[0..43] of byte;
+        pathCtx : pointer;
+        entryInfo : pointer;
+     end;
+{ structure size is 52 bytes on NetWare     }
+{ information common to all PNF structures  }
+{ total length of entry including any       }
+{ type of entry (file, FIFO, etc.)          }
+{ file system yielding information          }
+{ level specified in NXDirEnumStart()       }
+
+   PNXDeHeader_t = ^NXDeHeader_t;
+   NXDeHeader_t = record
+        length     : size_t;
+        objectType : NXObjType_t;
+        pathFormat : NXPathFormat_t;
+        infoLevel  : NXDeLevel_t;
+     end;
+   PNXDeHeader = PNXDeHeader_t;
+   TNDDeHeader = NXDeHeader_t;
+{ common information                        }
+{                                           }
+{ length of file                            }
+{ compressed, sparse, encrypted, etc.       }
+{ timestamp of last attribute change        }
+{ timestamp of last write+attribute change  }
+{ timestamp of last write                   }
+{ preferred I/O blocksize                   }
+
+   PNXDirAttr_t = ^NXDirAttr_t;
+   NXDirAttr_t = record
+        deHeader : NXDeHeader_t;
+        deFid : NXFid_t;
+        deEffectiveRights : dword;
+        deFileSize : NXOffset_t;
+        deFlags : uint64_t;
+        deAttrChangeTime : NXTime_t;
+        deAccessTime : NXTime_t;
+        deModifyTime : NXTime_t;
+        deIoBlockSize : size_t;
+     end;
+{ plus name                                 }
+
+   PNXDirAttrWithName_t = ^NXDirAttrWithName_t;
+   NXDirAttrWithName_t = record
+        deHeader : NXDeHeader_t;
+        deName : pointer;
+     end;
+{ information fields                        }
+{ NXDirEnum- navigational mark              }
+
+   PNXDirEnum_t = ^NXDirEnum_t;
+   NXDirEnum_t = record
+        deDirAttr : NXDirAttr_t;
+        deDirMark : NXDirMark_t;
+        deName : pointer;
+     end;
+{ generic NKS (NX_PNF_NKS) attributes       }
+
+   PNXDirAttrNks_t = ^NXDirAttrNks_t;
+   NXDirAttrNks_t = record
+        xdeHeader : NXDeHeader_t;
+        xdeFid : NXFid_t;
+        xdeEffectiveRights : dword;
+        xdeFileSize : NXOffset_t;
+        xdeFlags : uint64_t;
+        xdeChangeTime : NXTime_t;
+        xdeAccessTime : NXTime_t;
+        xdeModifyTime : NXTime_t;
+        xdeCreateTime : NXTime_t;
+        xdeOwnerId : NXGuid_t;
+     end;
+{ generic NKS (NX_PNF_NKS) information...   }
+{ ...including name                         }
+
+   PNXDirEnumNks_t = ^NXDirEnumNks_t;
+   NXDirEnumNks_t = record
+        deNksDirAttr : NXDirAttrNks_t;
+        deDirMark : NXDirMark_t;
+        deName : pointer;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ Path context...  }
+
+function NXFreePathContext(pathCtx:NXPathCtx_t):longint;cdecl;external libc_nlm name 'NXFreePathContext';
+
+function NXCreatePathContext(pathCtx:NXPathCtx_t; pathname:pchar; format:NXPathFormat_t; securityBadge:pointer; newPathCtx:PNXPathCtx_t):longint;cdecl;external libc_nlm name 'NXCreatePathContext';
+function NXCreatePathContext(pathCtx:NXPathCtx_t; pathname:pchar; format:NXPathFormat_t; securityBadge:pointer; var newPathCtx:NXPathCtx_t):longint;cdecl;external libc_nlm name 'NXCreatePathContext';
+function NXCreatePathContextWithFid(fid:NXFid_t; format:NXPathFormat_t; securityBadge:pointer; newPathCtx:PNXPathCtx_t):longint;cdecl;external libc_nlm name 'NXCreatePathContextWithFid';
+{ Directory I/O...  }
+
+function NXDirCreate(pathCtx:NXPathCtx_t; pathname:pointer; reserved:pointer; newPathCtx:PNXPathCtx_t):longint;cdecl;external libc_nlm name 'NXDirCreate';
+
+function NXDirRemove(pathCtx:NXPathCtx_t; pathname:pointer):longint;cdecl;external libc_nlm name 'NXDirRemove';
+{ Directory entry attributes...  }
+
+function NXGetAttr(pathCtx:NXPathCtx_t; pathname:pointer; level:NXDeLevel_t; buffer:pointer; length:size_t;
+           flags:dword):longint;cdecl;external libc_nlm name 'NXGetAttr';
+function NXGetAttrWithHandle(handle:NXHandle_t; format:NXPathFormat_t; level:NXDeLevel_t; buffer:pointer; length:size_t;
+           flags:dword):longint;cdecl;external libc_nlm name 'NXGetAttrWithHandle';
+
+
+function NXSetAttr(pathCtx:NXPathCtx_t; pathname:pointer; level:NXDeLevel_t; buffer:pointer; changeBits:NXChangeBits_t):longint;cdecl;external libc_nlm name 'NXSetAttr';
+
+function NXSetAttrWithHandle(handle:NXHandle_t; format:NXPathFormat_t; level:NXDeLevel_t; buffer:pointer; changeBits:NXChangeBits_t):longint;cdecl;external libc_nlm name 'NXSetAttrWithHandle';
+{ Subdirectory enumeration...  }
+function NXDirMarkInit(handle:NXHandle_t; dirMark:PNXDirMark_t):longint;cdecl;external libc_nlm name 'NXDirMarkInit';
+function NXDirMarkInit(handle:NXHandle_t; var dirMark:NXDirMark_t):longint;cdecl;external libc_nlm name 'NXDirMarkInit';
+function NXDirEnumEnd(handle:NXHandle_t):longint;cdecl;external libc_nlm name 'NXDirEnumEnd';
+function NXDirEnumGetEntries(handle:NXHandle_t; start:PNXDirMark_t; buffer:pointer; length:size_t; entriesReturned:Psize_t;
+           next:PNXDirMark_t; sequenceGuarantee:PNXBool_t):longint;cdecl;external libc_nlm name 'NXDirEnumGetEntries';
+
+function NXDirEnumStart(pathCtx:NXPathCtx_t; pathname:pchar; level:NXDeLevel_t; handle:PNXHandle_t):longint;cdecl;external libc_nlm name 'NXDirEnumStart';
+function NXDirEnumStart(pathCtx:NXPathCtx_t; pathname:pchar; level:NXDeLevel_t; var handle:NXHandle_t):longint;cdecl;external libc_nlm name 'NXDirEnumStart';
+
+
+// nks/doswin.h
+// wchar.h
+{ turn on 1-byte packing...  }
+
+type
+
+   Pwint_t = ^wint_t;
+   wint_t = longint;
+
+   Pwuchar_t = ^wuchar_t;
+   wuchar_t = word;
+
+   Pmbstate_t = ^mbstate_t;
+   mbstate_t = longint;
+
+(** unsupported pragma#pragma pack()*)
+
+
+function mbsrtowcs(__restrict:Pwchar_t; __restrict1:PPchar; _para3:size_t; __restrict2:Pmbstate_t):size_t;cdecl;external libc_nlm name 'mbsrtowcs';
+
+{$ifndef DisableArrayOfConst}
+function fwprintf(__restrict:P_iobuf; __restrict1:Pwchar_t; args:array of const):longint;cdecl;external libc_nlm name 'fwprintf';
+{$endif}
+function fwprintf(__restrict:P_iobuf; __restrict1:Pwchar_t):longint;cdecl;external libc_nlm name 'fwprintf';
+
+{$ifndef DisableArrayOfConst}
+function fwscanf(__restrict:P_iobuf; __restrict1:Pwchar_t; args:array of const):longint;cdecl;external libc_nlm name 'fwscanf';
+{$endif}
+function fwscanf(__restrict:P_iobuf; __restrict1:Pwchar_t):longint;cdecl;external libc_nlm name 'fwscanf';
+
+{$ifndef DisableArrayOfConst}
+function swprintf(__restrict:Pwchar_t; _para2:size_t; __restrict1:Pwchar_t; args:array of const):longint;cdecl;external libc_nlm name 'swprintf';
+{$endif}
+function swprintf(__restrict:Pwchar_t; _para2:size_t; __restrict1:Pwchar_t):longint;cdecl;external libc_nlm name 'swprintf';
+
+{$ifndef DisableArrayOfConst}
+function swscanf(__restrict:Pwchar_t; __restrict1:Pwchar_t; args:array of const):longint;cdecl;external libc_nlm name 'swscanf';
+{$endif}
+function swscanf(__restrict:Pwchar_t; __restrict1:Pwchar_t):longint;cdecl;external libc_nlm name 'swscanf';
+
+function vfwprintf(__restrict:P_iobuf; __restrict1:Pwchar_t; _para3:va_list):longint;cdecl;external libc_nlm name 'vfwprintf';
+
+function vfwscanf(_para1:P_iobuf; _para2:Pwchar_t; _para3:va_list):longint;cdecl;external libc_nlm name 'vfwscanf';
+
+function vwscanf(_para1:Pwchar_t; _para2:va_list):longint;cdecl;external libc_nlm name 'vwscanf';
+function vswscanf(_para1:Pwchar_t; _para2:Pwchar_t; _para3:va_list):longint;cdecl;external libc_nlm name 'vswscanf';
+function wcrtomb(__restrict:Pchar; _para2:wchar_t; __restrict1:Pmbstate_t):size_t;cdecl;external libc_nlm name 'wcrtomb';
+function wcscat(__restrict:Pwchar_t; __restrict1:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcscat';
+function wcschr(_para1:Pwchar_t; _para2:wchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcschr';
+function wcscmp(_para1:Pwchar_t; _para2:Pwchar_t):longint;cdecl;external libc_nlm name 'wcscmp';
+function wcscoll(_para1:Pwchar_t; _para2:Pwchar_t):longint;cdecl;external libc_nlm name 'wcscoll';
+function wcscpy(__restrict:Pwchar_t; __restrict1:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcscpy';
+function wcscspn(_para1:Pwchar_t; _para2:Pwchar_t):size_t;cdecl;external libc_nlm name 'wcscspn';
+function wcsftime(__restrict:Pwchar_t; _para2:size_t; __restrict1:Pwchar_t; __restrict2:Ptm):size_t;cdecl;external libc_nlm name 'wcsftime';
+function wcslen(_para1:Pwchar_t):size_t;cdecl;external libc_nlm name 'wcslen';
+function wcsncat(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wcsncat';
+function wcsncmp(_para1:Pwchar_t; _para2:Pwchar_t; _para3:size_t):longint;cdecl;external libc_nlm name 'wcsncmp';
+function wcsncpy(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wcsncpy';
+function wcspbrk(_para1:Pwchar_t; _para2:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcspbrk';
+function wcsrchr(_para1:Pwchar_t; _para2:wchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcsrchr';
+function wcsrtombs(__restrict:Pchar; __restrict1:PPwchar_t; _para3:size_t; __restrict2:Pmbstate_t):size_t;cdecl;external libc_nlm name 'wcsrtombs';
+function wcsspn(_para1:Pwchar_t; _para2:Pwchar_t):size_t;cdecl;external libc_nlm name 'wcsspn';
+function wcsstr(_para1:Pwchar_t; _para2:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcsstr';
+function wcstod(__restrict:Pwchar_t; __restrict1:PPwchar_t):double;cdecl;external libc_nlm name 'wcstod';
+function wcstof(__restrict:Pwchar_t; __restrict1:PPwchar_t):double;cdecl;external libc_nlm name 'wcstof';
+function wcstok(__restrict:Pwchar_t; __restrict1:Pwchar_t; __restrict2:PPwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcstok';
+function wcstok_r(__restrict:Pwchar_t; __restrict1:Pwchar_t; __restrict2:PPwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcstok_r';
+function wcstol(__restrict:Pwchar_t; __restrict1:PPwchar_t; xx:longint):longint;cdecl;external libc_nlm name 'wcstol';
+
+// long double wcstold(const wchar_t * __restrict1, wchar_t ** __restrict);
+// long double wcstold(const wchar_t * __restrict1, wchar_t ** __restrict);
+
+function wcstoll(__restrict:Pwchar_t; __restrict1:PPwchar_t; xx:longint):int64_t;cdecl;external libc_nlm name 'wcstoll';
+function wcstoul(__restrict:Pwchar_t; __restrict1:PPwchar_t; _para3:longint):dword;cdecl;external libc_nlm name 'wcstoul';
+function wcstoull(__restrict:Pwchar_t; __restrict1:PPwchar_t; _para3:longint):uint64_t;cdecl;external libc_nlm name 'wcstoull';
+function wcsxfrm(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):size_t;cdecl;external libc_nlm name 'wcsxfrm';
+function wctob(_para1:wint_t):longint;cdecl;external libc_nlm name 'wctob';
+function wmemchr(ws:Pwchar_t; wc:wchar_t; n:size_t):Pwchar_t;cdecl;external libc_nlm name 'wmemchr';
+function wmemcmp(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):longint;cdecl;external libc_nlm name 'wmemcmp';
+function wmemcpy(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wmemcpy';
+function wmemmove(_para1:Pwchar_t; _para2:Pwchar_t; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wmemmove';
+function wmemset(ws:Pwchar_t; wc:wchar_t; n:size_t):Pwchar_t;cdecl;external libc_nlm name 'wmemset';
+function putwc(_para1:wchar_t; _para2:P_iobuf):wint_t;cdecl;external libc_nlm name 'putwc';
+function putwchar(_para1:wchar_t):wint_t;cdecl;external libc_nlm name 'putwchar';
+function fwide(_para1:P_iobuf; _para2:longint):longint;cdecl;external libc_nlm name 'fwide';
+function fputwc(_para1:wchar_t; _para2:P_iobuf):wint_t;cdecl;external libc_nlm name 'fputwc';
+function fputws(__restrict:Pwchar_t; __restrict1:P_iobuf):longint;cdecl;external libc_nlm name 'fputws';
+function fgetwc(_para1:P_iobuf):wint_t;cdecl;external libc_nlm name 'fgetwc';
+function fgetws(__restrict:Pwchar_t; _para2:longint; __restrict1:P_iobuf):Pwchar_t;cdecl;external libc_nlm name 'fgetws';
+function getwc(_para1:P_iobuf):wint_t;cdecl;external libc_nlm name 'getwc';
+function getwchar:wint_t;cdecl;external libc_nlm name 'getwchar';
+function ungetwc(_para1:wint_t; __restrict:P_iobuf):wint_t;cdecl;external libc_nlm name 'ungetwc';
+
+{$ifndef DisableArrayOfConst}
+function wprintf(__restrict:Pwchar_t; args:array of const):longint;cdecl;external libc_nlm name 'wprintf';
+{$endif}
+function wprintf(__restrict:Pwchar_t):longint;cdecl;external libc_nlm name 'wprintf';
+
+{$ifndef DisableArrayOfConst}
+function wscanf(__restrict:Pwchar_t; args:array of const):longint;cdecl;external libc_nlm name 'wscanf';
+{$endif}
+function wscanf(__restrict:Pwchar_t):longint;cdecl;external libc_nlm name 'wscanf';
+function vwprintf(__restrict:Pwchar_t; _para2:va_list):longint;cdecl;external libc_nlm name 'vwprintf';
+function vswprintf(__restrict:Pwchar_t; _para2:size_t; __restrict1:Pwchar_t; _para4:va_list):longint;cdecl;external libc_nlm name 'vswprintf';
+function wcscasecmp(_para1:Pwchar_t; _para2:Pwchar_t):longint;cdecl;external libc_nlm name 'wcscasecmp';
+function wcserror(_para1:longint):Pwchar_t;cdecl;external libc_nlm name 'wcserror';
+function wcsicmp(_para1:Pwchar_t; _para2:Pwchar_t):longint;cdecl;external libc_nlm name 'wcsicmp';
+function wcsindex(_para1:Pwchar_t; _para2:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcsindex';
+
+{$ifndef DisableArrayOfConst}
+function wcslist(_para1:Pwchar_t; _para2:Pwchar_t; args:array of const):Pwchar_t;cdecl;external libc_nlm name 'wcslist';
+{$endif}
+function wcslist(_para1:Pwchar_t; _para2:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcslist';
+function wcslwr(_para1:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcslwr';
+function wcsmemcmp(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):longint;cdecl;external libc_nlm name 'wcsmemcmp';
+function wcsmemcpy(__restrict:Pwchar_t; __restrict1:Pwchar_t; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wcsmemcpy';
+function wcsmemmove(_para1:Pwchar_t; _para2:Pwchar_t; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wcsmemmove';
+function wcsncasecmp(_para1:Pwchar_t; _para2:Pwchar_t; _para3:size_t):longint;cdecl;external libc_nlm name 'wcsncasecmp';
+function wcsnicmp(_para1:Pwchar_t; _para2:Pwchar_t; _para3:size_t):longint;cdecl;external libc_nlm name 'wcsnicmp';
+function wcsnset(_para1:Pwchar_t; _para2:longint; _para3:size_t):Pwchar_t;cdecl;external libc_nlm name 'wcsnset';
+function wcsrev(_para1:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcsrev';
+function wcsrindex(_para1:Pwchar_t; _para2:size_t; _para3:longint):Pwchar_t;cdecl;external libc_nlm name 'wcsrindex';
+function wcsset(_para1:Pwchar_t; _para2:longint):Pwchar_t;cdecl;external libc_nlm name 'wcsset';
+function wcsupr(_para1:Pwchar_t):Pwchar_t;cdecl;external libc_nlm name 'wcsupr';
+procedure wungettok(__restrict:Pwchar_t; __restrict1:Pwchar_t; __restrict2:PPwchar_t);cdecl;external libc_nlm name 'wungettok';
+procedure wungettok_r(__restrict:Pwchar_t; __restrict1:Pwchar_t; __restrict2:PPwchar_t);cdecl;external libc_nlm name 'wungettok_r';
+function btowc(_para1:longint):wint_t;cdecl;external libc_nlm name 'btowc';
+function mbrlen(__restrict:Pchar; _para2:size_t; __restrict1:Pmbstate_t):longint;cdecl;external libc_nlm name 'mbrlen';
+function mbrtowc(__restrict:Pwchar_t; __restrict1:Pchar; _para3:size_t; __restrict2:Pmbstate_t):longint;cdecl;external libc_nlm name 'mbrtowc';
+function mbsinit(_para1:Pmbstate_t):longint;cdecl;external libc_nlm name 'mbsinit';
+function wcwidth(_para1:wchar_t):longint;cdecl;external libc_nlm name 'wcwidth';
+function wcswidth(_para1:Pwchar_t; _para2:size_t):longint;cdecl;external libc_nlm name 'wcswidth';
+{ macros that overcome implementation's function call overhead...  }
+{ attributes for NXDirAttrDos_t 'attrib' field...  }
+
+
+// fsio.h
+// netware.h
+  const
+     LD_MODULE_REENTRANT_BIT       = $00000001;
+     LD_MODULE_MULTIPLE_LOAD       = $00000002;       { multiple load            }
+     LD_SYNCHRONIZE_START          = $00000004;       { uses SynchronizeStart()  }
+     LD_PSEUDOPREEMPTION_BIT       = $00000008;       { accept preemption        }
+     LD_KERNEL_LOAD                = $00000010;       { ring 0-only              }
+     LD_DONT_SHARE_CODE            = $00000020;
+  { once dependencies gone   }
+     LD_AUTO_UNLOAD                = $00000040;
+     LD_HIDDEN_MODULE              = $00000080;
+     LD_DIGITALLY_SIGNED_FILE      = $00000100;
+     LD_PROTECTED_LOAD             = $00000200;       { protected address space  }
+     LD_SHARED_LIBRARY             = $00000400;
+     LD_RESTARTABLE                = $00000800;
+     LD_MODULE_HAS_MPK_STUBS       = $00001000;
+     LD_NOT_MULTIPROCESSOR_SAFE    = $00002000;
+     LD_PREEMPTABLE                = $00004000;
+     LD_HAS_SYSTEM_CALLS           = $00008000;
+     LD_VIRTUAL_MEMORY             = $00010000;
+     LD_ALL_EXPORTS_SAFE           = $00020000;
+     LD_RESERVED_1                 = $00040000;
+     LD_RESERVED_2                 = $00080000;
+     LD_RESERVED_3                 = $00100000;
+     LD_RESERVED_4                 = $00200000;
+     LD_WANT_POSIX_SEMANTICS       = $00400000;       { assume POSIX semantics   }
+     LD_UTF8_STRINGS               = $00800000;       { UTF-8 strings            }
+     LD_TSR                        = $01000000;       { terminate-stay-resident  }
+     LD_PROMPT_USER_AND_PASSWORD   = $02000000;       { with LD_WANT_POSIX...    }
+     LD_HOTSWAP_DRIVER             = $04000000;
+     LD_STARTUP_DEVICE_NLM_BIT     = $08000000;
+     LD_BOUND_NLM_BIT              = $10000000;
+     LD_DONT_UNLOAD_BIT            = $20000000;       { never unload             }
+     LD_MODULE_BEING_DEBUGGED      = $40000000;       { (debugging)              }
+     LD_MEMORY_ON_4K_BOUNDRIES_BIT = $80000000;       { (debugging)              }
+  { Note LD_UNICODE_STRINGS mostly obsolete--used only by NKS applications:   }
+     LD_UNICODE_STRINGS            = $02000000;       { Unicode strings          }
+
+
+type
+
+   Prtag_t = ^rtag_t;
+   rtag_t = void;
+   Trtag = rtag_t;
+   Prtag = Prtag_t;
+
+   Pscr_t = ^scr_t;
+   scr_t = pointer;
+   TScr = scr_t;
+   PScr = Pscr_t;
+
+// event.h
+// screen.h
+
+  const
+     MAX_SCREEN_STRING_LEN = 255;
+  { screen mode flags...  }
+     SCR_NO_MODE = $00000000;
+  { (default)  }
+     SCR_AUTOCLOSE_ON_EXIT = $00000001;
+     SCR_COLOR_ATTRS       = $00000002;
+  { key types...  }
+     NORMAL_KEY       = $00;
+     FUNCTION_KEY     = $01;
+     ENTER_KEY        = $02;
+     ESCAPE_KEY       = $03;
+     BACKSPACE_KEY    = $04;
+     DELETE_KEY       = $05;
+     INSERT_KEY       = $06;
+     CURSOR_UP_KEY    = $07;
+     CURSOR_DOWN_KEY  = $08;
+     CURSOR_RIGHT_KEY = $09;
+     CURSOR_LEFT_KEY  = $0A;
+     CURSOR_HOME_KEY  = $0B;
+     CURSOR_END_KEY   = $0C;
+     CURSOR_PUP_KEY   = $0D;
+     CURSOR_PDOWN_KEY = $0E;
+  { some name equivalents...  }
+     ENTER     = $0D;
+     ESCAPE    = $1B;
+     BACKSPACE = $08;
+  { modifier code constituents...  }
+     SHIFT_KEY_HELD    = $01;
+     CTRL_KEY_HELD     = $02;
+     ALT_KEY_HELD      = $04;
+     CAPS_LOCK_IS_ON   = $10;
+     NUM_LOCK_IS_ON    = $20;
+     SCROLL_LOCK_IS_ON = $40;
+  { suggested 'maxlen' argument for getpassword()...  }
+     _PASSWORD_LEN = 128;
+  { string-embeddable color representations...  }
+     COLOR_STR_BLACK   = '\x1B[0;30m';
+     COLOR_STR_MAROON  = '\x1B[0;31m';
+     COLOR_STR_GREEN   = '\x1B[0;32m';
+     COLOR_STR_OLIVE   = '\x1B[0;33m';
+     COLOR_STR_NAVY    = '\x1B[0;34m';
+     COLOR_STR_PURPLE  = '\x1B[0;35m';
+     COLOR_STR_TEAL    = '\x1B[0;36m';
+     COLOR_STR_SILVER  = '\x1B[0;37m';
+     COLOR_STR_GREY    = '\x1B[1;30m';
+     COLOR_STR_RED     = '\x1B[1;31m';
+     COLOR_STR_LIME    = '\x1B[1;32m';
+     COLOR_STR_YELLOW  = '\x1B[1;33m';
+     COLOR_STR_BLUE    = '\x1B[1;34m';
+     COLOR_STR_MAGENTA = '\x1B[1;35m';
+     COLOR_STR_CYAN    = '\x1B[1;36m';
+     COLOR_STR_WHITE   = '\x1B[1;37m';
+  { dim/unhighlighted white  }
+     COLOR_STR_NORMAL = COLOR_STR_SILVER;
+     COLOR_STR_GRAY = COLOR_STR_GREY;
+  { attributes for OutputToScreenWithAttributes(); cf. HTML color names  }
+  { (black, no color at all)         }
+     COLOR_ATTR_NONE = 0;
+  { (dim blue)                       }
+     COLOR_ATTR_NAVY = 1;
+     COLOR_ATTR_BLUE = $01 or 8;
+     COLOR_ATTR_GREEN = 2;
+  { (bright green)                   }
+     COLOR_ATTR_LIME = $02 or 8;
+  { (dim cyan)                       }
+     COLOR_ATTR_TEAL = 3;
+     COLOR_ATTR_CYAN = $03 or 8;
+  { (dim red)                        }
+     COLOR_ATTR_MAROON = 4;
+     COLOR_ATTR_RED = $04 or 8;
+     COLOR_ATTR_PURPLE = 5;
+  { (bright purple)                  }
+     COLOR_ATTR_MAGENTA = $05 or 8;
+  { (brown, dim yellow)              }
+     COLOR_ATTR_OLIVE = 6;
+     COLOR_ATTR_YELLOW = $06 or 8;
+  { normal white, dim/unhighlighted  }
+     COLOR_ATTR_SILVER = 7;
+  { (dimmed white)                   }
+     COLOR_ATTR_GREY = 8;
+  { bright, highlighted white        }
+     COLOR_ATTR_WHITE = 15;
+
+  const
+//     OutputToScreenWithVaList = OutputToScreenWithPointer;
+  { return and default values for Prompt functions...  }
+     SCR_PROMPT_ANSWER_NO   = 0;
+     SCR_PROMPT_ANSWER_YES  = 1;
+     SCR_PROMPT_ANSWER_SKIP = 2;
+     SCR_PROMPT_ANSWER_ALL  = 3;
+
+  { cursor types...  }
+     CURSOR_NORMAL = $0C0B;
+     CURSOR_THICK  = $0C09;
+     CURSOR_BLOCK  = $0C00;
+     CURSOR_TOP    = $0400;
+  { screen types...  }
+     SCREEN_TYPE_TTY         = $00000000;
+     SCREEN_TYPE_MONOCHROME  = $00000001;
+     SCREEN_TYPE_DUAL_MODE   = $00000002;
+     SCREEN_TYPE_CGA         = $00000003;
+     SCREEN_TYPE_EGA         = $00000004;
+     SCREEN_TYPE_VGA         = $00000005;
+  { screen modes...  }
+     SCREEN_MODE_TTY         = $00000000;
+     SCREEN_MODE_80X25       = $00000001;
+     SCREEN_MODE_80X43       = $00000002;
+     SCREEN_MODE_80X50       = $00000003;
+     SCREEN_MODE_D           = $0000000D;
+     SCREEN_MODE_E           = $0000000E;
+     SCREEN_MODE_F           = $0000000F;
+     SCREEN_MODE_10          = $00000010;
+     SCREEN_MODE_11          = $00000011;
+     SCREEN_MODE_12          = $00000012;
+     SCREEN_MODE_13          = $00000013;
+  { voracious for memory!  }
+     SCREEN_MODE_SCROLLABLE  = $80000000;
+  { screen state...  }
+     SCREEN_NON_SWITCHABLE   = $00000001;
+     SCREEN_DUMMY            = $00000100;
+     SCREEN_HIDDEN           = $00000200;
+
+procedure clearscreen;cdecl;external libc_nlm name 'clearscreen';
+
+{$ifndef DisableArrayOfConst}
+function consoleprintf(_para1:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'consoleprintf';
+{$endif}
+function consoleprintf(txt:Pchar):longint;cdecl;external libc_nlm name 'consoleprintf';
+function consoleprintfl1(txt:Pchar;p1:longint):longint;cdecl;external libc_nlm name 'consoleprintf';
+function consoleprintfl2(txt:Pchar;p1,p2:longint):longint;cdecl;external libc_nlm name 'consoleprintf';
+function consoleprintfl3(txt:Pchar;p1,p2,p3:longint):longint;cdecl;external libc_nlm name 'consoleprintf';
+function getscreenmode(mode:Pdword):longint;cdecl;external libc_nlm name 'getscreenmode';
+function getscreenmode(var mode:dword):longint;cdecl;external libc_nlm name 'getscreenmode';
+function getcharacter:longint;cdecl;external libc_nlm name 'getcharacter';
+function getkey(keytype,modifer,scancode:Plongint):longint;cdecl;external libc_nlm name 'getkey';
+function getkey(var keytype, modifer, scancode:longint):longint;cdecl;external libc_nlm name 'getkey';
+function getalternateconsole:scr_t;cdecl;external libc_nlm name 'getalternateconsole';
+function getnetwareconsole:scr_t;cdecl;external libc_nlm name 'getnetwareconsole';
+function getnetwarelogger:scr_t;cdecl;external libc_nlm name 'getnetwarelogger';
+
+function getpassword(prompt,password:Pchar; maxlen:size_t):Pchar;cdecl;external libc_nlm name 'getpassword';
+function getscreenhandle:scr_t;cdecl;external libc_nlm name 'getscreenhandle';
+function getstring(_string:Pchar; max:size_t; display:longint):Pchar;cdecl;external libc_nlm name 'getstring';
+function gotorowcol(row, col:longint):longint;cdecl;external libc_nlm name 'gotorowcol';
+function kbhit:longint;cdecl;external libc_nlm name 'kbhit';
+function pressanykey:longint;cdecl;external libc_nlm name 'pressanykey';
+function pressanykeytocontinue:longint;cdecl;external libc_nlm name 'pressanykey';
+function pressescape:longint;cdecl;external libc_nlm name 'pressescape';
+function pressenter:longint;cdecl;external libc_nlm name 'pressenter';
+function putcharacter(ch:longint):longint;cdecl;external libc_nlm name 'putcharacter';
+
+function putstring(_string:Pchar):longint;cdecl;external libc_nlm name 'putstring';
+
+{$ifndef DisableArrayOfConst}
+function screenprintf(_para1:scr_t; _para2:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'screenprintf';
+{$endif}
+function screenprintf(_para1:scr_t; _para2:Pchar):longint;cdecl;external libc_nlm name 'screenprintf';
+function setscreenmode(mode:dword):longint;cdecl;external libc_nlm name 'setscreenmode';
+
+function renamescreen(name:Pchar):longint;cdecl;external libc_nlm name 'renamescreen';
+procedure ringbell;cdecl;external libc_nlm name 'ringbell';
+function ungetcharacter(ch:longint):longint;cdecl;external libc_nlm name 'ungetcharacter';
+function ungetkey(keytype:longint; modifer:longint; scancode:longint):longint;cdecl;external libc_nlm name 'ungetkey';
+
+function vconsoleprintf(_para1:Pchar; _para2:va_list):longint;cdecl;external libc_nlm name 'vconsoleprintf';
+
+function vscreenprintf(_para1:scr_t; _para2:Pchar; _para3:va_list):longint;cdecl;external libc_nlm name 'vscreenprintf';
+function wherecol:longint;cdecl;external libc_nlm name 'wherecol';
+function whererow:longint;cdecl;external libc_nlm name 'whererow';
+function whererowcol(row,col:Plongint):longint;cdecl;external libc_nlm name 'whererowcol';
+function whererowcol(var row,col:longint):longint;cdecl;external libc_nlm name 'whererowcol';
+{ obsolete...  }
+function getconsolehandle:scr_t;cdecl;external libc_nlm name 'getconsolehandle';
+{ direct NetWare OS interfaces...  }
+type
+
+   Pscroll_t = ^scroll_t;
+   scroll_t =  Longint;
+   Const
+     SCROLL_DOWN = 0;
+     SCROLL_UP = 1;
+     SCROLL_NONE = 2147483647;
+
+
+procedure ActivatePopUpScreen(scrID:scr_t);cdecl;external libc_nlm name 'ActivatePopUpScreen';
+procedure ActivateScreen(scrID:scr_t);cdecl;external libc_nlm name 'ActivateScreen';
+procedure ChangeToSystemConsoleScreen;cdecl;external libc_nlm name 'ChangeToSystemConsoleScreen';
+function CheckIfScreenActive(scrID:scr_t; waitFlag:dword):longint;cdecl;external libc_nlm name 'CheckIfScreenActive';
+function CheckKeyStatus(scrID:scr_t):longint;cdecl;external libc_nlm name 'CheckKeyStatus';
+procedure ClearScreen(scrID:scr_t);cdecl;external libc_nlm name 'ClearScreen';
+procedure CloseScreen(scrID:scr_t);cdecl;external libc_nlm name 'CloseScreen';
+procedure ConsoleHungMenu;cdecl;external libc_nlm name 'ConsoleHungMenu';
+procedure DisableInputCursor(scrID:scr_t);cdecl;external libc_nlm name 'DisableInputCursor';
+function DisplayScreenLine(scrID:scr_t; line:dword; col:dword; length:dword; textAndAttr:Pbyte):longint;cdecl;external libc_nlm name 'DisplayScreenLine';
+function DisplayScreenText(scrID:scr_t; line:dword; col:dword; length:dword; text:Pchar):longint;cdecl;external libc_nlm name 'DisplayScreenText';
+function DisplayScreenTextWithAttribute(scrID:scr_t; line:dword; col:dword; length:dword; lineAttr:byte;
+           text:Pchar):longint;cdecl;external libc_nlm name 'DisplayScreenTextWithAttribute';
+procedure EnableInputCursor(scrID:scr_t);cdecl;external libc_nlm name 'EnableInputCursor';
+procedure EndPopUpScreen(scr:scr_t);cdecl;external libc_nlm name 'EndPopUpScreen';
+function FillScreenArea(scrID:scr_t; line:dword; col:dword; height:dword; width:dword;
+           character:char; attr:byte):longint;cdecl;external libc_nlm name 'FillScreenArea';
+function FillScreenAreaAttribute(scrID:scr_t; line:dword; col:dword; height:dword; width:dword;
+           attr:byte):longint;cdecl;external libc_nlm name 'FillScreenAreaAttribute';
+function GetActiveScreen:scr_t;cdecl;external system_nlm name 'GetActiveScreen';
+function GetActualScreenSize(scrID:scr_t; height:Pdword; width:Pdword; bufferSize:Psize_t):longint;cdecl;external system_nlm name 'GetActualScreenSize';
+function GetConsoleSecuredFlag:longint;cdecl;external libc_nlm name 'GetConsoleSecuredFlag';
+procedure GetCursorStyle(scrID:scr_t; cursorStyle:Pword);cdecl;external system_nlm name 'GetCursorStyle';
+procedure GetInputCursorPosition(scrID:scr_t; row:Pword; col:Pword);cdecl;external system_nlm name 'GetInputCursorPosition';
+procedure GetKey(scrID:scr_t; _type,value,status,scancode:Pbyte;linesToProtect:size_t);cdecl;external system_nlm name 'GetKey';
+procedure GetKey(scrID:scr_t; var _type,value,status,scancode:byte;linesToProtect:size_t);cdecl;external system_nlm name 'GetKey';
+procedure GetOutputCursorPosition(scrID:scr_t; row,col:Pword);cdecl;external system_nlm name 'GetOutputCursorPosition';
+procedure GetOutputCursorPosition(scrID:scr_t; var row,col:word);cdecl;external system_nlm name 'GetOutputCursorPosition';
+function GetRawKeyWithScreen(scrID:scr_t; _type,value,status,scancode:Pbyte):longint;cdecl;external libc_nlm name 'GetRawKeyWithScreen';
+function GetRawKeyWithScreen(scrID:scr_t; var _type,value,status,scancode:byte):longint;cdecl;external libc_nlm name 'GetRawKeyWithScreen';
+function GetScreenAddress:pointer;cdecl;external system_nlm name 'GetScreenAddress';  // not in protected mode
+function GetScreenName(scrID:scr_t; nameBuffer:Pchar):longint;cdecl;external system_nlm name 'GetScreenName';
+function GetScreenPhysicalAddress:pointer;cdecl;external libc_nlm name 'GetScreenPhysicalAddress';
+procedure GetScreenSize(height,width:Pword);cdecl;external system_nlm name 'GetScreenSize';
+procedure GetScreenSize(var height,width:word);cdecl;external system_nlm name 'GetScreenSize';
+
+{$ifndef DisableArrayOfConst}
+function InputFromScreen(scrID:scr_t; allowedCharacterSet:Pchar; bufferLength:size_t; editWidth:size_t; buffer:Pchar;
+           linesToProtect:longint; hasDefaultString:longint; defaultString:Pchar; promptText:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'InputFromScreen';
+{$endif}
+function InputFromScreen(scrID:scr_t; allowedCharacterSet:Pchar; bufferLength:size_t; editWidth:size_t; buffer:Pchar;
+           linesToProtect:longint; hasDefaultString:longint; defaultString:Pchar; promptText:Pchar):longint;cdecl;external libc_nlm name 'InputFromScreen';
+function IsScreenModeSupported(screenMode:dword):longint;cdecl;external system_nlm name 'IsScreenModeSupported';
+
+function OpenCustomScreen(name:Pchar; rTag:rtag_t; newScrID:Pscr_t; mode:longint):longint;cdecl;external libc_nlm name 'OpenCustomScreen';
+
+function OpenPopUpScreen(name:Pchar; rTag:rtag_t; newScrID:Pscr_t):longint;cdecl;external libc_nlm name 'OpenPopUpScreen';
+
+function OpenScreen(name:Pchar; rTag:rtag_t; newScrID:Pscr_t):longint;cdecl;external system_nlm name 'OpenScreen';
+
+{$ifndef DisableArrayOfConst}
+function OutputToScreen(scrID:scr_t; format:Pchar; args:array of const):longint;cdecl;external system_nlm name 'OutputToScreen';
+{$endif}
+function OutputToScreen(scrID:scr_t; format:Pchar):longint;cdecl;external system_nlm name 'OutputToScreen';
+
+{$ifndef DisableArrayOfConst}
+function OutputToScreenWithAttribute(scrID:scr_t; attr:byte; format:Pchar; args:array of const):longint;cdecl;external system_nlm name 'OutputToScreenWithAttribute';
+{$endif}
+function OutputToScreenWithAttribute(scrID:scr_t; attr:byte; format:Pchar):longint;cdecl;external system_nlm name 'OutputToScreenWithAttribute';
+
+
+function OutputToScreenWithPointer(scrID:scr_t; format:Pchar; arguments:va_list):longint;cdecl;external system_nlm name 'OutputToScreenWithPointer';
+procedure Pause(scrID:scr_t);cdecl;external system_nlm name 'Pause';
+function PauseWithEscape(scrID:scr_t):longint;cdecl;external system_nlm name 'PauseWithEscape';
+procedure PositionInputCursor(scrID:scr_t; row:word; col:word);cdecl;external system_nlm name 'PositionInputCursor';
+function PositionOutputCursor(scrID:scr_t; row:word; col:word):longint;cdecl;external system_nlm name 'PositionOutputCursor';
+
+function PromptForString(scr:scr_t; length:size_t; editWidth:size_t; _string:Pchar; hasDefaultValue:longint;
+           defaultValue:Pchar; linesToProtect:longint; promptText:pointer):Pchar;cdecl;external libc_nlm name 'PromptForString';
+
+function PromptForPassword(scr:scr_t; prompt:Pchar; blotOutChar:longint; password:Pchar; maxlen:size_t):Pchar;cdecl;external libc_nlm name 'PromptForPassword';
+
+{$ifndef DisableArrayOfConst}
+function PromptForUnsignedNumber(scrID:scr_t; result:Pdword; minValue:dword; maxValue:dword; radix:longint;
+           linesToProtect:longint; hasDefaultValue:byte; defaultValue:dword; promptText:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'PromptForUnsignedNumber';
+{$endif}
+function PromptForUnsignedNumber(scrID:scr_t; result:Pdword; minValue:dword; maxValue:dword; radix:longint;
+           linesToProtect:longint; hasDefaultValue:byte; defaultValue:dword; promptText:Pchar):longint;cdecl;external libc_nlm name 'PromptForUnsignedNumber';
+
+{$ifndef DisableArrayOfConst}
+function PromptForYesOrNo(scrID:scr_t; linesToProtect,defaultValue:longint; promptText:pointer; args:array of const):longint;cdecl;external libc_nlm name 'PromptForYesOrNo';
+{$endif}
+function PromptForYesOrNo(scrID:scr_t; linesToProtect,defaultValue:longint; promptText:pointer):longint;cdecl;external libc_nlm name 'PromptForYesOrNo';
+
+{$ifndef DisableArrayOfConst}
+function PromptForYesNoAllOrSkip(scrID:scr_t; linesToProtect:longint; defaultValue:dword; promptText:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'PromptForYesNoAllOrSkip';
+{$endif}
+function PromptForYesNoAllOrSkip(scrID:scr_t; linesToProtect:longint; defaultValue:dword; promptText:Pchar):longint;cdecl;external libc_nlm name 'PromptForYesNoAllOrSkip';
+function ReadScreenCharacter(scrID:scr_t; line,col:dword; character:Pchar):longint;cdecl;external system_nlm name 'ReadScreenCharacter';
+
+function RenameScreen(scrID:scr_t; name:Pchar):longint;cdecl;external system_nlm name 'RenameScreen';
+function RestoreFullScreen(scrID:scr_t; buffer:pointer):longint;cdecl;external system_nlm name 'RestoreFullScreen';
+function RestoreScreenArea(scrID:scr_t; line:dword; col:dword; height:dword; width:dword;
+           buffer:pointer):longint;cdecl;external system_nlm name 'RestoreScreenArea';
+procedure ReturnScreenType(_type:Pdword; colorFlag:Pdword);cdecl;external system_nlm name 'ReturnScreenType';
+procedure RingTheBell;cdecl;external system_nlm name 'RingTheBell';
+function SaveFullScreen(scrID:scr_t; buffer:pointer):longint;cdecl;external system_nlm name 'SaveFullScreen';
+function SaveScreenArea(scrID:scr_t; line:dword; col:dword; height:dword; width:dword;
+           buffer:pointer):longint;cdecl;external system_nlm name 'SaveScreenArea';
+procedure SetConsoleSecuredFlag(value:byte);cdecl;external system_nlm name 'SetConsoleSecuredFlag';
+procedure SetCursorStyle(scrID:scr_t; newStyle:word);cdecl;external system_nlm name 'SetCursorStyle';
+procedure SetInputToOutputCursorPosition(scrID:scr_t);cdecl;external system_nlm name 'SetInputToOutputCursorPosition';
+function ScrollScreenArea(scrID:scr_t; line,col,height,width,count:dword; newLineAttribute:byte; direction:scroll_t):longint;cdecl;external system_nlm name 'ScrollScreenArea';
+
+procedure ShowTitleBarText(screenMemoryAddress:pointer; titleBarText:Pchar; textLength:size_t);cdecl;external system_nlm name 'ShowTitleBarText';
+function UngetKey(scrID:scr_t; _type,value,status,scancode:byte):longint;cdecl;external system_nlm name 'UngetKey';
+function ValidateScreenHandle(scrID:scr_t):longint;cdecl;external system_nlm name 'ValidateScreenHandle';
+procedure WaitForKey(scrID:scr_t);cdecl;external system_nlm name 'WaitForKey';
+function WriteScreenCharacter(scrID:scr_t; line,col:dword; character:char):longint;cdecl;external system_nlm name 'WriteScreenCharacter';
+function WriteScreenCharacterAttribute(scrID:scr_t; line,col:dword; character:char; attr:byte):longint;cdecl;external system_nlm name 'WriteScreenCharacterAttribute';
+
+{ turn on 1-byte packing...  }
+
+
+
+{ file server event notification interfaces...  }
+const
+     EVENT_VOL_SYS_MOUNT = 0;
+     EVENT_VOL_SYS_DISMOUNT = 1;
+     EVENT_ANY_VOL_MOUNT = 2;
+     EVENT_ANY_VOL_DISMOUNT = 3;
+     EVENT_DOWN_SERVER = 4;        { (see EVENT_PRE_DOWN_SERVER)  }
+     EVENT_EXIT_TO_DOS = 7;
+     EVENT_MODULE_UNLOAD = 8;
+     EVENT_MODULE_UNLOAD_POST_EXIT = 115;
+     EVENT_CLEAR_CONNECTION = 9;
+     EVENT_LOGIN_USER = 10;
+     EVENT_CREATE_BINDERY_OBJ = 11;
+     EVENT_DELETE_BINDERY_OBJ = 12;
+     EVENT_CHANGE_SECURITY = 13;
+     EVENT_CHANGE_SECURITY_ADD_EQUIVALENCE = 1;
+     EVENT_ACTIVATE_SCREEN = 14;
+     EVENT_UPDATE_SCREEN = 15;
+     EVENT_UPDATE_CURSOR = 16;
+     EVENT_KEY_WAS_PRESSED = 17;
+     EVENT_DEACTIVATE_SCREEN = 18;
+     EVENT_TRUSTEE_CHANGE = 19;
+     EVENT_NO_RELINQUISH_CONTROL = 23;
+     EVENT_THREAD_SWITCH = 25;
+     EVENT_MODULE_LOAD = 27;
+     EVENT_CREATE_PROCESS = 28;
+     EVENT_DESTROY_PROCESS = 29;
+     EVENT_NEW_PUBLIC = 32;
+     EVENT_PROTOCOL_BIND = 33;
+     EVENT_PROTOCOL_UNBIND = 34;
+     EVENT_ALLOCATE_CONNECTION = 37;
+     EVENT_LOGOUT_CONNECTION = 38;
+     EVENT_MLID_REGISTER = 39;
+     EVENT_MLID_DEREGISTER = 40;
+     EVENT_DATA_MIGRATION = 41;
+     EVENT_DATA_DEMIGRATION = 42;
+     EVENT_CREATE_OBJECT = 46;
+     EVENT_DELETE_OBJECT = 47;
+     EVENT_RENAME_OBJECT = 48;
+     EVENT_VALUE_CHANGE = 49;
+     EVENT_MOVE_OBJECT = 52;
+     EVENT_VALUE_ADD = 53;
+     EVENT_VALUE_DEL = 54;
+     EVENT_CHANGE_TIME = 51;
+     EVENT_DM_KEY_MODIFIED = 55;
+     EVENT_MODULE_UNLOADED = 56;
+     EVENT_REMOVE_PUBLIC = 57;
+     EVENT_UNICODE = 59;
+     EVENT_SFT3_SERVER_STATE = 60;
+     EVENT_SFT3_IMAGE_STATE = 61;
+     EVENT_SFT3_PRESYNC_STATE = 62;
+     EVENT_ALTERNATE_MOUNT_VOLUME = 63;
+     EVENT_CONSOLE_CONFIG_COMMAND = 64;
+     EVENT_CONSOLE_VERSION_COMMAND = 65;
+     EVENT_PRE_LOAD_NLM = 66;
+     EVENT_LOW_MEMORY = 67;
+     EVENT_PRE_DOWN_SERVER = 129;     { (called before NDS disappears)  }
+     EVENT_GET_KEY_INFORMATION = 148;
+     EGKStructVersion =  $00000001;
+     EVENT_PRIORITY_APPLICATION = 20;
+     EVENT_PRIORITY_DEVICE = 40;      { (lowest)   }
+  {
+  ** A consumer registering for an event sets this flag in the event type to
+  ** denote that the consumer is multiprocessor safe. This allows us to
+  ** distinguish multiprocessor safe consumers from unsafe ones.
+   }
+     EVENT_CONSUMER_MT_SAFE = $40000000;
+  { ** Values for fields of EventNetWareAlertStruct_t. }
+     QueueThisAlertMask         = $00000001;
+     AlertIDValidMask           = $00000002;
+     AlertLocusValidMask        = $00000004;
+     AlertEventNotifyOnlyMask   = $00000008;
+     AlertNoEventNotifyMask     = $00000010;
+     AlertMessageNumberValid    = $00010000;
+     NoDisplayAlertUID          = $00200000;
+     AlertNoRingBell            = $00400000;
+     AlertIDNotUniqueBit        = $00800000;
+     OldStyleSystemAlertMask    = $01000000;
+     OldStyleINWSystemAlertMask = $02000000;
+  { can be pointer or number  }
+     OverloadMessageNumFieldBit = $04000000;
+     NoDisplayLocusBit          = $10000000;
+     NoDisplayAlertIDBit        = $20000000;
+     OverrideNotificationBits   = $40000000;
+     TargetStationIsAPointer    = $80000000;
+     Alert300Mask = (AlertIDValidMask or AlertLocusValidMask) or OldStyleSystemAlertMask;
+     Alert311Mask = AlertIDValidMask or OldStyleINWSystemAlertMask;
+     //Alert320Mask = ((AlertIDValidMask or AlertMessageNumberValid) or AlertLocusValidMask) or NoDisp
+     //QAlertMask = ((AlertIDValidMask or AlertLocusValidMask) or NoDisplayAlertIDBit) or QueueThisAle
+     //QAlert320Mask = Alert320Mask or QueueThisAlertMask;
+ { allotted ModuleNumbers for 'alertID' in EventNetWareAlertStruct_t...  }
+  { Bindery Subject               }
+     ALERT_BINDERY = $01020000;
+  { OS Event Subject              }
+     ALERT_OS = $01030000;
+  { LLC                           }
+     ALERT_LLC = $01040000;
+  { SDLC Stack                    }
+     ALERT_SDLC = $01050000;
+  { RConsole                      }
+     ALERT_REMOTE = $01060000;
+  { MLID LAN Drivers              }
+     ALERT_MLID = $01070000;
+  { QLLC                          }
+     ALERT_QLLC = $01080000;
+  { UPS Monitor                   }
+     ALERT_UPS = $01090000;
+  { Directory Service             }
+     ALERT_DS = $010a0000;
+  { RSPX                          }
+     ALERT_RSPX = $010c0000;
+  { R232                          }
+     ALERT_R232 = $010d0000;
+  { TimeSync                      }
+     ALERT_TIME_SYNC = $010e0000;
+  { CLib                          }
+     ALERT_CLIB = $010f0000;
+  { Print                         }
+     ALERT_PRINT = $01100000;
+  { Novell Replication Services   }
+     ALERT_NRS = $01200000;
+  { IP/Domain Name Services       }
+     ALERT_DNS = $01300000;
+  { DHCP Services                 }
+     ALERT_DHCP = $01400000;
+  { Media Manager                 }
+     ALERT_MM = $01500000;
+{
+  ** OS-defined AlertNumber values for 'alertID' in EventNetWareAlertStruct_t
+  ** structure.
+   }
+  { starting with NetWare 4...  }
+     nmAllocFailed = 1;
+     nmErrWrtExtDir = 2;
+     nmSysErrWrtDSnoFN = 3;
+     nmStaErrWrtDSnoFN = 4;
+     nmSysErrWrtDSwithFN = 5;
+     nmStaErrWrtDSwithFN = 6;
+     nmSysErrRdDSnoFN = 7;
+     nmStaErrRdDSnoFN = 8;
+     nmSysErrRdDSwithFN = 9;
+     nmStaErrRdDSwithFN = 10;
+     nmSysWrtPreRDnoFN = 11;
+     nmStaWrtPreRDnoFN = 12;
+     nmSysWrtPreRDwithFN = 13;
+     nmStaWrtPreRDwithFN = 14;
+     nmCacheMemLimitExceded = 15;
+     nmCacheMemOutOfMem = 16;
+     nmCacheBufsGetLo = 17;
+     nmDskSpcNoDelFiles = 18;
+     nmDskSpcNoLimbo = 19;
+     nmVolSpcAlmostGone = 20;
+     nmFATWrtErr = 21;
+     nmDirWrtErr = 22;
+     nmDirCopyRdErr = 23;
+     nmDirDblRdErr = 24;
+     nmAllocDirWrtErr = 25;
+     nmDirExpansionErr = 26;
+     nmDirTooLarge = 27;
+     nmErrExpandingDir = 28;
+     nmErrExpandingMem = 29;
+     nmErrDirGetTooLarge = 30;
+     nmDskBottleneck = 31;
+     nmWDClearedConn = 32;
+     nmCpyrtViolation = 33;
+     nmReadFault = 35;
+     nmPktTooSmall = 36;
+     nmCreatingVolLog = 37;
+     nmWrtVolLog = 38;
+     nmVolDmtDevDeact = 39;
+     nmLoginDisabled = 40;
+     nmLoginEnabled = 41;
+     nmClrSta = 42;
+     nmClrStaByUsr = 43;
+     nmFSDownByUser = 44;
+     nmRIPAlreadyOpn = 45;
+     nmRouterConfigErr = 46;
+     nmLANLoopbackErr = 47;
+     nmRouterConfigErrNoInfo = 48;
+     nmIPXUnreachable = 49;
+     nmIPXUnbind = 50;
+     nmSAPAlreadyOpn = 51;
+     nmRouterConfigErrNameInfo = 52;
+     nmSpuriousInt = 53;
+     nmChecksumInvalidAlert = 54;
+     nmPrimaryPicLostInt = 55;
+     nmSecondaryPicLostInt = 56;
+     nmCompErrHoleCountMismatch = 57;
+     nmInvalidScreen = 58;
+     nmRelinquishControl = 59;
+     nmFSUserDeleted = 60;
+     nmAccDelByUser = 61;
+     nmInvalidRTag = 62;
+     nmDeactUnknown = 63;
+     nmDeactDriveUnld = 64;
+     nmDeactDevFailure = 65;
+     nmDeactUsrRequest = 66;
+     nmDeactMediaDismount = 67;
+     nmDeactMediaEject = 68;
+     nmDeactServerDown = 69;
+     nmDeactServerFailure = 70;
+     nmResourceRelErr = 71;
+     nmMirrorsNotSync = 72;
+     nmMirrorsSyncUp = 73;
+     nmPartMirrorSync = 74;
+     nmPartMirrorNotSync = 75;
+     nmReMirroringPart = 76;
+     nmReMirroringPartAborted = 77;
+     nmLogPartMirrorInconsist = 78;
+     nmSysFileLockThresh = 79;
+     nmStaFileLockThresh = 80;
+     nmSysRecLockThresh = 81;
+     nmStaRecLockThresh = 82;
+     nmOpnNETACCTFailed = 83;
+     nmNCPSearchLimitSys = 84;
+     nmNCPSearchLimitSta = 85;
+     nmInsMediaAck = 86;
+     nmInsMediaAborted = 87;
+     nmRemMediaAck = 88;
+     nmRemMediaAbort = 89;
+     nmInsMediaInto = 90;
+     nmRemMediaFrom = 91;
+     nmReDirectedBlockPart = 92;
+     nmReDirectedBlockPartErr = 93;
+     nmOutOfHotFixBlocks = 94;
+     nmLowWarningHotFixBlocks = 95;
+     nmReDirectInconsistNoFix = 96;
+     nmReDirectInconsistFixed = 97;
+     nmInvalidRTagHOptions = 98;
+     nmCheckAndAddHWNoGetRTag = 99;
+     nmRemHWBadPtr = 100;
+     nmErrUnldNLM = 101;
+     nmIvldRTagCrProc = 102;
+     nmCrProcStkTooSmall = 103;
+     nmCrProcNoPCB = 104;
+     nmDelToLimboFileErr = 105;
+     nmDelToLimboNoSpace = 106;
+     nmMLIDResetLanBd = 107;
+     nmRouterReset = 108;
+     nmVolWrongDOSType = 109;
+     nmNoOwnerNSfound = 110;
+     nmRTDMDefSMchanged = 111;
+     nmErrOpnTTSLOG = 112;
+     nmErrWrtTTSLOG = 113;
+     nmTTSdownVolDismount = 114;
+     nmTTSdisableByStaUsr = 115;
+     nmTTSdisByOp = 116;
+     nmTTSdisErrRdBackFile = 117;
+     nmTTSdisErrWrBackFile = 118;
+     nmTTSdisTooManyDefVol = 119;
+     nmTTSdisWrtVolDefInfo = 120;
+     nmTTSdisErrRdBkFlRecGen = 121;
+     nmTTSdisGrowMemTables = 122;
+     nmTTSdisErrAllDiskSp = 123;
+     nmTTSdisDirErrOnBkFile = 124;
+     nmTTSEnableByStaUsr = 125;
+     nmTTStransAbortedForSta = 126;
+     nmTTStooManyTransDelaying = 127;
+     nmTTSNoMemForExpTransNodes = 128;
+     nmAuditEvent = 129;
+     nmAuditDisNoAuditCfg = 130;
+     nmInvldConnTypeToAllocConn = 131;
+     nmInvldRTagToAllocConn = 132;
+     nmOutOfServerConns = 133;
+     nmConnTermAfter5Min = 134;
+     nmUsrAccDisableBySta = 135;
+     nmUnEncryptPwdNotAllowed = 136;
+     nmSuperAccLockedByConsole = 137;
+     nmSystemTimeChangedByCon = 138;
+     nmSystemTimeChangedBySta = 139;
+     nmVolStillActWithError = 140;
+     nmRouterFalsehood = 141;
+     nmServerAddressChanged = 142;
+     nmExtFileNoOwnerCharge = 143;
+     nmRouterConfigErrNode = 144;
+     nmRouterConfigErrMyAddr = 145;
+     nmNoMigratorLd = 146;
+     nmNoSMLd = 147;
+     nmNotEnoughRamForCompression = 148;
+     nmDiskErrorCompressing = 149;
+     nmUnknownErrorCompressing = 150;
+     nmInsufficientSpaceForDeCompression = 151;
+     nmDecompressUnknownCompressionVersion = 152;
+     nmUnknownDecompressError = 153;
+     nmInsufficientRAMToDecompress = 154;
+     nmCompressedFileIsCorrupt = 155;
+     nmStaAttemptedToUseBadPckt = 156;
+     nmStaUsedABadPckt = 157;
+     nmStaAttemptedToUseBadSFL = 158;
+     nmStaUsedABadSFL = 159;
+     nmCorruptCompFileWithName = 160;
+     nmCorruptCompFileWithNameAndStation = 161;
+     nmLowPriThreadsNotRun = 162;
+     nmWorkToDoNotRun = 163;
+     nmCompressErrorTempFileError = 164;
+     nmCompressErrorLengthTotalsMismatch = 165;
+     nmCompressErrorOffsetTotalsMismatch = 166;
+     nmCompressErrorDataCodeCountMismatch = 167;
+     nmCompressErrorLengthCountMismatch = 168;
+     nmCompressErrorLargeLengthCountMismatch = 169;
+     nmCompressErrorReadZeroBytesOrg = 170;
+     nmCompressErrorTreeTooBig = 171;
+     nmCompressErrorMatchSizeFail = 172;
+     nmSignatureInvalidAlert = 173;
+     nmLicenseIsInvalid = 174;
+     nmDeactHotFixError = 175;
+     nmUnknownDecompressErrorFN = 176;
+     nmInsufficientRAMToDecompressFN = 177;
+     nmDecompressUnderFreePercentage = 178;
+     nmNegPktTriedLargeBuffer = 179;
+     nmLoginDisabledByConsole = 180;
+     nmLoginEnabledByConsole = 181;
+     nmGrwStkNotAvail = 182;
+     nmLicenseFileIsMissing = 183;
+     nmFailedToDeletedMigratedFile = 184;
+     nmNoMemForAuditing = 185;
+     nmAuditFileWriteError = 186;
+     nmAuditFileFull = 187;
+     nmAuditFileThresholdOverflow = 188;
+     nmCompressErrorReadZeroBytesInt = 189;
+     nmEASpaceLimit = 190;
+     nmThreadAreaNotEmpty = 191;
+     nmErrMovingLogToMSEngine = 192;
+     nmFaultInConsoleCmdHandler = 193;
+     nmServerToServerComLinkActivated = 194;
+     nmServerToServerComLinkFailure = 195;
+     nmServerToServerComLinkDeact = 196;
+     nmOtherServerAttemptedToSync = 197;
+     nmServerToServerComLinkBrokeOK = 198;
+     nmServerSyncStartingIAmSecondary = 199;
+     nmBadSvrInitMsgFromOtherSvr = 200;
+     nmSvrToSvrCommLinkInitFailed = 201;
+     nmFailedDuringSyncWithReason = 202;
+     nmCommDrvLdDuringActivateWait = 203;
+     nmErrWritingStatusDump = 204;
+     nmComDrvFailureOnPrimary = 205;
+     nmComDrvFailureOnSecondary = 206;
+     nmErrFinishingGenStatusDump = 207;
+     nmSFTIIWhatToDoWithReasonString = 208;
+     nmSFTIIErrorUnexpected = 209;
+     nmSyncErrFromCustomServerNLM = 210;
+     nmSvrLinkHasPluggedPacket = 211;
+     nmSvrToBeRevived = 212;
+     nmServersAreSyncPri = 213;
+     nmSvrCantRouteIPXSec = 214;
+     nmSrvIPXRouteInfoSec = 215;
+     nmErrGivingRAMtoMS = 216;
+     nmMoreRAMgivenToMS = 217;
+     nmServersAreSyncSec = 218;
+     nmSvrCantRouteIPXPri = 219;
+     nmSrvIPXRouteInfoPri = 220;
+     nmPriSvrFailedButSecDown = 221;
+     nmPriSvrFailedNewPri = 222;
+     nmNumMemSegsExceedLimit = 223;
+     nmNumScreenExceedsLimit = 224;
+     nmIOVersionMismatch = 225;
+     nmOtherSvrProtectLvlNoMatch = 226;
+     nmOtherSvrScrAddrMismatch = 227;
+     nmIOEngNotAtSameAddr = 228;
+     nmBothSvrHaveMSEng = 229;
+     nmNoMSEngOnServers = 230;
+     nmSecSvrMissingRAM = 231;
+     nmBothSrvHaveSameIPXAddr = 232;
+     nmIOEngIPXAddrMatchMSEng = 233;
+     nmIOEngsMismatchRxSizes = 234;
+     nmIOEngsHaveSameName = 235;
+     nmNoMemForIOEngName = 236;
+     nmSrvToSvrLinkBeginSync = 237;
+     nmMSEngActivated = 238;
+     nmMSEngActNowSyncOther = 239;
+     nmIOtoMSComMisMatchUnload = 240;
+     nmSFTIIIOutOfMsgCodes = 241;
+     nmErrXferDumpToSystem = 242;
+     nmFailureChkPrimary = 243;
+     nmNoMemForOtherIOEngScr = 244;
+     nmErrStarting2ndProc = 245;
+     nmSrvFailureMsg = 246;
+     nmSecIOEngSupModNotLd = 247;
+     nmMSLBdNumHasConn = 248;
+     nmSecSvrLANIsBetter = 249;
+     nmIPXrtnStatusPckts = 250;
+     nmIPXnotRtnStatChkPckts = 251;
+     nmIPXnotRtnStatLANJam = 252;
+     nmFailReasonByOtherSrv = 253;
+     nmIPXMayBeTooSlowForSecSrv = 254;
+     nmIPXToOtherSrvTooManyHops = 255;
+     nmIPXappearsDown = 256;
+     nmIPXFoundRouteToOtherSrv = 257;
+     nmIPXLostRoute = 258;
+     nmSecSrvGoingToDie = 259;
+     nmPriSrcDyingTimerStart = 260;
+     nmPriSrvDying = 261;
+     nmIPXInternetIsJammed = 262;
+     nmIPXNewRouteToSecSvr = 263;
+     nmSrvsSyncing = 264;
+     nmFSHookRegistered = 265;
+     nmFSHookDeRegistered = 266;
+     nmIOEngCantBorrowMemory = 267;
+     nmDecompressNoCompressionOnVolume = 268;
+     nmMkProcessUsingTooSmallStk = 269;
+     nmQueueEventReportNoMemory = 270;
+     nmServerPartMirrorNotSync = 271;
+     nmStaWithoutRightsConsoleRPC = 272;
+     nmAuditOverflowFileThreshold = 273;
+     nmAuditOverflowFileFull = 274;
+     nmSwitchStacksGrwStk = 275;
+     nmConsoleCommandProcRestarted = 276;
+     nmGrowableStackGrew = 278;
+     nmOtherSvrIOLogSpaceNoMatch = 279;
+     nmDFSLogicalStackRead = 280;
+     nmDFSLogicalStackWrite = 281;
+     nmSecureEraseFailure = 282;
+     nmDropBadPktBurstConn = 283;
+     nmOutOfIPXSockets = 284;
+     nmVolumeObjectIDChanged = 285;
+     nmAbendRecovery = 286;
+     nmOpLockTimeout = 287;
+     nmAbendRecovered = 288;
+     nmUnknownSetCmd = 289;    { starting with NetWare 5...  }
+     nmAddressSpaceProtectionFault = 290;
+     nmAddressSpaceFailedToRestart = 291;
+     nmAddressSpaceRestarted = 292;
+     nmCorruptMemoryNodeDetected = 293;
+     nmAddressSpaceCleanupFailure = 294;
+     nmInvalidParameter = 295;
+     nmInvalidObjectHandle = 296;
+     nmNullPointer = 297;
+     nmVolDmtMedDmt = 298;
+     nmVolDmtmedChgd = 299;
+     nmAccDelByUsrActConn = 300;
+     nmResourcesRelErr = 301;
+     nmDemoVersion = 302;
+     nmDemoVersionTooLong = 303;
+     nmLicenseReSellerFileIsMissing = 304;
+     nmLicenseUpgradeIsMissing = 305;
+     nmLicenseVersionInvalid = 306;
+     nmLicenseProductInvalid = 307;
+     nmLicenseNoMoreFiles = 308;
+     nmLicensePIDInvalid = 309;
+     nmLicenseContentInalid = 310;
+     nmLicenseBadUpgrade = 311;
+     nmLicensePrevMaxConnMisMatch = 312;
+     nmLicenseContentResellerBad = 313;
+     nmLicenseSNMisMatch = 314;
+     nmLicenseUIDMisMatch = 315;
+     nmLicenseOpenError = 316;
+     nmLicenseCompanionErr = 317;
+     nmLicenseSNUpgradeMisMatch = 318;
+     nmLicenseUnableToRemMSL = 319;
+     nmLicenseUnableToRemULF = 320;
+     nmLicenseUnableToRemRLF = 321;
+     nmLicenseUnableToGetFileSize = 322;
+     nmLicenseUnkLicenseType = 323;
+     nmLicenseReadErr = 324;
+     nmLicenseFileSizeMisMatch = 325;
+     nmLicenseDupServerLic = 326;
+     nmLicenseNeedUpgrade = 327;
+     nmLicenseMirrorNeedUpgrade = 328;
+     nmLicenseDupLicDiscovered = 329;
+     nmLicenseDupLicDiscoveredDel = 330;
+     nmLicenseCpyRightViolated = 331;
+     nmLicenseExpired = 332;
+     nmVolDmtDevMedChgd = 333;
+     nmVolDmtDevMedDmt = 334;
+     nmInsMediaAckDS = 335;
+     nmInsMediaAckMag = 336;
+     nmInsMediaAbortedDS = 337;
+     nmInsMediaAbortedMag = 338;
+     nmRemMediaAckDS = 339;
+     nmRemMediaAckMag = 340;
+     nmRemMediaAbortDS = 341;
+     nmRemMediaAbortMag = 342;
+     nmInsMediaIntoDS = 343;
+     nmInsMediaIntoMag = 344;
+     nmRemMediaFromDS = 345;
+     nmRemMediaFromMag = 346;
+     nmServAddr = 347;
+     nmSwapInError = 348;
+     nmSwapOutError = 349;
+     nmAveragePageInThresholdExceeded = 350;
+     nmIllegalRequest = 351;
+     nmTTSThrottleDelayError = 352;
+     nmTTSLackOfResourcesError = 353;
+     nmTTSLackOfResourcesNoReason = 354;
+     nmDelayedWTDNotRunning = 355;
+     nmInvalidCharacterInName = 356;
+  { starting with NetWare 6...  }
+     nmMPKBadThreadState = 357;
+     nmPoolSeriousError = 358;
+     nmPoolSeriousReadError = 359;
+     nmVolSeriousError = 360;
+     nmVolSeriousReadError = 361;
+     nmVolDeactSeriousIOError = 362;
+     nmVolDeactSeriousNonIOError = 363;
+     nmPoolDeactSeriousIOError = 364;
+     nmPoolDeactSeriousNonIOError = 365;
+     nmTaskZeroCheck = 366;
+  { values for 'alertLocus' in EventNetWareAlertStruct_t...  }
+     LOCUS_UNKNOWN = 0;
+     LOCUS_MEMORY = 1;
+     LOCUS_FILESYSTEM = 2;
+     LOCUS_DISKS = 3;
+     LOCUS_LANBOARDS = 4;
+     LOCUS_COMSTACKS = 5;
+     LOCUS_TTS = 7;
+     LOCUS_BINDERY = 8;
+     LOCUS_STATION = 9;
+     LOCUS_ROUTER = 10;
+     LOCUS_LOCKS = 11;
+     LOCUS_KERNEL = 12;
+     LOCUS_UPS = 13;
+     LOCUS_SERVICE_PROTOCOL = 14;
+     LOCUS_SFT_III = 15;
+     LOCUS_RESOURCE_TRACKING = 16;
+     LOCUS_NLM = 17;
+     LOCUS_OS_INFORMATION = 18;
+     LOCUS_CACHE = 19;
+  { values for 'alertClass' in EventNetWareAlertStruct_t...  }
+     CLASS_UNKNOWN = 0;
+     CLASS_OUT_OF_RESOURCE = 1;
+     CLASS_TEMP_SITUATION = 2;
+     CLASS_AUTHORIZATION_FAILURE = 3;
+     CLASS_INTERNAL_ERROR = 4;
+     CLASS_HARDWARE_FAILURE = 5;
+     CLASS_SYSTEM_FAILURE = 6;
+     CLASS_REQUEST_ERROR = 7;
+     CLASS_NOT_FOUND = 8;
+     CLASS_BAD_FORMAT = 9;
+     CLASS_LOCKED = 10;
+     CLASS_MEDIA_FAILURE = 11;
+     CLASS_ITEM_EXISTS = 12;
+     CLASS_STATION_FAILURE = 13;
+     CLASS_LIMIT_EXCEEDED = 14;
+     CLASS_CONFIGURATION_ERROR = 15;
+     CLASS_LIMIT_ALMOST_EXCEEDED = 16;
+     CLASS_SECURITY_AUDIT_INFO = 17;
+     CLASS_DISK_INFORMATION = 18;
+     CLASS_GENERAL_INFORMATION = 19;
+     CLASS_FILE_COMPRESSION = 20;
+     CLASS_PROTECTION_VIOLATION = 21;
+     CLASS_VIRTUAL_MEMORY = 22;
+  { values for 'alertSeverity' in EventNetWareAlertStruct_t...  }
+  { counters reached thresholds          }
+     SEVERITY_INFORMATIONAL = 0;
+  { config errors, etc. no damage        }
+     SEVERITY_WARNING = 1;
+  { hot fix disk, etc. worked around     }
+     SEVERITY_RECOVERABLE = 2;
+  { disk mirror failure, etc. fix-up attempted  }
+     SEVERITY_CRITICAL = 3;
+  { resource fatally affected--shut down }
+     SEVERITY_FATAL = 4;
+  { cannot complete--result unknown      }
+     SEVERITY_OPERATION_ABORTED = 5;
+  { cannot complete--will not affect OS  }
+     SEVERITY_NONOS_UNRECOVERABLE = 6;
+  { values for 'targetNotificationBits' in EventNetWareAlertStruct_t...  }
+     NOTIFY_CONNECTION_BIT = $00000001;
+     NOTIFY_EVERYONE_BIT = $00000002;
+     NOTIFY_ERROR_LOG_BIT = $00000004;
+     NOTIFY_CONSOLE_BIT = $00000008;
+  { use if alert to be queued  }
+     NOTIFY_QUEUE_MESSAGE = $10000000;
+     NOTIFY_DONT_NOTIFY_NMAGENT = $80000000;
+
+
+type
+
+   PEventSecurityChange_t = ^EventSecurityChange_t;
+   EventSecurityChange_t = record
+        objectID : dword;
+        equivalentID : dword;
+        changeFlags : dword;
+     end;
+
+   PEventTrusteeChange_t = ^EventTrusteeChange_t;
+   EventTrusteeChange_t = record
+        objectID : dword;
+        entryID : dword;
+        volumeNumber : longint;
+        changeFlags : dword;
+        newRights : dword;
+     end;
+
+   PEventModifyDirEntry_t = ^EventModifyDirEntry_t;
+   EventModifyDirEntry_t = record
+        primaryDirectoryEntry : dword;
+        nameSpace : longint;
+        modifyBits : dword;
+        modifyVector : pointer;
+        volumeNumber : longint;
+        directoryEntry : dword;
+     end;
+
+   PEventProtocolBind_t = ^EventProtocolBind_t;
+   EventProtocolBind_t = record
+        boardNumber : longint;
+        protocolNumber : longint;
+     end;
+
+   PEventDateMigrationInfo_t = ^EventDateMigrationInfo_t;
+   EventDateMigrationInfo_t = record
+        FileSystemTypeID : dword;
+        Volume : longint;
+        DOSDirEntry : dword;
+        OwnerDirEntry : dword;
+        OwnerNameSpace : longint;
+        OwnerFileName : array[0..(1 + 255)-1] of char;
+     end;
+
+   PEventQueueNote_t = ^EventQueueNote_t;
+   EventQueueNote_t = record
+        QAction : longint;
+        QID : dword;
+        QName : array[0..(49 + 1)-1] of char;
+     end;
+
+   PEventNetWareAlert_t = ^EventNetWareAlert_t;
+   EventNetWareAlert_t = record
+        alertFlags : dword;
+        alertId : dword;
+        alertLocus : dword;
+        alertClass : dword;
+        alertSeverity : dword;
+        targetStationCount : longint;
+        targetStationList : array[0..31] of dword;
+        targetNotificationBits : dword;
+        alertParmCount : longint;
+        alertDataPtr : pointer;
+        NetWorkManagementAttributePointer : pointer;
+        alertUnused : array[0..1] of dword;
+        alertControlStringMessageNumber : longint;
+        alertControlString : array[0..255] of char;
+        alertParameters : array[0..(256 + 256)-1] of char;
+        alertModuleName : array[0..35] of char;
+        alertModuleMajorVersion : longint;
+        alertModuleMinorVersion : longint;
+        alertModuleRevision : longint;
+     end;
+
+   PEventBinderyObject_t = ^EventBinderyObject_t;
+   EventBinderyObject_t = record
+        EventObjectSignature : dword;
+        ObjectID : dword;
+        ObjectType : dword;
+     end;
+
+function DSAllocateEventTag(signature:dword):pointer;cdecl;external libc_nlm name 'DSAllocateEventTag';
+
+type
+
+   PEventDSObject_t = ^EventDSObject_t;
+   EventDSObject_t = record
+        EventObjectSignature : dword;
+        EventType : dword;
+        entry : pointer;
+     end;
+
+   PEventCloseFileInfo_t = ^EventCloseFileInfo_t;
+   EventCloseFileInfo_t = record
+        fileHandle : dword;
+        station : longint;
+        task : longint;
+        fileHandleFlags : dword;
+        completionCode : longint;
+     end;
+
+   PEventCheckKeyInfo_t = ^EventCheckKeyInfo_t;
+   EventCheckKeyInfo_t = record
+        structVersion : dword;
+        keyData : dword;
+        scrID : scr_t;
+     end;
+{
+** A consumer registering for an event sets this flag in the event type to
+** denote that the consumer is multiprocessor safe. This allows us to
+** distinguish multiprocessor safe consumers from unsafe ones.
+ }
+{
+** Values for fields of EventNetWareAlertStruct_t.
+ }
+{
+** Values for 'alertID' in EventNetWareAlertStruct_t comprised of two parts,
+** the ModuleNumber (upper 16 bits) and AlertNumber (lower 16 bits).
+** AlertNumber is under the control of the module specified by ModuleNumber.
+**
+** ModuleNumber specifies which module is generating the alert and AlertNumber
+** can then be used for a specific alert generated by that module.
+**
+** Any ModuleNumber in the range 0x8000xxxx to 0xFFFFxxxx. Range 0x0001xxxx
+** through 0x7fffxxxx is reserved for Novell. Value 0x0000xxxx is considered
+** invalid and is used for all legacy alerts.
+ }
+{ allotted ModuleNumbers for 'alertID' in EventNetWareAlertStruct_t...  }
+{
+** OS-defined AlertNumber values for 'alertID' in EventNetWareAlertStruct_t
+** structure. }
+
+   Pevent_handle_t = ^event_handle_t;
+   event_handle_t = longint;
+
+   Report_t = procedure (parm:pointer; userParm:pointer);cdecl;
+
+   Warn_t = function (printf:pointer; parm:pointer; userParm:pointer):longint;cdecl;
+
+function RegisterForEventNotification(rtag:rtag_t; _type:longint; priority:longint; warn:Warn_t; report:Report_t;
+           userParm:pointer):event_handle_t;cdecl;external system_nlm name 'RegisterForEventNotification';
+function UnRegisterEventNotification(handle:event_handle_t):longint;cdecl;external system_nlm name 'UnRegisterEventNotification';
+function CanEventBlock(_type:longint):longint;cdecl;external system_nlm name 'CanEventBlock';
+function CheckForRegisteredEvent(_type:longint):longint;cdecl;external system_nlm name 'CheckForRegisteredEvent';
+function EventCheck(_type:longint; printf:pointer; parm:pointer):longint;cdecl;external system_nlm name 'EventCheck';
+function EventReport(_type:longint; parm:pointer):longint;cdecl;external system_nlm name 'EventReport';
+
+
+{ server interfaces...  }
+{ ShutdownServer() 'flags'...  }
+
+    const
+       NW_POST65_MAX_CMDLINE_LEN = 2048 + 1;
+       SHUTDOWN_RESET            = $00000001;   { ShutdownServer() 'flags'...  }
+       SHUTDOWN_POWEROFF         = $00000002;   { unimplemented }
+
+
+procedure RestartServer(commandLine:Pchar);cdecl;external system_nlm name 'RestartServer';
+function ShutdownServer(scrID:scr_t; forceDown:byte; alternateMessage:Pchar; flags:dword):longint;cdecl;external system_nlm name 'ShutdownServer';
+function StopServer(scrID:scr_t; forceDown:byte; reserved1:dword; reserved2:pointer; alternateMessage:Pchar;
+           reserved3:dword):longint;cdecl;external system_nlm name 'StopServer';
+
+{ resource tag interfaces...  }
+const
+  AllocSignature               = $54524C41;
+  BreakpointSignature          = $54504B42;
+  ConsoleCommandSignature      = $4D4F4343;
+  CommandLineServicesSignature = $5043574E;
+  DebugCommandSignature        = $53504344;
+  DebuggerSignature            = $47554244;
+  EventSignature               = $544E5645;
+  ScreenSignature              = $4E524353;
+  SettableParameterSignature   = $4D505453;
+  RTAG_DESC_LEN                = 63;
+
+
+type
+   Cleanup_t = procedure (rTag:rtag_t; forceFlag:longint);cdecl;
+
+   Prtag_info = ^rtag_info;
+   rtag_info = record
+        tag : rtag_t;
+        signature : dword;
+        NLMHandle : pointer;
+        use_count : longint;
+        description : array[0..(63 + 1)-1] of char;
+     end;
+   rtag_info_t = rtag_info;
+   Prtag_info_t = ^rtag_info_t;
+
+
+function AllocateResourceTag(NLMHandle:pointer; description:Pchar; signature:dword):rtag_t;cdecl;external system_nlm name 'AllocateResourceTag';
+function GetModuleResourceTagInfo(rTag:rtag_t; NLMHandle:pointer; info:Prtag_info_t):longint;cdecl;external system_nlm name 'GetModuleResourceTagInfo';
+function ReturnResourceTag(rTag:rtag_t; displayErrorsFlag:longint):longint;cdecl;external system_nlm name 'ReturnResourceTag';
+function RegisterTrackedResource(NLMHandle:pointer; signature:dword; cleanup:Cleanup_t; description:Pchar):longint;cdecl;external system_nlm name 'RegisterTrackedResource';
+function UnRegisterTrackedResource(NLMHandle:pointer; signature:dword):longint;cdecl;external system_nlm name 'UnRegisterTrackedResource';
+function AddPollingProcedureRTag(proc:TCDeclProcedure ; rTag:rtag_t):longint;cdecl;external system_nlm name 'AddPollingProcedureRTag';
+procedure RemovePollingProcedure(proc:TCDeclProcedure);cdecl;external system_nlm name 'RemovePollingProcedure';
+
+{ NetWare-loader interfaces...  }
+const
+  MAX_SYMBOL_NAME_LEN = 80;
+
+function ExportPublicObject(NLMHandle:pointer; name:Pchar; _object:pointer):longint;cdecl;external system_nlm name 'ExportPublicObject';
+function ImportPublicObject(NLMHandle:pointer; name:Pchar):pointer;cdecl;external system_nlm name 'ImportPublicObject';
+
+    const
+       LO_NORMAL = $00000000;
+       LO_PROTECT = $00000002;
+       LO_LOAD_LOW = $00000020;
+       LO_RETURN_HANDLE = $00000040;
+       LO_LOAD_SILENT = $00000080;
+       LO_RESTART = $00000200;
+       LO_DONT_DISPLAY_ERROR = $00002000;
+       LO_MEMORY_DEBUG = $00010000;          { debug only; no production use  }
+       LO_RELAXED_MEMORY_DEBUG = $00020000;  { debug only; no production use  }
+       ERR_LOADER_COULD_NOT_FIND_FILE = 1;   { error returns from LoadModule()  }
+       ERR_LOADER_ERROR_READING_FILE = 2;
+       ERR_LOADER_NOT_NLM_FILE_FORMAT = 3;
+       ERR_LOADER_WRONG_NLM_FILE_VERSION = 4;
+       ERR_LOADER_REENTRANT_INITIALIZE_FAILURE = 5;
+       ERR_LOADER_CAN_NOT_LOAD_MULTIPLE_COPIES = 6;
+       ERR_LOADER_ALREADY_IN_PROGRESS = 7;
+       ERR_LOADER_NOT_ENOUGH_MEMORY = 8;
+       ERR_LOADER_INITIALIZE_FAILURE = 9;
+       ERR_LOADER_INCONSISTENT_FILE_FORMAT = 10;
+       ERR_LOADER_CAN_NOT_LOAD_AT_STARTUP = 11;
+       ERR_LOADER_AUTO_LOAD_MODULES_NOT_LOADED = 12;
+       ERR_LOADER_UNRESOLVED_EXTERNAL = 13;
+       ERR_LOADER_PUBLIC_ALREADY_DEFINED = 14;
+       ERR_LOADER_XDC_DATA_ERROR = 15;
+       ERR_LOADER_NOT_KERNEL = 16;
+       ERR_LOADER_NIOS_ONLY_NLM = 17;
+       ERR_LOADER_ADDRESS_SPACE_CREATION = 18;
+       ERR_LOADER_INITIALIZE_FAULT = 19;
+type
+  TLoadModulePath = record
+    case longint of
+      0 : (NLMHandle : longint);
+      1 : (path      : array [0..1024] of char);
+    end;
+
+
+function GetNLMNames(NLMHandle:pointer; name:Pchar; description:Pchar):longint;cdecl;external system_nlm name 'GetNLMNames';
+procedure KillMe(NLMHandle:pointer);cdecl;external system_nlm name 'KillMe';
+function ReturnMessageInformation(NLMHandle:pointer; table:PPPchar; stringCount:Psize_t; languageID:Plongint; helpFile:pointer):longint;cdecl;external system_nlm name 'ReturnMessageInformation';
+function SetAutoUnloadFlag(NLMHandle:pointer):longint;cdecl;external system_nlm name 'SetAutoUnloadFlag';
+
+function UnImportPublicObject(NLMHandle:pointer; name:Pchar):longint;cdecl;external system_nlm name 'UnImportPublicObject';
+function AddSearchPathAtEnd(scrID:scr_t; path:Pchar):longint;cdecl;external system_nlm name 'AddSearchPathAtEnd';
+function DeleteSearchPath(scrID:scr_t; searchPathNumber:longint):longint;cdecl;external system_nlm name 'DeleteSearchPath';
+function GetSearchPathElement(index:longint; isDOSFlag:Pdword; path:Pchar):longint;cdecl;external system_nlm name 'GetSearchPathElement';
+function GetSearchPathElement(index:longint; var isDOSFlag:dword; path:Pchar):longint;cdecl;external system_nlm name 'GetSearchPathElement';
+function GetSearchPathElement(index:longint; var isDOSFlag:longint; path:Pchar):longint;cdecl;external system_nlm name 'GetSearchPathElement';
+function InsertSearchPath(scrID:scr_t; searchPathNumber:longint; path:Pchar):longint;cdecl;external system_nlm name 'InsertSearchPath';
+function LoadModule(scrID:scr_t; path:Pchar; options:dword):longint;cdecl;external system_nlm name 'LoadModule';
+function LoadModule(scrID:scr_t; var path:TLoadModulePath; options:dword):longint;cdecl;external system_nlm name 'LoadModule';
+function UnloadModule(scrID:scr_t; commandline:Pchar):longint;cdecl;external system_nlm name 'UnloadModule';
+{ memory management interfaces }
+function _Alloc(size:size_t; rTag:rtag_t):pointer;cdecl;external system_nlm name 'Alloc';
+function Alloc(size:size_t; rTag:rtag_t):pointer;cdecl;external system_nlm name 'Alloc';
+function _AllocSleepOK(size:size_t; rTag:rtag_t; slept:Plongint):pointer;cdecl;external system_nlm name 'AllocSleepOK';
+function AllocSleepOK(size:size_t; rTag:rtag_t; slept:Plongint):pointer;cdecl;external system_nlm name 'AllocSleepOK';
+function _AllocSleepOK(size:size_t; rTag:rtag_t; var slept:longint):pointer;cdecl;external system_nlm name 'AllocSleepOK';
+function AllocSleepOK(size:size_t; rTag:rtag_t; var slept:longint):pointer;cdecl;external system_nlm name 'AllocSleepOK';
+procedure NWGarbageCollect(NLMHandle:pointer);cdecl;external system_nlm name 'NWGarbageCollect';
+function NWGetAvailableMemory:size_t;cdecl;external system_nlm name 'NWGetAvailableMemory';
+function NWGetPageSize:size_t;cdecl;external system_nlm name 'NWGetPageSize';
+function NWMemorySizeAddressable(addr:pointer; size:size_t):longint;cdecl;external system_nlm name 'NWMemorySizeAddressable';
+function _ReallocSleepOK(addr:pointer; size:size_t; rTag:rtag_t; slept:Plongint):pointer;cdecl;external system_nlm name 'ReallocSleepOK';
+function _ReallocSleepOK(addr:pointer; size:size_t; rTag:rtag_t; var slept:longint):pointer;cdecl;external system_nlm name 'ReallocSleepOK';
+function ReallocSleepOK(addr:pointer; size:size_t; rTag:rtag_t; slept:Plongint):pointer;cdecl;external system_nlm name 'ReallocSleepOK';
+function ReallocSleepOK(addr:pointer; size:size_t; rTag:rtag_t; var slept:longint):pointer;cdecl;external system_nlm name 'ReallocSleepOK';
+procedure _Free(addr:pointer);cdecl;external system_nlm name 'Free';
+
+ const
+       CMD_CONFIG_INFO     = $00000001;
+       CMD_CONVERT_UPPER   = $00000002;   { convert command line to upper case?  }
+       CMD_SERVER_RUNNING  = $00000004;   { server need to be running?  }
+       CMD_LEGAL_SERVER    = $00000008;   { command legal on regular server?  }
+       CMD_HIDDEN_CMD      = $00200000;   { don't display this command  }
+       CMD_SUB_CMDS_AVAIL  = $00100000;   { command has sub commands  }
+       CMD_NO_CMD_CHAIN    = $00010000;   { disallow chaining of command keyword  }
+       CMD_PASS_ON_ERROR   = $00020000;   { ignore error  }
+       CMD_ANY_PROCESS     = $80000000;   { can run on any process with keyboard  }
+    { keyword flags for RegisterCommand()...  }
+       CMD_MSG_NUMBER      = $80000000;   { pointer to keyword is number  }
+       CMD_LENGTH_PREC     = $40000000;   { keyword is length-preceeded  }
+    { insertion flags for RegisterCommand()...  }
+       CMD_INSERT_AT_HEAD  = $00000001;   { insert at head  }
+       CMD_INSERT_AT_TAIL  = $00000002;   { insert at tail  }
+       CMD_PERM_POSITION   = $80000000;   { leave in place (head or tail)  }
+    { valid error returns from command handler...  }
+       CMD_CMD_EXECUTED    = $00000000;   { processed, go to next handler  }
+       CMD_HALT_CMD_CHAIN  = $70000000;   { processed, but don't go on to next  }
+       CMD_BAD_CMD_SYNTAX  = $70000010;   { not processed, syntax error  }
+       CMD_NOT_RUNNING     = $70000011;   { won't execute until server up  }
+       CMD_LINE_FAULT      = $70000012;   { command line fault--no error display  }
+       CMD_BAD_MOD_HANDLE  = $70000021;   { NLM handle is invalid  }
+       CMD_BAD_RTAG = $70000022;          { invalid resource tag  }
+       CMD_BAD_KEY = $70000023;           { keyword is invalid  }
+       CMD_RTAG_AND_MOD = $70000024;      { resource tag doesn't match NLM  }
+       CMD_NO_HANDLER = $70000025;        { handler is missing  }
+       CMD_KEY_TOO_LONG = $70000026;      { keyword is too long  }
+       CMD_INVAL_PERM = $70000027;        { invalid syntax to make permanent  }
+       CMD_NO_MEMORY = $70000028;         { unable to allocate memory  }
+       CMD_NOT_REGISTERED = $70000029;    { unregistered command  }
+       CMD_HAS_CHAIN = $7000002A;         { command has a chain  }
+       CMD_CANT_MAKE_HEAD = $7000002B;    { cannot make command permanent head  }
+       CMD_CANT_MAKE_TAIL = $7000002C;    { cannot make command permanent tail  }
+       CMD_PASS_TO_NEXT = $7000002D;      { not processed, go to next handler  }
+       CMD_PRIV_ON_ALT = $7000002E;       { no privilege on alternate handler  }
+       CMD_STOP_CMDS = $7000002F;         { system no longer parsing commands  }
+    { simplified versions of returns from command handler...  }
+       CMD_PROCESSED_OK = CMD_HALT_CMD_CHAIN;
+       CMD_CHAIN_NEXT_CMD = CMD_CMD_EXECUTED;
+       CMD_SYNTAX_ERROR = CMD_BAD_CMD_SYNTAX;
+       CMD_NOT_MY_COMMAND = CMD_PASS_TO_NEXT;
+    { command handler function codes...  }
+       CMD_HELP_ON_CMD  = $00000000;
+       CMD_GET_SUB_CMDS = $00000001;
+       CMD_PROCESS_CMD  = $00000002;
+       //CMD_MAX_HELP_CMDS = ProcessCommand;
+    { error codes...  }
+       ERR_INVALID_MODULE     = $00000001;
+       ERR_INVALID_RTAG       = $00000002;
+       ERR_INVALID_KEYWORD    = $00000003;
+       ERR_MODULE_RTAG_MIX    = $00000004;
+       ERR_MISSING_HANDLER    = $00000005;
+       ERR_KEYWORD_TOO_LONG   = $00000006;
+       ERR_INVALID_REQUEST    = $00000007;
+       ERR_OUT_OF_MEMORY      = $00000008;
+       ERR_FAILED_TO_REGISTER = $00000009;
+       ERR_ALREADY_REGISTERED = $0000000A;
+       ERR_CANT_GRANT_TOP     = $0000000B;
+       ERR_CANT_GRANT_END     = $0000000C;
+
+function SizeOfAllocBlock(addr:pointer):size_t;cdecl;external system_nlm name 'SizeOfAllocBlock';
+
+type
+   CommandHandler_t = function (funcCode:longint; scrID:pointer; command:Pchar; upperCaseCommand:Pchar; callerReference:pointer):longint;cdecl;
+
+
+function DeRegisterCommand(NLMHandle:pointer; rTag:rtag_t; keywordFlags:dword; keyword:Pchar):longint;cdecl;external system_nlm name 'DeRegisterCommand';
+
+function RegisterCommand(NLMHandle:pointer; rTag:rtag_t; keywordFlags:dword; keyword:Pchar; handlerFlags:dword;
+           insertionFlags:dword; handler:CommandHandler_t; callerReference:pointer):longint;cdecl;external system_nlm name 'RegisterCommand';
+{ legacy command parsing; uses ConsoleCommandSignature...  }
+
+type
+   Parser_t = function (scrID:scr_t; commandline:Pchar):longint;cdecl;
+{ allocate with ConsoleCommandSignature  }
+
+   PCommandParser_t = ^TCommandParser;
+   TCommandParser = record
+        link   : pointer;
+        parser : Parser_t;
+        rTag   : rtag_t;
+     end;
+   PCommandParser = PCommandParser_t;
+
+
+function ParseCommand(commandLine:Pchar):longint;cdecl;external system_nlm name 'ParseCommand';
+function RegisterConsoleCommand(cmdParser:PCommandParser_t):longint;cdecl;external system_nlm name 'RegisterConsoleCommand';
+function RegisterConsoleCommand(var cmdParser:TCommandParser):longint;cdecl;external system_nlm name 'RegisterConsoleCommand';
+function UnRegisterConsoleCommand(cmdParser:PCommandParser_t):longint;cdecl;external libc_nlm name 'UnRegisterConsoleCommand';
+function UnRegisterConsoleCommand(var cmdParser:TCommandParser):longint;cdecl;external libc_nlm name 'UnRegisterConsoleCommand';
+
+    const
+       SP_TYPE_NUMBER = 0;
+    { 'value' points to DWORD (0 or !0) }
+       SP_TYPE_BOOLEAN = 1;
+       SP_TYPE_TICKS = 2;
+       SP_TYPE_BLOCK_SHIFT = 3;
+    { [+|-]hh:mm:ss converted to seconds  }
+       SP_TYPE_TIME_OFFSET = 4;
+    { 'value' points to char buffer  }
+       SP_TYPE_STRING = 5;
+       SP_TYPE_TRIGGER = 6;
+    { settable parameter flags...  }
+       SP_STARTUP_ONLY = $01;
+       SP_HIDE = $02;
+       SP_ADVANCED = $04;
+       SP_STARTUP_OR_LATER = $08;
+    { can't be done on secured console  }
+       SP_NOT_SECURED_CONSOLE = $10;
+    { lock console RPC from changing value  }
+       SP_RPC_LOCKOUT = $20;
+    { settable parameter categories...  }
+       SP_COMMUNICATIONS = 0;
+       SP_MEMORY = 1;
+       SP_FILE_CACHE = 2;
+       SP_DIR_CACHE = 3;
+       SP_FILE_SYSTEM = 4;
+       SP_LOCKS = 5;
+       SP_TRANS_TRACKING = 6;
+       SP_DISK = 7;
+       SP_TIME = 8;
+       SP_NCP = 9;
+    { recommended most common  }
+       SP_MISCELLANEOUS = 10;
+       SP_ERRORS = 11;
+       SP_DIRECTORY_SERVICES = 12;
+       SP_MULTIPROCESSOR = 13;
+    { type depends on 'type' field  }
+    { for parameter name  }
+    { for parameter description  }
+
+
+type
+
+   Psettableparms_t = ^Tsettableparms;
+   Tsettableparms = record
+        link        : pointer;
+        value       : pointer;
+        rTag        : rtag_t;
+        name        : Pchar;
+        _type       : byte;
+        flags       : byte;
+        category    : byte;
+        reserved    : byte;
+        lower_limit : dword;
+        upper_limit : dword;
+        callback    : procedure (oldValue:dword);cdecl;
+        description : Pchar;
+        msg_namenum : word;
+        msg_descnum : word;
+     end;
+    Psettableparms = Psettableparms_t;
+
+function RegisterSetableParameter(setparms:Psettableparms_t):longint;cdecl;external system_nlm name 'RegisterSetableParameter';
+function RegisterSetableParameter(var setparms:Tsettableparms):longint;cdecl;external system_nlm name 'RegisterSetableParameter';
+function DeRegisterSetableParameter(setparms:Psettableparms_t):longint;cdecl;external system_nlm name 'DeRegisterSetableParameter';
+function DeRegisterSetableParameter(var setparms:Tsettableparms):longint;cdecl;external system_nlm name 'DeRegisterSetableParameter';
+
+function GetSetableParameterValue(slot:longint; name:Pchar; value:pointer):longint;cdecl;external system_nlm name 'GetSetableParameterValue';
+function GetSetableParameterValue(slot:longint; name:Pchar; var value):longint;cdecl;external system_nlm name 'GetSetableParameterValue';
+
+function ScanSetableParameters(scanCategory:longint; scanSequence:Pdword; name:Pchar; _type:Plongint; flags:Pdword;
+           category:Plongint; description:pointer; value:pointer; lowerLimit:Plongint; upperLimit:Plongint):longint;cdecl;external system_nlm name 'ScanSetableParameters';
+function ScanSetableParameters(scanCategory:longint; var scanSequence:dword; name:Pchar; var _type:longint; var flags:dword;
+           var category:longint; var description, value; var lowerLimit,upperLimit:longint):longint;cdecl;external system_nlm name 'ScanSetableParameters';
+
+function SetSetableParameterValue(slot:longint; name:Pchar; newValue:pointer):longint;cdecl;external system_nlm name 'SetSetableParameterValue';
+function SetSetableParameterValue(slot:longint; name:Pchar; var newValue):longint;cdecl;external system_nlm name 'SetSetableParameterValue';
+{ NLM start-up synchronization...  }
+procedure SynchronizeStart;cdecl;external system_nlm name 'SynchronizeStart';
+{ message table loading...  }
+function LoadLanguageMessageTable(table:PPPchar; count:Plongint; languageID:Plongint):longint;cdecl;external system_nlm name 'LoadLanguageMessageTable';
+{ timer interfaces...  }
+function GetHighResolutionTimer:dword;cdecl;external system_nlm name 'GetHighResolutionTimer';
+function GetSuperHighResolutionTimer:dword;cdecl;external system_nlm name 'GetSuperHighResolutionTimer';
+
+{ spin locks for use in the kernel (not from a protected address space)...  }
+type
+   Pspinlock_t = ^spinlock_t;
+   spinlock_t  = pointer;
+   TSpinlock = spinlock_T;
+   PSpinlock = Pspinlock_t;
+
+function KernelSpinLockInit(lock:Pspinlock_t):longint;cdecl;external system_nlm name 'KernelSpinLockInit';
+procedure KernelSpinLock(lock:Pspinlock_t);cdecl;external system_nlm name 'KernelSpinLock';
+function KernelSpinTryLock(lock:Pspinlock_t):longint;cdecl;external system_nlm name 'KernelSpinTryLock';
+procedure KernelSpinUnlock(lock:Pspinlock_t);cdecl;external system_nlm name 'KernelSpinUnlock';
+function KernelSpinLockDisable(lock:Pspinlock_t):dword;cdecl;external system_nlm name 'KernelSpinLockDisable';
+function KernelSpinTryLockDisable(lock:Pspinlock_t; flags:Pdword):longint;cdecl;external system_nlm name 'KernelSpinTryLockDisable';
+procedure KernelSpinUnlockRestore(lock:Pspinlock_t; flags:dword);cdecl;external system_nlm name 'KernelSpinUnlockRestore';
+
+function KernelSpinLockInit(var lock:spinlock_t):longint;cdecl;external system_nlm name 'KernelSpinLockInit';
+procedure KernelSpinLock(var lock:spinlock_t);cdecl;external system_nlm name 'KernelSpinLock';
+function KernelSpinTryLock(var lock:spinlock_t):longint;cdecl;external system_nlm name 'KernelSpinTryLock';
+procedure KernelSpinUnlock(var lock:spinlock_t);cdecl;external system_nlm name 'KernelSpinUnlock';
+function KernelSpinLockDisable(var lock:spinlock_t):dword;cdecl;external system_nlm name 'KernelSpinLockDisable';
+function KernelSpinTryLockDisable(var lock:spinlock_t; flags:Pdword):longint;cdecl;external system_nlm name 'KernelSpinTryLockDisable';
+procedure KernelSpinUnlockRestore(var lock:spinlock_t; flags:dword);cdecl;external system_nlm name 'KernelSpinUnlockRestore';
+
+
+{ nonpreferred locale interfaces...  }
+type
+   Pcountryinfo_t = ^Tcountryinfo;
+   Tcountryinfo = record
+        infoID : byte;
+        size : word;
+        countryID : word;
+        codePage : word;
+        dateFormat : word;
+        currencySymbol : array[0..4] of char;
+        thousandSeparator : array[0..1] of char;
+        decimalSeparator : array[0..1] of char;
+        dateSeparator : array[0..1] of char;
+        timeSeparator : array[0..1] of char;
+        currencyFormatFlags : char;
+        digitsInCurrency : char;
+        timeFormat : char;
+        UpperCase : procedure ;cdecl;
+        dataListSeparator : array[0..1] of char;
+        spare : array[0..9] of char;
+     end;
+   Pcountryinfo = Pcountryinfo_t;
+
+function OSGetCodePage:longint;cdecl;external libc_nlm name 'OSGetCodePage';
+procedure OSGetCountryInfo(_para1:Pcountryinfo_t);cdecl;external system_nlm name 'OSGetCountryInfo';
+procedure OSGetCountryInfo(var _para1:Tcountryinfo);cdecl;external system_nlm name 'OSGetCountryInfo';
+
+    const
+       EXCEPTION_HANDLED = 0;
+       EXCEPTION_NOT_HANDLED = 1;        { chain to next handler  }
+       { registered debugger parser returns:  }
+       NEXT_DEBUG_PARSER = -(2);         { call next debug parser  }
+       NEXT_ALT_DEBUG_PARSER = -(1);     { call next registered debug parser  }
+       COMMAND_HANDLED = 0;              { call no other parser  }
+       INTERNAL_DEBUGGER = 1;            { pass to NetWare System Debugger  }
+
+
+type
+   Pexceptionframe = ^exceptionframe;
+   exceptionframe = record
+        xfReserved : array[0..6] of dword;
+        xfCR3 : Pdword;
+        xfEIP : dword;
+        xfSystemFlags : dword;
+        xfEAX : dword;
+        xfECX : dword;
+        xfEDX : dword;
+        xfEBX : dword;
+        xfESP : dword;
+        xfEBP : dword;
+        xfESI : dword;
+        xfEDI : dword;
+        xfES : array[0..1] of word;
+        xfCS : array[0..1] of word;
+        xfSS : array[0..1] of word;
+        xfDS : array[0..1] of word;
+        xfFS : array[0..1] of word;
+        xfGS : array[0..1] of word;
+        xfLDT : array[0..1] of word;
+        xfSpecial : array[0..1] of word;
+        xfNumber : dword;
+        xfDescription : Pchar;
+        xfFlags : dword;
+        xfErrorCode : dword;
+        xfPageFaultCR2 : dword;
+        xfFPUState : dword;
+        xfHistogram : dword;
+        xfProcessorID : dword;
+     end;
+   xframe_t = exceptionframe;
+   Pxframe_t = ^xframe_t;
+
+   SoftBPHandler_t = function (number:longint; address:pointer; frame:Pxframe_t):longint;cdecl;
+   DebugParser_t = function (scr:scr_t; command:Pchar; frame:Pxframe_t):longint;cdecl;
+
+
+procedure Abend(message:Pchar);cdecl;external system_nlm name 'Abend';
+function AddressOfSoftBreakpoint(number:longint):pointer;cdecl;external system_nlm name 'AddressOfSoftBreakpoint';
+function AddSoftBreakpoint(addr:pointer; handler:SoftBPHandler_t):longint;cdecl;external system_nlm name 'AddSoftBreakpoint';
+function CSetABreakpoint(number:longint; addr:pointer; _type:byte; length:byte):longint;cdecl;external system_nlm name 'CSetABreakpoint';
+procedure EnterDebugger;cdecl;external system_nlm name 'EnterDebugger';
+function GetDebuggerActiveCount:longint;cdecl;external system_nlm name 'GetDebuggerActiveCount';
+function RegisterDebugCommandParser(parseRoutine:DebugParser_t; rTag:rtag_t):longint;cdecl;external system_nlm name 'RegisterDebugCommandParser';
+function RemoveSoftBreakpoint(number:longint):longint;cdecl;external system_nlm name 'RemoveSoftBreakpoint';
+function ReserveABreakpointRTag(_para1:rtag_t):longint;cdecl;external system_nlm name 'ReserveABreakpointRTag';
+function UnRegisterDebugCommandParser(parseRoutine:DebugParser_t):longint;cdecl;external system_nlm name 'UnRegisterDebugCommandParser';
+function UnReserveABreakpoint(_para1:longint):longint;cdecl;external system_nlm name 'UnReserveABreakpoint';
+
+
+//?? dont know what this is: (exported by system)
+//var preferredModule : pointer;cvar;external;
+
+{ Prototypes for libraries and drivers writing their own start-up and shut-
+  down code. (DllMain() is also part of this list and defined in windows.h.)
+  These are not interfaces, but only prototypes for code furnished by the
+  NLM application, library, driver, etc. }
+
+function _NonAppCheckUnload:longint;cdecl;external libc_nlm name '_NonAppCheckUnload';
+
+type TReadRoutine = function (conn:longint; fileHandle:pointer; offset,nbytes,bytesRead:Psize_t; buffer:pointer):longint; cdecl;
+function _NonAppStart(NLMHandle:pointer; errorScreen:pointer; commandLine:Pchar; loadDirPath:Pchar; uninitializedDataLength:size_t;
+           NLMFileHandle:pointer; readRoutineP:TReadRoutine; customDataOffset:size_t; customDataSize:size_t; messageCount:longint;
+           messages:PPchar):longint;cdecl;external libc_nlm name '_NonAppStart';
+procedure _NonAppStop;cdecl;external libc_nlm name '_NonAppStop';
+
+  const
+     CTX_ACTUAL_CWD = $01;
+  { for set_pathname_format(), namespace appellations...  }
+     SHORT_NAMES     = 0;    { 8.3 format  }
+     MACINTOSH_NAMES = 1;
+     NFS_NAMES       = 2;
+     FTAM_NAMES      = 3;
+     LONG_NAMES      = 4;    { default long-name format  }
+     NT_NAMES        = 5;
+  { definitions useful to fshooks.h (attribute-match) and others...  }
+
+     ATTR_NORMAL             = $00000000;  { no read/write restrictions  }
+     ATTR_READ_ONLY          = $00000001;  { read-only file }
+     ATTR_HIDDEN             = $00000002;  { hidden file }
+     ATTR_SYSTEM             = $00000004;  { system file }
+     ATTR_EXECUTE            = $00000008;  { execute only file }
+     ATTR_VOLUME_ID          = $00000008;  { file system label           }
+     ATTR_DIRECTORY          = $00000010;  { subdirectory                }
+     ATTR_ARCHIVE            = $00000020;  { archive file                }
+     ATTR_SHARE              = $00000080;  { Sharable file               }
+     ATTR_NO_SUBALLOC        = $00000800;  { don't sub allocate file     }
+     ATTR_TRANS              = $00001000;  { trans'l file, TTS-usable    }
+     ATTR_READAUD            = $00004000;  { read audit                  }
+     ATTR_WRITAUD            = $00008000;  { write audit                 }
+     ATTR_IMMPURG            = $00010000;  { immediate purge             }
+     ATTR_NORENAM            = $00020000;  { rename inhibit              }
+     ATTR_NODELET            = $00040000;  { delete inhibit              }
+     ATTR_NOCOPY             = $00080000;  { copy inhibit                }
+
+     ATTR_FILE_MIGRATED      = $00400000;  { file has been migrated      }
+     ATTR_DONT_MIGRATE       = $00800000;  { don't migrate this file     }
+     ATTR_IMMEDIATE_COMPRESS = $02000000;  { compress file immediately   }
+     ATTR_FILE_COMPRESSED    = $04000000;  { file is compressed          }
+     ATTR_DONT_COMPRESS      = $08000000;  { don't compress this file    }
+     ATTR_CANT_COMPRESS      = $20000000;  { can't compress this file    }
+     ATTR_ATTR_ARCHIVE       = $40000000;  { entry has been modified     }
+  { Faster, better when getstat() or fgetstat() used with request bit map...  }
+     ST_NONE        = $00000000;
+     ST_FLAGS_BIT   = $00000001;
+     ST_MODE_BIT    = $00000002;
+     ST_GEN_BIT     = $00000004;
+     ST_INO_BIT     = $00000008;
+     ST_DEV_BIT     = $00000010;
+     ST_RDEV_BIT    = $00000020;
+     ST_SIZE_BIT    = $00000040;
+     ST_BLOCKS_BIT  = $00000080;
+     ST_BLKSIZE_BIT = $00000100;
+     ST_NLINK_BIT   = $00000200;
+     ST_UID_BIT     = $00000400;
+     ST_GID_BIT     = $00000800;
+     ST_BID_BIT     = $00001000;
+     ST_MID_BIT     = $00002000;
+     ST_ATIME_BIT   = $00004000;
+     ST_MTIME_BIT   = $00008000;
+     ST_CTIME_BIT   = $00010000;
+     ST_BTIME_BIT   = $00020000;
+     ST_STAT_BITS   = $0003FFFF;        { bits for normal stat call }
+  { the following are not returned by a normal stat call }
+     ST_RIGHTS_BIT  = $00040000;
+     ST_NAME_BIT    = $00080000;
+     ST_NS_BIT      = $00100000;        { return name in specified namespace }
+  { path analysis/parsing 'type' and 'flags' arguments for [de]construct() }
+     PATH_UNDEF     = $00000000;
+
+     PATH_DOS       = PATH_UNDEF;       { indicates potential DOS path }
+     PATH_UNC       = $00000001;        { double slash found at beginning }
+     PATH_UNIX      = $00000002;        { forward slashes only }
+     PATH_NETWARE   = $00000004;        { slash and colon followed by slashes }
+     PATH_MACINTOSH = $00000008;        { only colons }
+     PATH_ROOTED    = $00000010;        { starts with delimiter }
+     PATH_VOLROOTED = $00000020;        { volume plus colon appears }
+     PATH_EXTENSION = $00000040;        { contains period }
+     PATH_HIERARCHY = $00000080;        { at least one subdirectory element }
+     PATH_SHORTNAME = $00000100;        { 8.3 names only }
+     PATH_LONGNAME  = $00000200;        { at least one element greater than 8.3 }
+     PATH_ENDED     = $00000400;        { ends in delimiter }
+     PATH_DOSDRIVE  = $00001000;        { single-letter drive, colon and path }
+     PATH_MIXEDCASE = $00002000;        { at least one element in mixed case }
+     PATH_DOTS      = $00004000;        { path contains dots }
+     PATH_SLASH     = $00008000;        { path contains a slash }
+     PATH_BACKSLASH = $00010000;        { path contains a backslash }
+     PATH_COLON     = $00020000;        { path contains a colon }
+     PATH_ILLEGAL   = $80000000;        { illegal character or combination }
+     //PATH_MIXED = PATH_SHORT or PATH_LONG;
+{     d_cdatetime = d_cdatetim.tv_sec;
+     d_adatetime = d_adatetim.tv_sec;
+     d_bdatetime = d_bdatetim.tv_sec;
+     d_ddatetime = d_ddatetim.tv_sec;}
+       FSKEY_NONE = -(1);
+       FSKEY_TRAD = 0;
+       FSKEY_NSS  = 1;
+    { values returned by _fildes_type(): see sys/mode.h  }
+    { values returned by _fs_type()...  }
+    { 'fildes' is not a file                        }
+       FS_NOT_FS  = $00000000;
+       FS_LFS     = $00000100;  { file in local, traditional file system }
+       FS_REMOTE  = $00000200;  { file in remote file system }
+       FS_DOS     = $00000400;  { file in local, DOS file system }
+       FS_NSS     = $00000800;  { file in Novell Storage Services }
+
+
+
+
+{ for getcwdpath(), get NKS context for current working directory...  }
+{ for set_pathname_format(), namespace appellations...  }
+{ definitions useful to fshooks.h (attribute-match) and others...  }
+{ Faster, better when getstat() or fgetstat() used with request bit map...  }
+{ the following are not returned by a normal stat call                       }
+{ path analysis/parsing 'type' and 'flags' arguments for [de]construct()     }
+{ d_ddatetim & d_deletedID valid only in scanerasedfiles                     }
+{ c.f. these fields in struct dirent...  }
+{ untouched by scanerasedfiles()         }
+{ flags for this entry                   }
+{ type of entry                          }
+{ emulated file mode                     }
+{ directory entry number of d_name       }
+{ size if file                           }
+{      c.f. this field in struct dirent  }
+{ creation date and time                 }
+{ last access date--files only           }
+{ last archive date and time             }
+{ deleted date/time                      }
+{ owner id (object id)                   }
+{ object ID that last archived file      }
+{ object ID that last updated file       }
+{ deleted ID                             }
+{ lenght of following name:              }
+{ only portable field in this structure  }
+type
+
+   Pnwdirent = ^Tnwdirent;
+   Tnwdirent = record
+        d_userspec : dword;
+        d_flags : dword;
+        d_type : mode_t;
+        d_mode : mode_t;
+        d_ino : ino_t;
+        d_size : off64_t;
+        d_spare : array[0..38] of dword;
+        d_cdatetim : timespec_t;
+        d_adatetim : timespec_t;
+        d_bdatetim : timespec_t;
+        d_ddatetim : timespec_t;
+        d_uid : uid_t;
+        d_archivedID : uid_t;
+        d_updatedID : uid_t;
+        d_deletedID : uid_t;
+        d_pad1 : byte;
+        d_pad2 : byte;
+        d_pad3 : byte;
+        d_namelen : byte;
+        d_name : array[0..(255 + 1)-1] of char;
+     end;
+   TNWDIR = Tnwdirent;
+   PNWDIR = ^TNWDIR;
+{ sizeof(struct nwdirent)==0x200 (512.)  }
+{ extensions of unistd.h path parsing functions...  }
+
+
+function deconstruct(path:Pchar; server:Pchar; volume:Pchar; directory:Pchar; name:Pchar;
+           extension:Pchar; elements:Plongint; flags:Plongint):longint;cdecl;external libc_nlm name 'deconstruct';
+function construct(path:Pchar; server:Pchar; volume:Pchar; directory:Pchar; name:Pchar;
+           extension:Pchar; flags:longint):longint;cdecl;external libc_nlm name 'construct';
+{ extensions of client.h identity functions...  }
+function get_identity(pathctx:NXPathCtx_t; identity:Plongint):longint;cdecl;external libc_nlm name 'get_identity';
+{ extensions of unistd.h current working directory I/O functions...  }
+function getcwdpath(buf:Pchar; pathCtx:PNXPathCtx_t; flags:dword):Pchar;cdecl;external libc_nlm name 'getcwdpath';
+
+function chdir2(path:Pchar):longint;cdecl;external libc_nlm name 'chdir2';
+function setcwd(pathCtx:NXPathCtx_t):longint;cdecl;external libc_nlm name 'setcwd';
+function setcwd2(pathCtx:NXPathCtx_t):longint;cdecl;external libc_nlm name 'setcwd2';
+{ extensions of unistd.h file I/O functions...  }
+function eof(fildes:longint):longint;cdecl;external libc_nlm name 'eof';
+function tell(fildes:longint):off_t;cdecl;external libc_nlm name 'tell';
+{ extensions of sys/stat.h functions...  }
+function fgetstat(fildes:longint; buf:Pstat; requestmap:dword):longint;cdecl;external libc_nlm name 'fgetstat';
+
+function getstat(ctx:NXPathCtx_t; path:Pchar; buf:Pstat; requestmap:dword):longint;cdecl;external libc_nlm name 'getstat';
+function fgetstat_with_namespace(fildes:longint; buf:Pstat; requestmap:dword; _namespace:longint):longint;cdecl;external libc_nlm name 'fgetstat_with_namespace';
+
+function getstat_with_namespace(ctx:NXPathCtx_t; path:Pchar; buf:Pstat; requestmap:dword; _namespace:longint):longint;cdecl;external libc_nlm name 'getstat_with_namespace';
+{ pathname format (namespace) state...  }
+function set_pathname_format(newformat:longint; oldformat:Plongint):longint;cdecl;external libc_nlm name 'set_pathname_format';
+{ for use with Novell Clustering...  }
+
+function isclusteredvirtualserver(servername:Pchar):longint;cdecl;external libc_nlm name 'isclusteredvirtualserver';
+{ equivalent to CLib's FileServerFileCopy()...  }
+function fscopy(fildes1:longint; fildes2:longint; offset1:off64_t; offset2:off64_t; length:size_t;
+           nbytes:Psize_t):longint;cdecl;external libc_nlm name 'fscopy';
+{ equivalent to similarly named calls in CLib...  }
+
+function purgeerasedfile(path:Pchar; sequence:longint):longint;cdecl;external libc_nlm name 'purgeerasedfile';
+
+
+function salvageerasedfile(pathName:Pchar; sequence:longint; newFileName:Pchar):longint;cdecl;external libc_nlm name 'salvageerasedfile';
+
+function scanerasedfiles(path:Pchar; nextEntryNumber:Plongint; deletedFileInfo:PNWDIR):longint;cdecl;external libc_nlm name 'scanerasedfiles';
+function _fs_type(fildes:longint):longint;cdecl;external libc_nlm name '_fs_type';
+function _fildes_type(fildes:longint):longint;cdecl;external libc_nlm name '_fildes_type';
+function _fildes_from_nsskey(key:uint64_t; oflag:longint):longint;cdecl;external libc_nlm name '_fildes_from_nsskey';
+function _key_from_fildes(fildes:longint; _type:Plongint; err:Plongint):uint64_t;cdecl;external libc_nlm name '_key_from_fildes';
+{ fast type of a file descriptor--st_mode in fstat()...  }
+{ equates to move between NKS file handles and POSIX descriptors...  }
+{ derivation of POSIX descriptor from NSS open file key...  }
+{ back-derivation of file system key...  }
+{ types returned in back-derivation...  }
+{ values returned by _fildes_type(): see sys/mode.h  }
+{ values returned by _fs_type()...  }
+{ attributes for NXDirAttrWin_t 'dwFileAttributes' field...  }
+
+
+{ turn on 1-byte packing...  }
+
+  const
+     FILE_ATTRIBUTE_READONLY            = $00000001;
+     FILE_ATTRIBUTE_HIDDEN              = $00000002;
+     FILE_ATTRIBUTE_SYSTEM              = $00000004;
+     FILE_ATTRIBUTE_DIRECTORY           = $00000010;
+     FILE_ATTRIBUTE_ARCHIVE             = $00000020;
+     FILE_ATTRIBUTE_ENCRYPTED           = $00000040;
+     FILE_ATTRIBUTE_NORMAL              = $00000080;
+     FILE_ATTRIBUTE_TEMPORARY           = $00000100;
+     FILE_ATTRIBUTE_SPARSE_FILE         = $00000200;
+     FILE_ATTRIBUTE_REPARSE_POINT       = $00000400;
+     FILE_ATTRIBUTE_COMPRESSED          = $00000800;
+     FILE_ATTRIBUTE_OFFLINE             = $00001000;
+     FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = $00002000;
+
+
+type
+   PNXDirAttrDos_t = ^NXDirAttrDos_t;
+   NXDirAttrDos_t = record                    { DOS/FAT32 (NX_PNF_DOS) attributes    }
+        xdeHeader : NXDeHeader_t;
+        xdeFid : NXFid_t;
+        xdeEffectiveRights : dword;
+                                              { FAT32 File System Spec., p. 22       }
+        xdeAttr : dword;
+        xdeCrtDate : word;
+        xdeCrtTime : word;
+        xdeCrtTimeTenth : word;
+        xdeLastAccDate : word;
+        xdeWrtDate : word;
+        xdeWrtTime : word;
+        xdeFileSize : dword;
+        Reserved1 : dword;
+        Reserved2 : dword;
+     end;
+{ DOS/FAT32 (NX_PNF_DOS) information.. }
+{ ...including name                    }
+{ maximum length is 255 characters     }
+
+   PNXDirEnumDos_t = ^NXDirEnumDos_t;
+   NXDirEnumDos_t = record
+        deDosDirAttr : NXDirAttrDos_t;
+        deDirMark : NXDirMark_t;
+        deShortName : array[0..15] of char;
+        deName : pointer;
+     end;
+{ Win32 (NX_PNF_WIN) attributes        }
+{ see WIN32_FIND_DATA...               }
+{ FILE_ATTRIBUTE_NORMAL, etc.          }
+{ date and time of creation or -1      }
+{ date and time of last access         }
+{ date and time of last modification   }
+{ date and time of last attr change    }
+{ see BY_HANDLE_FILE_INFORMATION...    }
+{ always 1 for FAT                     }
+{ unique identifier                    }
+{ CIFS Specification 0.9, 4.2.16.8...  }
+{ file system block size               }
+{ (currently) Ramesh-invented fields... }
+{ not in Win32 docs, but exists        }
+{ Boolean flag fields for CIFS         }
+{ total size of extended attributes    }
+{ size of compressed file           }
+{ format of of compression           }
+
+   PNXDirAttrWin_t = ^NXDirAttrWin_t;
+   NXDirAttrWin_t = record
+        xdeHeader : NXDeHeader_t;
+        xdeFid : NXFid_t;
+        xdeEffectiveRights : dword;
+        xdeFileAttributes : dword;
+        xdeCreateTime : uint64_t;
+        xdeLastAccessTime : uint64_t;
+        xdeLastWriteTime : uint64_t;
+        xdeLastChangeTime : uint64_t;
+        xdeFileSize : uint64_t;
+        Reserved0 : dword;
+        Reserved1 : dword;
+        Reserved2 : dword;
+        Reserved3 : dword;
+        xdeNumberOfLinks : dword;
+        xdeVolumeSerialNumber : dword;
+        Reserved4 : dword;
+        Reserved5 : dword;
+        xdeFileIndex : uint64_t;
+        Reserved6 : uint64_t;
+        xdeAllocationSize : dword;
+        xdeAccessFlags : dword;
+        xdeMiscFlags : dword;
+        Reserved7 : dword;
+        xdeEaSize : uint64_t;
+        xdeCompressedFileSize : uint64_t;
+        xdeCompressionFormat : word;
+        Reserved8 : word;
+        Reserved9 : dword;
+        Reserved10 : uint64_t;
+     end;
+{ Win32 (NX_PNF_WIN) information...    }
+{ ...including name                    }
+{ see WIN32_FIND_DATA...               }
+{ maximum length is 255 characters     }
+
+   PNXDirEnumWin_t = ^NXDirEnumWin_t;
+   NXDirEnumWin_t = record
+        deWinDirAttr : NXDirAttrWin_t;
+        deDirMark : NXDirMark_t;
+        deAlternativeFileName : array[0..15] of char;
+        deName : pointer;
+     end;
+{============================================================================
+=  Novell Software Development Kit
+=
+=  Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
+=
+=  This work is subject to U.S. and international copyright laws and treaties.
+=  Use and redistribution of this work is subject  to  the  license  agreement
+=  accompanying  the  software  development kit (SDK) that contains this work.
+=  However, no part of this work may be revised and/or  modified  without  the
+=  prior  written consent of Novell, Inc. Any use or exploitation of this work
+=  without authorization could subject the perpetrator to criminal  and  civil
+=  liability.
+=
+=  Source(s): Novell Header
+=
+=  poppack.h
+==============================================================================
+ }
+
+(** unsupported pragma#pragma pack()*)
+
+
+// nks/errno.h
+
+  const
+     NX_EOF = -(1);
+     NX_ENOENT = 1;        { no such file or directory                      }
+     NX_E2BIG = 2;         { argument list too big                          }
+     NX_ENOEXEC = 3;       { exec format error                              }
+     NX_EBADF = 4;         { bad file number (descriptor or handle)         }
+     NX_ENOMEM = 5;        { not enough memory                              }
+     NX_EACCES = 6;        { permission denied                              }
+     NX_EEXIST = 7;        { file exists                                    }
+     NX_EXDEV = 8;         { cross-device link                              }
+     NX_EINVAL = 9;        { invalid argument                               }
+     NX_ENFILE = 10;       { file table overflow                            }
+     NX_EMFILE = 11;       { too many open files                            }
+     NX_ENOSPC = 12;       { no space left on device                        }
+     NX_ERANGE = 14;       { result too large                               }
+     NX_EDEADLK = 15;      { resource deadlock would occur                  }
+     NX_EINUSE = 16;       { resource(s) in use                             }
+     NX_ESERVER = 17;      { server error (memory out, I/O error, etc.)     }
+     NX_ENOSERVR = 18;     { no server (queue server, file server, etc.)    }
+     NX_EWRNGKND = 19;     { wrong kind--an operation is being...           }
+                           {  ...attempted on the wrong kind of object      }
+     NX_ETRNREST = 20;     { transaction restarted                          }
+     NX_ERESOURCE = 21;    { resources unavailable (maybe permanently)      }
+     NX_EBADHNDL = 22;     { bad non-file handle (screen, semaphore, etc.)  }
+     NX_EAGAIN = 24;       { resource temporarily unavailable               }
+     NX_EIO = 28;          { physical I/O error                             }
+     NX_EPIPE = 32;        { broken pipe                                    }
+     NX_EALREADY = 37;     { operation already in progress                  }
+     NX_ETIMEDOUT = 60;    { connection timed out                           }
+     NX_EBUSY = 62;        { resource busy                                  }
+     NX_EINTR = 63;        { interrupted function call                      }
+     NX_EISDIR = 64;       { is a directory (not a file)                    }
+     NX_ENAMETOOLONG = 65; { filename too long                              }
+     NX_ENOSYS = 66;       { function not implemented                       }
+     NX_ENOTDIR = 67;      { not a directory                                }
+     NX_ENOTEMPTY = 68;    { directory is not empty                         }
+     NX_EPERM = 69;        { operation not permitted                        }
+     NX_ECHILD = 70;       { no child process                               }
+     NX_EFBIG = 71;        { file too large                                 }
+     NX_EMLINK = 72;       { too many links                                 }
+     NX_ENOLCK = 74;       { no locks available                             }
+     NX_ESRCH = 77;        { no such object                                 }
+     NX_ENOTSUP = 79;      { this optional functionality not supported      }
+     NX_EBADTYPE = 80;     { bad type for operation                         }
+     NX_EOVERFLOW = 81;    { operation would overflow                       }
+     NX_EHOSTDOWN = 82;    { host is down                                   }
+     NX_EHOSTUNREACH = 83; { no route to host                               }
+     NX_EPROCLIM = 84;     { too many processes                             }
+     NX_EUNKNOWN = 99;     { unknown error occurring                        }
+     NX_ENLMDATA = 100;    { anomaly in NLM data structure                  }
+     NX_EILSEQ = 101;      { illegal character sequence in multibyte        }
+     NX_EINCONSIS = 102;   { internal library inconsistency                 }
+     NX_EDOSTEXTEOL = 103; { DOS-text file inconsistency--no newline...     }
+                           { ...after carriage return                       }
+     NX_ENONEXTANT = 104;  { object doesn't exist                           }
+     NX_ENOCONTEXT = 105;  { the caller is not an NKS thread                }
+     NX_ENAMESPACE = 106;  { invalid namespace or namespace operation       }
+     NX_EBADCONN = 107;    { invalid connection                             }
+     NX_EEXHAUSTED = 108;  { end of search                                  }
+     NX_EFILESYS = 111;    { generic file system error                      }
+     NX_ESUFFICIENT = 112; { insufficient space for any operation result    }
+     NX_EPARTONLY = 113;   { partial result only  for lack of space         }
+     NX_EBADIDENT = 114;   { invalid user or other identity                 }
+     { aliases...  }
+     NX_ENOSUPPORT = NX_ENOTSUP;
+     //NX_ENORESOURCE = NX_BADIDENT;
+
+
+procedure NXGetNKSVersion(major:Plongint; minor:Plongint; revision:Plongint; platformName:pointer; maxNameLength:size_t);cdecl;external libc_nlm name 'NXGetNKSVersion';
+procedure NXGetNKSVersion(var major, minor, revision:longint; platformName:pchar; maxNameLength:size_t);cdecl;external libc_nlm name 'NXGetNKSVersion';
+function NXStrError(errornumber:longint):Pchar;cdecl;external libc_nlm name 'NXStrError';
+
+
+// nks/mac.h
+{ turn on 1-byte packing...  }
+
+  { values for 'fdFlags' (Inside Macintosh IV-105)...  }
+
+const
+  fOnDesk    = 1;
+  fHasBundle = 8192;
+  fInvisible = 16384;
+  { values for 'fdLocation' (Inside Macintosh IV-105)...  }
+  fDisk      = 0;
+  fDesktop   = -(2);
+  fTrash     = -(3);
+  { 'ioFlAttrib' values...  }
+  flLocked   = $01;
+  flResOpen  = $04;
+  flDatOpen  = $08;
+  flIsDir    = $10;
+  flBothOpen = $80;
+
+type
+   POSType = ^OSType;
+   OSType = char;
+{ (Inside Macintosh II-373)  }
+{ (Inside Macintosh I-139)  }
+
+   PPoint = ^Point;
+   Point = record
+        v : word;
+        h : word;
+     end;
+{ (Inside Macintosh I-141)  }
+
+   PRect = ^Rect;
+   Rect = record
+       case longint of
+          0 : ( corner : record
+               topLeft : Point;
+               botRight : Point;
+            end );
+          1 : ( point : record
+               top : word;
+               left : word;
+               bottom : word;
+               right : word;
+            end );
+       end;
+{ (Inside Macintosh IV-104)  }
+{ window  }
+
+   PFInfo = ^FInfo;
+   FInfo = record
+        fdType : OSType;
+        fdCreator : OSType;
+        fdFlags : word;
+        fdLocation : Point;
+        fdFldr : word;
+     end;
+{ (Inside Macintosh IV-105)  }
+{ Finder (Desktop) comment ID  }
+{ home directory ID  }
+
+   PFXInfo = ^FXInfo;
+   FXInfo = record
+        fdIconID : word;
+        fdUnused : array[0..3] of word;
+        fdComment : word;
+        fdPutAway : dword;
+     end;
+{ (Inside Macintosh IV-105)  }
+{ folder's rectangle  }
+
+   PDInfo = ^DInfo;
+   DInfo = record
+        frRect : Rect;
+        frFlags : word;
+        frLocation : Point;
+        frView : word;
+     end;
+{ scroll position                            }
+{ directory ID chain of open folders         }
+{ directory ID                               }
+
+   PDXInfo = ^DXInfo;
+   DXInfo = record
+        frScroll : Point;
+        frOpenChain : dword;
+        frUnused : word;
+        frComment : word;
+        frPutAway : dword;
+     end;
+{ information used by the Finder             }
+{ directory ID or file number                }
+{ first allocation block of data fork        }
+{ logical end-of-file of data fork           }
+{ physical end-of-file of data fork          }
+{ first allocation block of resource fork    }
+{ logical end-of-file of resource fork       }
+{ physical end-of-file of resource fork      }
+{ date and time of creation                  }
+{ date and time of last modification         }
+{ date and time of last back-up              }
+{ additional information used by the Finder  }
+{ file's parent directory ID                 }
+{ file's clump size                          }
+
+   PhFileInfo = ^hFileInfo;
+   hFileInfo = record
+        ioFlFndrInfo : FInfo;
+        ioDirID : dword;
+        ioFlStBlk : word;
+        ioFlLgLen : dword;
+        ioFlPyLen : dword;
+        ioFlRStBlk : word;
+        ioFlRLgLen : dword;
+        ioFlRPyLen : dword;
+        ioFlCrDat : dword;
+        ioFlMdDat : dword;
+        ioFlBkDat : dword;
+        ioFlXFndrInfo : FXInfo;
+        ioFlParID : dword;
+        ioFlClpSiz : dword;
+     end;
+{ information used by the Finder             }
+{ number of files in directory               }
+{ date and time of creation                  }
+{ date and time of last modification         }
+{ date and time of last backup               }
+{ additional information used by the Finder  }
+{ directory's parent directory ID            }
+
+   PdirInfo = ^dirInfo;
+   dirInfo = record
+        ioDrUsrWds : DInfo;
+        ioDrDirID : dword;
+        ioDrNmFls : word;
+        filler3 : array[0..8] of word;
+        ioDrCrDat : dword;
+        ioDrMdDat : dword;
+        ioDrBkDat : dword;
+        ioDrFndrInfo : DXInfo;
+        ioDrParID : dword;
+     end;
+
+   PCInfoPBRec = ^CInfoPBRec;
+   CInfoPBRec = record
+       case longint of
+          0 : ( _file : hFileInfo );
+          1 : ( dir : dirInfo );
+       end;
+{ Macintosh (NX_PNF_MAC) attributes          }
+{ (Inside Macintosh IV-125)  }
+{ path reference number  }
+
+   PNXDirAttrMac_t = ^NXDirAttrMac_t;
+   NXDirAttrMac_t = record
+        xdeHeader : NXDeHeader_t;
+        xdeFid : NXFid_t;
+        xdeEffectRights : dword;
+        xdeIoFRefNum : word;
+        xdeIofVersNum : int8_t;
+        filler1 : int8_t;
+        xdeIoFDirIndex : word;
+        xdeIoFlAttrib : int8_t;
+        filler2 : int8_t;
+        filler3 : dword;
+        xdeInfo : CInfoPBRec;
+     end;
+{ Macintosh (NX_PNF_MAC) information...      }
+{ ...including                               }
+{ maximum length is 255 characters     }
+
+   PNXDirEnumMac_t = ^NXDirEnumMac_t;
+   NXDirEnumMac_t = record
+        deMacDirAttr : NXDirAttrMac_t;
+        deDirMark : NXDirMark_t;
+        deName : pointer;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+// nks/memory.h
+
+  { deprecated values for memory control flags...  }
+
+  const
+     NX_PAGE_UNLOCK       = $00000000;
+     NX_PAGE_LOCK         = $00000001;
+     NX_PAGE_RESERVE      = $00000020;
+     NX_PAGE_COMMIT       = $00000040;
+     NX_PAGE_PHYSICAL     = $00000080;
+     NX_PAGE_RESERVE_ONLY = $00000100;
+  { final values for memory control flags...  }
+     NX_MEM_UNLOCK        = $00000000;
+     NX_MEM_LOCK          = $00000001;
+     NX_MEM_DECOMMIT      = $00000020;
+     NX_MEM_COMMIT        = $00000040;
+     NX_MEM_RESERVE       = $00000100;
+
+function NXMemAlloc(size:size_t; alignment:size_t):pointer;cdecl;external libc_nlm name 'NXMemAlloc';
+function NXMemCtl(start:pointer; size:size_t; flags:dword):longint;cdecl;external libc_nlm name 'NXMemCtl';
+procedure NXMemFree(memory:pointer);cdecl;external libc_nlm name 'NXMemFree';
+function NXMemRealloc(old:pointer; newSize:size_t; alignment:size_t):pointer;cdecl;external libc_nlm name 'NXMemRealloc';
+function NXPageAlloc(pageCount:size_t; flags:dword):pointer;cdecl;external libc_nlm name 'NXPageAlloc';
+procedure NXPageFree(memory:pointer);cdecl;external libc_nlm name 'NXPageFree';
+
+
+{ nks/netware.h =============================================================}
+{ turn on 1-byte packing...  }
+
+type
+
+   PnxTrustees_t = ^nxTrustees_t;
+   nxTrustees_t = record
+        trObjectID,
+        trRights   : dword;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{----------------------------------------------------------------------------
+ The following are unofficial NKS interfaces and can only be used on NetWare.
+ ----------------------------------------------------------------------------}
+
+procedure nxCancelCheck;cdecl;external libc_nlm name 'nxCancelCheck';
+procedure nxCancelDisable;cdecl;external libc_nlm name 'nxCancelDisable';
+procedure nxCancelEnable;cdecl;external libc_nlm name 'nxCancelEnable';
+function nxContextFlushName(context:PNXContext_t):longint;cdecl;external libc_nlm name 'nxContextFlushName';
+
+function nxExportInterface(funcAddr:pointer; funcName:Pchar):longint;cdecl;external libc_nlm name 'nxExportInterface';
+
+function nxExportInterfaceWrapped(funcAddr:pointer; stackWords:longint; funcName:Pchar; reference:Ppointer):longint;cdecl;external libc_nlm name 'nxExportInterfaceWrapped';
+function nxGetEnviron:PPchar;cdecl;external libc_nlm name 'nxGetEnviron';
+function nxIsLoadedProtected:NXBool_t;cdecl;external libc_nlm name 'nxIsLoadedProtected';
+function nxIsProtectedAddress(_para1:pointer):NXBool_t;cdecl;external libc_nlm name 'nxIsProtectedAddress';
+function nxMemGetSize(block:pointer):size_t;cdecl;external libc_nlm name 'nxMemGetSize';
+procedure nxUnexportInterfaceWrapped(reference:pointer);cdecl;external libc_nlm name 'nxUnexportInterfaceWrapped';
+{ NetWare trustees...  }
+
+function nxAddTrustee(pathCtx:NXPathCtx_t; pathname:Pchar; objectID:dword; rights:dword):longint;cdecl;external libc_nlm name 'nxAddTrustee';
+function nxDeleteTrustee(pathCtx:NXPathCtx_t; pathname:Pchar; objectID:dword):longint;cdecl;external libc_nlm name 'nxDeleteTrustee';
+function nxScanTrustees(pathCtx:NXPathCtx_t; pathname:Pchar; sequence:dword; count:Pdword; trusteeVector:PnxTrustees_t;
+           nextSequence:Pdword):longint;cdecl;external libc_nlm name 'nxScanTrustees';
+{ wrap/unwrap sobriquets...  }
+// nks/synch.h
+
+{ turn on 1-byte packing...  }
+
+type
+   PNXHierarchy_t = ^NXHierarchy_t;
+   NXHierarchy_t = longint;
+
+   PNXMutex_t = ^NXMutex_t;
+   NXMutex_t = record
+        reserved1 : uint64_t;
+        reserved2 : array[0..9] of pointer;
+     end;
+
+   PNXRwLock_t = ^NXRwLock_t;
+   NXRwLock_t = record
+        reserved1 : uint64_t;
+        reserved2 : array[0..9] of pointer;
+     end;
+
+   PNXSema_t = ^NXSema_t;
+   NXSema_t = record
+        reserved1 : uint64_t;
+        reserved2 : array[0..4] of pointer;
+     end;
+
+   PNXCond_t = ^NXCond_t;
+   NXCond_t = record
+        reserved1 : uint64_t;
+        reserved2 : array[0..4] of pointer;
+     end;
+
+   PNXLockInfo_t = ^NXLockInfo_t;
+   NXLockInfo_t = record
+        liName : array[0..(31 + 1)-1] of char;
+        liFlags : dword;
+        liPad : array[0..1] of dword;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ Mutexes...  }
+
+
+function NXMutexAlloc(flags:dword; hierarchy:NXHierarchy_t; info:PNXLockInfo_t):PNXMutex_t;cdecl;external libc_nlm name 'NXMutexAlloc';
+procedure NXMutexDeinit(mutex:PNXMutex_t);cdecl;external libc_nlm name 'NXMutexDeinit';
+function NXMutexDepth(mutex:PNXMutex_t):longint;cdecl;external libc_nlm name 'NXMutexDepth';
+procedure NXMutexFree(mutex:PNXMutex_t);cdecl;external libc_nlm name 'NXMutexFree';
+function NXMutexInit(mutex:PNXMutex_t; flags:dword; hierarchy:NXHierarchy_t; info:PNXLockInfo_t):longint;cdecl;external libc_nlm name 'NXMutexInit';
+function NXMutexIsOwned(mutex:PNXMutex_t):NXBool_t;cdecl;external libc_nlm name 'NXMutexIsOwned';
+function NXMutexTestFlag(mutex:PNXMutex_t; flag:dword):NXBool_t;cdecl;external libc_nlm name 'NXMutexTestFlag';
+function NXLock(mutex:PNXMutex_t):longint;cdecl;external libc_nlm name 'NXLock';
+function NXTryLock(mutex:PNXMutex_t):NXBool_t;cdecl;external libc_nlm name 'NXTryLock';
+function NXUnlock(mutex:PNXMutex_t):longint;cdecl;external libc_nlm name 'NXUnlock';
+
+{ Reader-writer locks...  }
+function NXRwLockAlloc(hierarchy:NXHierarchy_t; info:PNXLockInfo_t):PNXRwLock_t;cdecl;external libc_nlm name 'NXRwLockAlloc';
+procedure NXRwLockDeinit(lock:PNXRwLock_t);cdecl;external libc_nlm name 'NXRwLockDeinit';
+procedure NXRwLockFree(lock:PNXRwLock_t);cdecl;external libc_nlm name 'NXRwLockFree';
+function NXRwLockInit(lock:PNXRwLock_t; hierarchy:NXHierarchy_t; info:PNXLockInfo_t):longint;cdecl;external libc_nlm name 'NXRwLockInit';
+function NXRwLockIsOwned(lock:PNXRwLock_t; mode:dword):NXBool_t;cdecl;external libc_nlm name 'NXRwLockIsOwned';
+procedure NXRdLock(lock:PNXRwLock_t);cdecl;external libc_nlm name 'NXRdLock';
+procedure NXWrLock(lock:PNXRwLock_t);cdecl;external libc_nlm name 'NXWrLock';
+function NXTryRdLock(lock:PNXRwLock_t):NXBool_t;cdecl;external libc_nlm name 'NXTryRdLock';
+function NXTryWrLock(lock:PNXRwLock_t):NXBool_t;cdecl;external libc_nlm name 'NXTryWrLock';
+procedure NXRwUnlock(lock:PNXRwLock_t);cdecl;external libc_nlm name 'NXRwUnlock';
+function NXRwLockUpgrade(lock:PNXRwLock_t):longint;cdecl;external libc_nlm name 'NXRwLockUpgrade';
+function NXRwLockDowngrade(lock:PNXRwLock_t):longint;cdecl;external libc_nlm name 'NXRwLockDowngrade';
+{ Semaphores...  }
+function NXSemaAlloc(count:dword; arg:pointer):PNXSema_t;cdecl;external libc_nlm name 'NXSemaAlloc';
+procedure NXSemaDeinit(sema:PNXSema_t);cdecl;external libc_nlm name 'NXSemaDeinit';
+procedure NXSemaFree(sema:PNXSema_t);cdecl;external libc_nlm name 'NXSemaFree';
+function NXSemaInit(sema:PNXSema_t; count:dword; arg:pointer):longint;cdecl;external libc_nlm name 'NXSemaInit';
+procedure NXSemaPost(sema:PNXSema_t);cdecl;external libc_nlm name 'NXSemaPost';
+function NXSemaTryWait(sema:PNXSema_t):NXBool_t;cdecl;external libc_nlm name 'NXSemaTryWait';
+procedure NXSemaWait(sema:PNXSema_t);cdecl;external libc_nlm name 'NXSemaWait';
+{ Condition variables...  }
+function NXCondAlloc(arg:pointer):PNXCond_t;cdecl;external libc_nlm name 'NXCondAlloc';
+procedure NXCondBroadcast(cond:PNXCond_t);cdecl;external libc_nlm name 'NXCondBroadcast';
+procedure NXCondDeinit(cond:PNXCond_t);cdecl;external libc_nlm name 'NXCondDeinit';
+procedure NXCondFree(cond:PNXCond_t);cdecl;external libc_nlm name 'NXCondFree';
+function NXCondInit(cond:PNXCond_t; arg:pointer):longint;cdecl;external libc_nlm name 'NXCondInit';
+procedure NXCondSignal(cond:PNXCond_t);cdecl;external libc_nlm name 'NXCondSignal';
+function NXCondWait(cond:PNXCond_t; mutex:PNXMutex_t):longint;cdecl;external libc_nlm name 'NXCondWait';
+function NXCondTimedWait(cond:PNXCond_t; mutex:PNXMutex_t; interval:dword):longint;cdecl;external libc_nlm name 'NXCondTimedWait';
+
+
+
+
+//  assert.h
+
+procedure _assert(_para1:Pchar; _para2:Pchar; _para3:Pchar; _para4:longint);cdecl;external libc_nlm name '_assert';
+{ modifications to behavior of assert()        }
+{ assert() prints but returns -1               }
+{ (value returned for no assertion)            }
+{ assert() aborts (normal, default action)     }
+{ assert() prints and drops into the debugger  }
+type
+   action_code =  Longint;
+Const
+  __IGNORE = -(1);
+  __NOERR = 0;
+  __ABORT = 1;
+  __DEBUGGER = 2;
+
+function assert_action(_para1:action_code):longint;cdecl;external libc_nlm name 'assert_action';
+function _assert_expr(_para1:longint; _para2:Pchar; _para3:Pchar; _para4:Pchar; _para5:longint):longint;cdecl;external libc_nlm name '_assert_expr';
+
+// nks/unix.h
+
+{ turn on 1-byte packing...  }
+
+{ UNIX (NX_PNF_UNIX) attributes           }
+{ file mode                               }
+{ number of links                         }
+{ last access time (files only)           }
+{ last modify time                        }
+{ last archive time                       }
+{ last attribute change time (or 0)       }
+{ generation; bumped when file modified   }
+{ entry serial number                     }
+{ file system (device) containing entry   }
+{ ID of raw device containing this entry  }
+{ user ID of the owner of this entry      }
+{ group ID of the group of this entry     }
+{ length of file in bytes                 }
+{ number of 512-byte blocks allocated     }
+{ preferred I/O block size                }
+type
+
+   PNXDirAttrUnix_t = ^NXDirAttrUnix_t;
+   NXDirAttrUnix_t = record
+        xdeHeader : NXDeHeader_t;
+        xdeFid : NXFid_t;
+        xdeEffectiveRights : dword;
+        xde_mode : dword;
+        xde_nlink : dword;
+        spare1 : dword;
+        xde_atime : time_t;
+        xde_mtime : time_t;
+        xde_btime : time_t;
+        xde_ctime : time_t;
+        xde_change : uint64_t;
+        xde_ino : uint64_t;
+        xde_dev : array[0..1] of uint64_t;
+        xde_rdev : array[0..1] of uint64_t;
+        xde_uid : uint64_t;
+        xde_gid : uint64_t;
+        xde_size : uint64_t;
+        xde_blocks : uint64_t;
+        xde_blksize : dword;
+        spare2 : dword;
+        spare3 : uint64_t;
+        spare4 : uint64_t;
+        spare5 : uint64_t;
+        spare6 : uint64_t;
+        spare7 : uint64_t;
+        spare8 : uint64_t;
+     end;
+{ UNIX (NX_PNF_UNIX) information...       }
+{ ...including name                       }
+{ maximum length is 255 characters        }
+
+   PNXDirEnumUnix_t = ^NXDirEnumUnix_t;
+   NXDirEnumUnix_t = record
+        deUnixDirAttr : NXDirAttrUnix_t;
+        deDirMark : NXDirMark_t;
+        deName : pointer;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+//  nks/vm.h
+
+{ value for 'wait_for' in NXVmJoin()...  }
+{ values for 'flags' in NXVmSpawn()...  }
+{ returned in newVm if NXVmSpawn() is passed NX_VM_DETACHED or if it fails  }
+
+{ turn on 1-byte packing...  }
+
+type
+   PNXStrType_t = ^NXStrType_t;
+   NXStrType_t  =  Longint;
+Const
+   NX_STR_ASCII   = $FFFFFFFF;
+   NX_STR_UTF8    = $00000000;
+   NX_STR_UNICODE = $00000001;
+
+{ NX_OBJ_FILE, NX_OBJ_CONSOLE, NX_OBJ_FIFO, etc. }
+{ set to 0                                       }
+{ ancestor of 'ssPath'                           }
+{ relative to 'ssPathCtx'                        }
+type
+   PNXNameSpec_t = ^NXNameSpec_t;
+   NXNameSpec_t = record
+        ssType : NXObjType_t;
+        ssReserved : longint;
+        ssPathCtx : NXPathCtx_t;
+        ssPath : pointer;
+     end;
+   NXStreamSpec_t = NXNameSpec_t;
+   PNXStreamSpec_t = ^NXStreamSpec_t;
+{ unused; set to 0                               }
+{ count of arguments in 'esArgv'                 }
+{ command-line arguments to spawned VM           }
+{ starting environment of spawned VM             }
+{ wiring of standard input for spawned VM        }
+{ wiring of standard output for spawned VM       }
+{ wiring of standard error for spawned VM        }
+
+   PNXExecEnvSpec_t = ^NXExecEnvSpec_t;
+   NXExecEnvSpec_t = record
+        esFlags : longint;
+        esArgc : longint;
+        esArgv : ^pointer;
+        esEnv : ^pointer;
+        esStdin : NXStreamSpec_t;
+        esStdout : NXStreamSpec_t;
+        esStderr : NXStreamSpec_t;
+     end;
+{ maxmimum number of threads in worker pool      }
+{ implementation-reserved                        }
+
+   PNXVmWorkerThreadConfig_t = ^NXVmWorkerThreadConfig_t;
+   NXVmWorkerThreadConfig_t = record
+        wtcThreads : size_t;
+        reserved : array[0..4] of longint;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ Virtual machine management...  }
+
+function  NXVmDestroy(id:NXVmId_t):longint;cdecl;external libc_nlm name 'NXVmDestroy';
+procedure NXVmExit(status:longint);cdecl;external libc_nlm name 'NXVmExit';
+function  NXVmGetId:NXVmId_t;cdecl;external libc_nlm name 'NXVmGetId';
+function  NXVmGetWorkerThreadConfig(reserved:pointer; config:PNXVmWorkerThreadConfig_t):longint;cdecl;external libc_nlm name 'NXVmGetWorkerThreadConfig';
+function  NXVmGetStringType(_type:PNXStrType_t):longint;cdecl;external libc_nlm name 'NXVmGetStringType';
+function  NXVmJoin(wait_for:NXVmId_t; departed_vm:PNXVmId_t; status:Plongint):longint;cdecl;external libc_nlm name 'NXVmJoin';
+function  NXVmRegisterExitHandler(cleanup:TCDeclProc1PtrArg; arg:pointer):longint;cdecl;external libc_nlm name 'NXVmRegisterExitHandler';
+function  NXVmSetWorkerThreadConfig(reserved:pointer; config:PNXVmWorkerThreadConfig_t):longint;cdecl;external libc_nlm name 'NXVmSetWorkerThreadConfig';
+function  NXVmSpawn(name:PNXNameSpec_t; envSpec:PNXExecEnvSpec_t; flags:dword; newVm:PNXVmId_t):longint;cdecl;external libc_nlm name 'NXVmSpawn';
+function  NXVmUnregisterExitHandler(func:TCDeclProc1PtrArg; arg:pointer):longint;cdecl;external libc_nlm name 'NXVmUnregisterExitHandler';
+
+
+// alloca.h
+{ Non-standard functions from stdlib.h }
+//** void   *alloca( size_t );
+
+
+// client.h
+
+// stdbool.h
+
+{ origin flags...  }
+{ address type flags (used in combination with ORIGIN_ADDRESS)...  }
+{ transport type flags...  }
+{ NMAS sequence passed...  }
+{ string format flags...  }
+{ suggested maximum lengths (in characters)...  }
+
+{ turn on 1-byte packing...  }
+
+  const
+     ORIGIN_NAME    = $0010;
+     ORIGIN_ADDRESS = $0020;    { interpret 'server' as 'netaddr_t'      }
+  { address type flags (used in combination with ORIGIN_ADDRESS)...  }
+  { address is IPX                         }
+     ADDR_IPX = $0100;
+     ADDR_IP = $0200;           { address is Internet Protocol           }
+     ADDR_IPV6 = $0400;         { address is Internet Protocol version 6 }
+  { transport type flags...  }
+  { transport type unspecified             }
+     XPORT_WILD = $0000;
+  { prefer Novell IPX                      }
+     XPORT_IPX = $0001;
+  { prefer TCP                             }
+     XPORT_TCP = $0002;
+  { NMAS sequence passed...  }
+  { alternative NMAS-based authentication  }
+     NMAS_SEQUENCE = $8000;
+  { string format flags...  }
+     USERNAME_ASCII = $00000;
+     USERNAME_UTF8 = $10000;
+     USERNAME_UNICODE = $20000;
+  { suggested maximum lengths (in characters)...  }
+  { ASCII, Unicode or UTF-8                }
+     MAX_USERNAME_LEN = 255;
+  { (always in ASCII characters)           }
+     MAX_PASSWORD_LEN = 255;
+     MAX_TREENAME_LEN = 48;
+     MAX_SERVERNAME_LEN = 48;
+
+
+type
+
+   Pnetaddr_t = ^netaddr_t;
+   netaddr_t = record
+        _type : longint;
+        length : size_t;
+        address : array[0..47] of byte;
+     end;
+
+   Pfrag_t = ^frag_t;
+   frag_t = record
+        data : pointer;
+        length : size_t;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ managing user identity...  }
+
+
+{$ifndef DisableArrayOfConst}
+function build_username(max:size_t; flags:dword; username:Pchar; user:Pchar; args:array of const):longint;cdecl;external libc_nlm name 'build_username';
+{$endif}
+function build_username(max:size_t; flags:dword; username:Pchar; user:Pchar):longint;cdecl;external libc_nlm name 'build_username';
+
+
+function create_identity(treename:Pchar; username:pointer; password:Pchar; nmas_sequence:pointer; flags:dword;
+           identity:Plongint):longint;cdecl;external libc_nlm name 'create_identity';
+function create_server_identity(identity:Plongint):longint;cdecl;external libc_nlm name 'create_server_identity';
+function is_valid_identity(identity:longint; error:Plongint):longint;cdecl;external libc_nlm name 'is_valid_identity';
+procedure delete_identity(identity:longint);cdecl;external libc_nlm name 'delete_identity';
+{ managing NCP sessions with a remote server...  }
+
+function open_ncp_session(identity:longint; flags:dword; servername:Pchar; session:Plongint):longint;cdecl;external libc_nlm name 'open_ncp_session';
+function close_ncp_session(session:longint):longint;cdecl;external libc_nlm name 'close_ncp_session';
+function send_ncp(session:longint; requestCode:longint; sendFragCount:longint; sendFrags:array of frag_t; replyFragCount:longint;
+           replyFrags:array of frag_t; replyFragsUsed:Plongint; ncp_error:Plongint):longint;cdecl;external libc_nlm name 'send_ncp';
+
+// complex.h
+
+{ not presently supported  }
+
+
+// ctype.h
+  var
+     __ctype : array of byte;cvar;external;
+{ standard prototypes...  }
+
+function isalnum(_para1:longint):longint;cdecl;external libc_nlm name 'isalnum';
+function isalpha(_para1:longint):longint;cdecl;external libc_nlm name 'isalpha';
+function isblank(_para1:longint):longint;cdecl;external libc_nlm name 'isblank';
+function iscntrl(_para1:longint):longint;cdecl;external libc_nlm name 'iscntrl';
+function isdigit(_para1:longint):longint;cdecl;external libc_nlm name 'isdigit';
+function isgraph(_para1:longint):longint;cdecl;external libc_nlm name 'isgraph';
+function islower(_para1:longint):longint;cdecl;external libc_nlm name 'islower';
+function isprint(_para1:longint):longint;cdecl;external libc_nlm name 'isprint';
+function ispunct(_para1:longint):longint;cdecl;external libc_nlm name 'ispunct';
+function isspace(_para1:longint):longint;cdecl;external libc_nlm name 'isspace';
+function isupper(_para1:longint):longint;cdecl;external libc_nlm name 'isupper';
+function isxdigit(_para1:longint):longint;cdecl;external libc_nlm name 'isxdigit';
+function tolower(_para1:longint):longint;cdecl;external libc_nlm name 'tolower';
+function toupper(_para1:longint):longint;cdecl;external libc_nlm name 'toupper';
+function isascii(_para1:longint):longint;cdecl;external libc_nlm name 'isascii';
+function toascii(_para1:longint):longint;cdecl;external libc_nlm name 'toascii';
+function ismultibyte(_para1:Pchar):longint;cdecl;external libc_nlm name 'ismultibyte';
+function Lisalnum(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisalnum';
+function Lisalpha(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisalpha';
+function Lisblank(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisblank';
+function Liscntrl(_para1:Pchar):longint;cdecl;external libc_nlm name 'Liscntrl';
+function Lisdigit(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisdigit';
+function Lisgraph(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisgraph';
+function Lislower(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lislower';
+function Lisprint(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisprint';
+function Lispunct(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lispunct';
+function Lisspace(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisspace';
+function Lisupper(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisupper';
+function Lisxdigit(_para1:Pchar):longint;cdecl;external libc_nlm name 'Lisxdigit';
+
+
+// dfs.h
+
+{===========================================================
+  Traditional direct file system
+  These were interfaced by CLib in its NDK header, nwdfs.h
+============================================================}
+
+  const
+     DFS_FAILURE = -(1);
+     DFS_SUCCESS = 0;
+     DFS_ERR_INSUFFICIENT_SPACE = 1;
+     DFS_ERR_VOLUME_SEGMENT_DEACTIVATED = 4;
+     DFS_ERR_TRUNCATION_FAILURE = 16;
+     DFS_ERR_HOLE_IN_FILE = 17;
+     DFS_ERR_PARAMETER = 18;
+     DFS_ERR_OVERLAP = 19;
+     DFS_ERR_SEGMENT = 20;
+     DFS_ERR_BOUNDARY = 21;
+     DFS_ERR_INSUFFICIENT_LIMBO_FILE_SPACE = 22;
+     DFS_ERR_NOT_IN_DIRECT_FILE_MODE = 23;
+     DFS_ERR_OPERATION_BEYOND_EOF = 24;
+     DFS_ERR_OUT_OF_FILDES = 129;
+     DFS_ERR_HARD_IO = 131;
+     DFS_ERR_EBADF = 136;
+     DFS_ERR_CANT_READ = 147;
+     DFS_ERR_CANT_WRITE = 148;
+     DFS_ERR_FILE_DETACHED = 149;
+     DFS_ERR_ENOMEM = 150;
+     DFS_ERR_INVALID_VOLUME = 152;
+     DFS_ERR_IO_LOCK = 162;
+  { setSizeFlags  }
+
+     DFS_SETSIZE_NON_SPARSE_FILE = $00000001;    { to extend the file  }
+     DFS_SETSIZE_NO_ZERO_FILL    = $00000002;    { do not zero fill  }
+     DFS_SETSIZE_UNDO_ON_ERROR   = $00000004;    { truncate to original eof  }
+     DFS_SETSIZE_PHYSICAL_ONLY   = $00000008;    { change physical EOF only  }
+     DFS_SETSIZE_LOGICAL_ONLY    = $00000010;    { change only the logical EOF  }
+
+
+{ type definitions...  }
+type
+
+   Pdfs_filemap_t = ^dfs_filemap_t;
+   dfs_filemap_t = record
+        FileBlock : longint;
+        VolumeBlock : longint;
+        NumberOfBlocks : longint;
+     end;
+
+   Pdfs_volinfo_t = ^dfs_volinfo_t;
+   dfs_volinfo_t = record
+        VolumeAllocationUnitSizeInBytes : size_t;
+        VolumeSizeInAllocationUnits : size_t;
+        VolumeSectorSize : size_t;
+        AllocationUnitsUsed : longint;
+        AllocationUnitsFreelyAvailable : longint;
+        AllocationUnitsInDeletedFilesNotAvailable : longint;
+        AllocationUnitsInAvailableDeletedFiles : longint;
+        NumberOfPhysicalSegmentsInVolume : longint;
+        PhysicalSegmentSizeInAllocationUnits : array[0..63] of size_t;
+     end;
+
+   Pdfs_cbparms_t = ^dfs_cbparms_t;
+   dfs_cbparms_t = record
+        sema : pointer;
+        ccode : longint;
+     end;
+{============================================================================
+=  Novell Software Development Kit
+=
+=  Copyright (C) 1999-2003 Novell, Inc. All Rights Reserved.
+=
+=  This work is subject to U.S. and international copyright laws and treaties.
+=  Use and redistribution of this work is subject  to  the  license  agreement
+=  accompanying  the  software  development kit (SDK) that contains this work.
+=  However, no part of this work may be revised and/or  modified  without  the
+=  prior  written consent of Novell, Inc. Any use or exploitation of this work
+=  without authorization could subject the perpetrator to criminal  and  civil
+=  liability.
+=
+=  Source(s): Open Group Header
+=
+=  dlfcn.h
+==============================================================================
+=  Interfaces from the Single UNIX Specification of the Open Group for the
+=  management of imported symbols and shared (dynamic) libraries. The imple-
+=  mentation on NetWare is narrower as noted by the number of features that
+=  are ignored or unsupported.
+==============================================================================}
+  const
+     RTLD_LAZY = $01;
+     RTLD_NOW = $02;               { ignored }
+     RTLD_GLOBAL = $04;            { ignored }
+     RTLD_LOCAL = $08;             { ignored }
+     RTLD_MULTIPLE = $10;          { NetWare: force-load multiple times  }
+     MAX_DLL_NAME_LEN = 8;         { special purpose value for 'handle' in dlsym()...  }
+     MAX_SYMNAME_LEN = 255;        { maximim length of 'name' in dlsym()...  }
+
+
+function dlopen(path:Pchar; mode:longint):pointer;cdecl;external libc_nlm name 'dlopen';
+function dlsym(handle:pointer; name:Pchar):pointer;cdecl;external libc_nlm name 'dlsym';
+function dlclose(handle:pointer):longint;cdecl;external libc_nlm name 'dlclose';
+function dlerror:Pchar;cdecl;external libc_nlm name 'dlerror';
+
+
+// endian.h
+{ defines `__BYTE_ORDER' for the hosting environment...  }
+{ some environments use a different "endianness" for floating point values  }
+
+  const
+     __LITTLE_ENDIAN = 1234;
+     __BIG_ENDIAN = 4321;
+     __PDP_ENDIAN = 3412;
+  { defines `__BYTE_ORDER' for the hosting environment...  }
+     __BYTE_ORDER = __LITTLE_ENDIAN;
+     __FLOAT_WORD_ORDER = __BYTE_ORDER;
+     LITTLE_ENDIAN = __LITTLE_ENDIAN;
+     BIG_ENDIAN = __BIG_ENDIAN;
+     PDP_ENDIAN = __PDP_ENDIAN;
+     BYTE_ORDER = __BYTE_ORDER;
+
+
+
+// err.h
+
+{$ifndef DisableArrayOfConst}
+procedure err(_para1:longint; _para2:Pchar; args:array of const);cdecl;external libc_nlm name 'err';
+{$endif}
+procedure err(_para1:longint; _para2:Pchar);cdecl;external libc_nlm name 'err';
+procedure verr(_para1:longint; _para2:Pchar; _para3:va_list);cdecl;external libc_nlm name 'verr';
+
+{$ifndef DisableArrayOfConst}
+procedure errx(_para1:longint; _para2:Pchar; args:array of const);cdecl;external libc_nlm name 'errx';
+{$endif}
+procedure errx(_para1:longint; _para2:Pchar);cdecl;external libc_nlm name 'errx';
+procedure verrx(_para1:longint; _para2:Pchar; _para3:va_list);cdecl;external libc_nlm name 'verrx';
+
+{$ifndef DisableArrayOfConst}
+procedure warn(_para1:Pchar; args:array of const);cdecl;external libc_nlm name 'warn';
+{$endif}
+procedure warn(_para1:Pchar);cdecl;external libc_nlm name 'warn';
+procedure vwarn(_para1:Pchar; _para2:va_list);cdecl;external libc_nlm name 'vwarn';
+
+{$ifndef DisableArrayOfConst}
+procedure warnx(_para1:Pchar; args:array of const);cdecl;external libc_nlm name 'warnx';
+{$endif}
+procedure warnx(_para1:Pchar);cdecl;external libc_nlm name 'warnx';
+procedure vwarnx(_para1:Pchar; _para2:va_list);cdecl;external libc_nlm name 'vwarnx';
+
+
+
+// errno.h
+
+  const
+     ENOENT = 1;
+     E2BIG = 2;           { arg list too big                               }
+     ENOEXEC = 3;         { exec format error                              }
+     EBADF = 4;           { bad file number                                }
+     ENOMEM = 5;          { not enough memory                              }
+     EACCES = 6;          { permission denied                              }
+     EEXIST = 7;          { file exists                                    }
+     EXDEV = 8;           { cross-device link                              }
+     EINVAL = 9;          { invalid argument                               }
+     ENFILE = 10;         { file table overflow                            }
+     EMFILE = 11;         { too many open files                            }
+     ENOSPC = 12;         { no space left on device                        }
+     EDOM = 13;           { argument too large                             }
+     ERANGE = 14;         { result too large                               }
+     EDEADLK = 15;        { resource deadlock would occur                  }
+  { -------------------------- Miscellaneous NLM Library constants ----------  }
+     EINUSE = 16;         { resource(s) in use                             }
+     ESERVER = 17;        { server error (memory out, I/O error, etc.)     }
+     ENOSERVR = 18;       { no server (queue server, file server, etc.)    }
+     EWRNGKND = 19;       { wrong kind--an operation is being...           }
+                          {  ...attempted on the wrong kind of object      }
+     ETRNREST = 20;       { transaction restarted                          }
+     ERESOURCE = 21;      { resources unavailable (maybe permanently)      }
+     EBADHNDL = 22;       { bad non-file handle (screen, semaphore, etc.)  }
+     ENO_SCRNS = 23;      { screen I/O attempted when no screens           }
+  { -------------------------- Additional POSIX / traditional UNIX constants   }
+     EAGAIN = 24;         { resource temporarily unavailable               }
+     ENXIO = 25;          { no such device or address                      }
+     EBADMSG = 26;        { not a data message                             }
+     EFAULT = 27;         { bad address                                    }
+     EIO = 28;            { physical I/O error                             }
+     ENODATA = 29;        { no data                                        }
+     ENOSTRMS = 30;       { streams not available                          }
+  { Berkeley sockets constants ------------------  }
+     EPROTO = 31;         { fatal protocol error                           }
+     EPIPE = 32;          { broken pipe                                    }
+     ESPIPE = 33;         { illegal seek                                   }
+  { Non-blocking and interrupt I/O constants ----  }
+     ETIME = 34;          { ioctl acknowledge timeout                      }
+     EWOULDBLOCK = 35;    { operation would block                          }
+     EINPROGRESS = 36;    { operation now in progress                      }
+     EALREADY = 37;       { operation already in progress                  }
+  { IPC network argument constants --------------  }
+     ENOTSOCK = 38;       { socket operation on non-socket                 }
+     EDESTADDRREQ = 39;   { destination address required                   }
+     EMSGSIZE = 40;       { message too long                               }
+     EPROTOTYPE = 41;     { protocol wrong type for socket                 }
+     ENOPROTOOPT = 42;    { protocol not available                         }
+     EPROTONOSUPPORT = 43;{ protocol not supported                         }
+     ESOCKTNOSUPPORT = 44;{ socket type not supported                      }
+     EOPNOTSUPP = 45;     { operation not supported on socket              }
+     EPFNOSUPPORT = 46;   { protocol family not supported                  }
+     EAFNOSUPPORT = 47;   { address family unsupported by protocol family  }
+     EADDRINUSE = 48;     { address already in use                         }
+     EADDRNOTAVAIL = 49;  { can't assign requested address                 }
+  { Operational constants -----------------------  }
+     ENETDOWN = 50;       { network is down                                }
+     ENETUNREACH = 51;    { network is unreachable                         }
+     ENETRESET = 52;      { network dropped connection on reset            }
+     ECONNABORTED = 53;   { software caused connection abort               }
+     ECONNRESET = 54;     { connection reset by peer                       }
+     ENOBUFS = 55;        { no buffer space available                      }
+     EISCONN = 56;        { socket is already connected                    }
+     ENOTCONN = 57;       { socket is not connected                        }
+     ESHUTDOWN = 58;      { can't send after socket shutdown               }
+     ETOOMANYREFS = 59;   { too many references: can't splice              }
+     ETIMEDOUT = 60;      { connection timed out                           }
+     ECONNREFUSED = 61;   { connection refused                             }
+  { -------------------------- Additional POSIX-mandated constants ----------  }
+     EBUSY = 62;          { resource busy                                  }
+     EINTR = 63;          { interrupted function call                      }
+     EISDIR = 64;         { is a directory                                 }
+     ENAMETOOLONG = 65;   { filename too long                              }
+     ENOSYS = 66;         { function not implemented                       }
+     ENOTDIR = 67;        { not a directory                                }
+     ENOTEMPTY = 68;      { directory not empty                            }
+     EPERM = 69;          { operation not permitted                        }
+     ECHILD = 70;         { no child process                               }
+     EFBIG = 71;          { file too large                                 }
+     EMLINK = 72;         { too many links                                 }
+     ENODEV = 73;         { no such device                                 }
+     ENOLCK = 74;         { no locks available                             }
+     ENOTTY = 75;         { inappropriate I/O control operation            }
+     EFTYPE = ENOTTY;     { inappropriate operation for file type       }
+     EROFS = 76;          { read-only file system                          }
+     ESRCH = 77;          { no such process                                }
+     ECANCELED = 78;      { operation was cancelled                        }
+     ENOTSUP = 79;        { this optional functionality not supported      }
+     ECANCELLED = ECANCELED;
+     EBADTYPE = 80;       { bad type for operation                         }
+     EOVERFLOW = 81;      { operation would overflow                       }
+     EHOSTDOWN = 82;      { host is down                                   }
+     EHOSTUNREACH = 83;   { no route to host                               }
+     EPROCLIM = 84;       { too many processes                             }
+  { -------------------------- Additional POSIX / traditional UNIX constants   }
+     ENOMSG = 90;         { message does not exist                         }
+  { -------------------------- LibC-implementation-specific constants -------  }
+     ENLMDATA = 100;      { anomaly in NLM data structure                  }
+     EILSEQ = 101;        { illegal character sequence in multibyte        }
+     EINCONSIS = 102;     { internal library inconsistency                 }
+     EDOSTEXTEOL = 103;   { DOS-text file inconsistency--no newline...     }
+                          { ...after carriage return                       }
+     ENONEXTANT = 104;    { object doesn't exist                           }
+     ENOCONTEXT = 105;    { no thread library context present              }
+     ENAMESPACE = 106;    { invalid namespace or operation                 }
+     EBADCONN = 107;      { invalid connection                             }
+     ENAMEINVAL = 108;    { invalid NDS name                               }
+     EPASSINVAL = 109;    { invalid password                               }
+     ENCPINVAL = 110;     { invalid or erroneous NCP                       }
+     EFILESYS = 111;      { generic file system error, see 'filesyserrno'  }
+     ESUFFICIENT = 112;   { insufficient space for any operation result    }
+     EPARTONLY = 113;     { partial result only  for lack of space         }
+     EBADIDENT = 114;     { invalid user or other identity                 }
+     ENDS = 115;          { generic eDirectory error, see 'h_errno'        }
+     ENCP = 116;          { generic NCP error, see 'h_errno'               }
+     ELOOKUP = 117;       { generic look-up error, see 'h_errno'           }
+     ELASTERR = ELOOKUP;
+
+
+function ___errno:Plongint;cdecl;external libc_nlm name '___errno';
+function __errno_location:Plongint;cdecl;external libc_nlm name '___errno';
+function ___lastClientErrno:Plongint;cdecl;external libc_nlm name '___lastClientErrno';
+function ___lastFileSysErrno:Plongint;cdecl;external libc_nlm name '___lastFileSysErrno';
+
+
+// esm.h
+
+  const
+     ERR_ESM_AVAL = 1;
+     ERR_SIZE_ZERO = 2;           { ESMAlloc size requested is zero          }
+     ERR_TABLE_FULL = 3;          { allocation table is full                 }
+     ERR_NOT_CONTIGUOUS = 4;      { ESMAlloc request cannot be continguous   }
+     ERR_INVAL_ADDRESS = 5;       { already free or out of range             }
+     ERR_INVAL_SRC_ADDR = 6;      { bad source address (ESMCopy)             }
+     ERR_INVAL_DEST_ADDR = 7;     { bad destination address(ESMCopy/ESMFill) }
+     ERR_SRC_DEST_OVERLAP = 8;    { buffer overlap (ESMCopy)                 }
+  { (will be obsolete when the overlapping buffer copy implemented...)         }
+     ERR_MAP_4M_PAGE = 9;         { mapping particular 4M page failed        }
+     ERR_BUFFER_SIZE = 10;        { buffer passed too small (ESMQuery)       }
+     ERR_LOGICAL_SPACE = 11;      { adequate logical/window not available    }
+     ERR_ACQUIRING_LOCK = 12;     { failed to acquire lock (please retry)    }
+
+type
+   Paddr64_t = ^addr64_t;
+   addr64_t = uint64_t;
+
+   PESMQueryInfo_t = ^ESMQueryInfo_t;
+   ESMQueryInfo_t = record
+        TotalExtendedMemory : size64_t;
+        RemainingExtendedMemory : size64_t;
+        TotalMemoryBelow4G : size_t;
+     end;
+
+function ESMAlloc(size:size64_t; options:dword; esmAddress:Paddr64_t):longint;cdecl;external libc_nlm name 'ESMAlloc';
+function ESMAllocWindow(size:size_t; logicalAddress:Ppointer; callerID:pointer):longint;cdecl;external libc_nlm name 'ESMAllocWindow';
+function ESMCopy(source:addr64_t; destination:addr64_t; length:size64_t):longint;cdecl;external libc_nlm name 'ESMCopy';
+function ESMFill(pattern:dword; destination:addr64_t; length:size64_t):longint;cdecl;external libc_nlm name 'ESMFill';
+function ESMFree(esmAddress:addr64_t):longint;cdecl;external libc_nlm name 'ESMFree';
+function ESMFreeWindow(logicalAddress:pointer; callerID:pointer):longint;cdecl;external libc_nlm name 'ESMFreeWindow';
+function ESMMapMemory(windowAddress:pointer; memoryAddress:addr64_t; size:size_t):longint;cdecl;external libc_nlm name 'ESMMapMemory';
+function ESMQuery(bufferSize:size_t; buffer:PESMQueryInfo_t):longint;cdecl;external libc_nlm name 'ESMQuery';
+
+
+
+// float.h
+{ turn on 1-byte packing...  }
+
+{
+typedef union __fp_u
+
+   unsigned char __uc[16];
+   float         __f;
+   double        __d;
+   long double   __ld;
+ __fp_u;
+ }
+{
+typedef struct __fp_s
+
+   int    __MANT_DIG;
+   int    __DIG;
+   int    __MIN_EXP;
+   int    __MIN_10_EXP;
+   int    __MAX_EXP;
+   int    __MAX_10_EXP;
+   __fp_u __EPSILON[2];
+   __fp_u __MIN[2];
+   __fp_u __MAX[2];
+ __fp_s;
+ }
+
+(** unsupported pragma#pragma pack()*)
+{ extern const __fp_s __fp_characteristics[3]; }
+
+
+// fenv.h
+
+{ these interfaces not presently supported!  }
+{ floating-point exception bits for 'excepts' argument  }
+
+{ turn on 1-byte packing...  }
+
+  { these interfaces not presently supported!  }
+
+ const
+   _MAX_FPFLAGS  = 8;
+  { floating-point exception bits for 'excepts' argument  }
+   FE_DIVBYZERO  = $00000001;
+   FE_INEXACT    = $00000002;
+   FE_INVALID    = $00000004;
+   FE_OVERFLOW   = $00000008;
+   FE_UNDERFLOW  = $00000010;
+   FE_ALL_EXCEPT = $00000020;
+   FE_DOWNWARD   = $00000040;
+   FE_TONEAREST  = $00000080;
+   FE_TOWARDZERO = $00000100;
+   FE_UPWARD     = $00000200;
+   FE_DFL_ENV    = $00000400;
+
+
+type
+   Pfexcept_t = ^fexcept_t;
+   fexcept_t = dword;
+
+   Pfenv_t = ^fenv_t;
+   fenv_t = record
+        excepts : longint;
+        flagp : fexcept_t;
+     end;
+
+
+(** unsupported pragma#pragma pack()*)
+{ not presently supported...  }
+
+procedure feclearexcept(excepts:longint);cdecl;external libc_nlm name 'feclearexcept';
+procedure fegetexceptflag(flagp:Pfexcept_t; excepts:longint);cdecl;external libc_nlm name 'fegetexceptflag';
+procedure feraiseexceptflag(flagp:Pfexcept_t; excepts:longint);cdecl;external libc_nlm name 'feraiseexceptflag';
+procedure fesetexceptflag(flagp:Pfexcept_t; excepts:longint);cdecl;external libc_nlm name 'fesetexceptflag';
+function fetestexcept(excepts:longint):longint;cdecl;external libc_nlm name 'fetestexcept';
+function fegetround(round:longint):longint;cdecl;external libc_nlm name 'fegetround';
+function fesetround:longint;cdecl;external libc_nlm name 'fesetround';
+function fegetenv(envp:Pfenv_t):longint;cdecl;external libc_nlm name 'fegetenv';
+function feholdexcept(envp:Pfenv_t):longint;cdecl;external libc_nlm name 'feholdexcept';
+procedure fesetenv(envp:Pfenv_t);cdecl;external libc_nlm name 'fesetenv';
+procedure feupdateenv(envp:Pfenv_t);cdecl;external libc_nlm name 'feupdateenv';
+
+
+
+// fnmatch.h
+
+  const
+     FNM_NOMATCH = -(1);     { string fails to match pattern  }
+  { values for field 'flags'...  }
+     FNM_NOSYS       = $01;  { reserved (unused)                              }
+     FNM_PATHNAME    = $02;  { slash in string must match in pattern          }
+     FNM_PERIOD      = $04;  { leading period in string must match in pattern }
+     FNM_NOESCAPE    = $08;  { disable backslash escaping                     }
+     FNM_CASEFOLD    = $10;  { ignore case                                    }
+     FNM_LEADING_DIR = $20;  { Ignore `/...' after a match                    }
+     FNM_FILE_NAME   = FNM_PATHNAME;
+
+
+
+function fnmatch(pattern, _string:Pchar; flags:longint):longint;cdecl;external libc_nlm name 'fnmatch';
+
+
+
+// fshooks.h
+
+  const
+     FSHOOK_MAY_NOT_SLEEP_BIT    = $00000001;
+     FSHOOK_SORT_LOW_TO_HIGH_BIT = $00000002;
+     FSHOOK_CONSUMABLE_BIT       = $00000004;
+     FSHOOK_NO_SA_BIT            = $00000008;
+     FSHOOK_NO_AUDITOR_BIT       = $00000010;
+     FSHOOK_NO_CHECK_BIT         = $00000020;
+     FSHOOK_NESL_DATA_BIT        = $00000040;
+     FSHOOK_NESL_SHIM_BIT        = $00000080;
+     FSHOOK_DATA_FILTERED_BIT    = $80000000;
+
+
+{==========================================================
+  NSS file system hooks
+  These are based on the Novell Event Bus, supported by NSS
+==========================================================}
+type
+   Pfse_info = ^fse_info;
+   fse_info = record
+        version   : longint;
+        reserved1 : longint;
+        reserved2 : pointer;
+        rtag      : rtag_t;
+        link      : Pfse_info;
+        regID     : pointer;
+        regSpace  : pointer;
+        consID    : pointer;
+        length    : size_t;
+        data      : pointer;
+        reserved3 : array[0..3] of pointer;
+        _type     : longint;
+        userParm  : pointer;
+        parm0     : pointer;
+        parm1     : pointer;
+        flags     : dword;
+     end;
+   fsevent_info_t = fse_info;
+   Pfsevent_info_t = ^fsevent_info_t;
+
+   Pzkey_t = ^zkey_t;
+   zkey_t = uint64_t;
+
+   Pzid_t = ^zid_t;
+   zid_t = uint64_t;
+
+   Pvolid_t = ^volid_t;
+   volid_t = record
+        timeLow : dword;
+        timeMid : word;
+        timeHighAndVersion : word;
+        clockSeqHighAndReserved : byte;
+        clockSeqLow : byte;
+        node : array[0..5] of byte;
+     end;
+   userid_t = volid_t;
+   Puserid_t = ^userid_t;
+{ last time file was accessed           }
+{ time file was created                 }
+{ last time data was changed            }
+{ last time metadata was changed        }
+
+   Ptimeinfo_t = ^timeinfo_t;
+   timeinfo_t = record
+        accessedTime : time_t;
+        createdTime : time_t;
+        modifiedTime : time_t;
+        metaDataModifiedTime : time_t;
+     end;
+{ commonlity in call-back structures...  }
+{ NSS (NetWare 6) filesystem hooks events and call-back data structures...  }
+
+   Pdel_warn_t = ^del_warn_t;
+   del_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+     end;
+
+   Pdel_report_t = ^del_report_t;
+   del_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+     end;
+
+   Pcreate_warn_t = ^create_warn_t;
+   create_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        name : Punicode_t;
+        fileType : dword;
+        fileAttributes : dword;
+        createFlags : dword;
+        createParms : pointer;
+        requestedRights : dword;
+        createAndOpen : dword;
+     end;
+
+   Pcreate_report_t = ^create_report_t;
+   create_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+        retOpenCreateAction : dword;
+        retKey : zkey_t;
+        retZid : zid_t;
+        retVolID : volid_t;
+        times : timeinfo_t;
+     end;
+
+   Popen_warn_t = ^open_warn_t;
+   open_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        requestedRights : dword;
+        openParms : pointer;
+     end;
+
+   Popen_report_t = ^open_report_t;
+   open_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+        retKey : zkey_t;
+        retZid : zid_t;
+        retVolID : volid_t;
+        times : timeinfo_t;
+     end;
+
+   Pclose_warn_t = ^close_warn_t;
+   close_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        key : zkey_t;
+        fhState : dword;
+        times : timeinfo_t;
+     end;
+
+   Pclose_report_t = ^close_report_t;
+   close_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+        fileDeleted : dword;
+     end;
+
+   Pren_warn_t = ^ren_warn_t;
+   ren_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        destZid : zid_t;
+        destName : Punicode_t;
+        renameFlags : dword;
+     end;
+
+   Pren_report_t = ^ren_report_t;
+   ren_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+     end;
+{ the simple way   }
+{ --on the Mac...  }
+{ OSType           }
+{ OSType           }
+{ Integer          }
+{ Point            }
+{ Integer          }
+{ Integer          }
+{ (6 bytes)        }
+{ SignedByte       }
+{ SignedByte       }
+{ Integer          }
+{ LongInt          }
+{ Point            }
+{ LongInt          }
+{ SignedByte       }
+{ SignedByte       }
+{ Integer          }
+{ LongInt          }
+
+   Pzinfo_t = ^zinfo_t;
+   zinfo_t = record
+        version : dword;
+        totalBytes : size_t;
+        nextByte : size_t;
+        padding : dword;
+        retMask : uint64_t;
+        std : record
+             zid : zid_t;
+             dataStreamZid : zid_t;
+             parentZid : zid_t;
+             logicalEOF : off64_t;
+             volumeID : volid_t;
+             fileType : dword;
+             fileAttributes : dword;
+             fileAttributesModMask : dword;
+             padding : dword;
+          end;
+        storageUsed : record
+             physicalEOF : size64_t;
+             dataBytes : size64_t;
+             metaDataBytes : size64_t;
+          end;
+        primaryNameSpaceID : longint;
+        nameStart : off_t;
+        names : record
+             numEntries : size_t;
+             fileNameArray : off_t;
+          end;
+        time : record
+             created : uint64_t;
+             archived : uint64_t;
+             modified : uint64_t;
+             accessed : uint64_t;
+             metaDataModified : uint64_t;
+          end;
+        id : record
+             owner : userid_t;
+             archiver : userid_t;
+             modifier : userid_t;
+             metaDataModifier : userid_t;
+          end;
+        blockSize : record
+             size : size_t;
+             sizeShift : off_t;
+          end;
+        count : record
+             open : longint;
+             hardLink : longint;
+          end;
+        dataStream : record
+             count : longint;
+             totalNameSize : size_t;
+             totalDataSize : size64_t;
+          end;
+        extAttr : record
+             count : size_t;
+             totalNameSize : size_t;
+             totalDataSize : size64_t;
+          end;
+        deleted : record
+             time : uint64_t;
+             id : userid_t;
+          end;
+        macNS : record
+             finderInfo : record
+                 case longint of
+                    0 : ( generic : array[0..31] of byte );
+                    1 : ( macintosh : record
+                         FInfo : record
+                              fdType : longint;
+                              fdCreator : longint;
+                              fdFlags : int16_t;
+                              fdLocation : record
+                                   v : int16_t;
+                                   h : int16_t;
+                                end;
+                              fdFldr : int16_t;
+                           end;
+                         extended : record
+                             case longint of
+                                0 : ( FXInfo : record
+                                     fdIconID : int16_t;
+                                     fdUnused : int16_t;
+                                     fdScript : int8_t;
+                                     fdFlags : int8_t;
+                                     fdComment : int16_t;
+                                     fdPutAway : longint;
+                                  end );
+                                1 : ( DXInfo : record
+                                     frScroll : record
+                                          v : int16_t;
+                                          h : int16_t;
+                                       end;
+                                     frOpenChain : longint;
+                                     fdScript : int8_t;
+                                     fdFlags : int8_t;
+                                     fdComment : int16_t;
+                                     fdPutAway : longint;
+                                  end );
+                             end;
+                      end );
+                 end;
+             proDOSInfo : array[0..5] of byte;
+             filler : array[0..1] of byte;
+             dirRightsMask : dword;
+          end;
+        unixNS : record
+             fMode : dword;
+             rDev : dword;
+             myFlags : dword;
+             nfsUID : dword;
+             nfsGID : dword;
+             nwUID : dword;
+             nwGID : dword;
+             nwEveryone : dword;
+             nwUIDRights : dword;
+             nwGIDRights : dword;
+             nwEveryoneRights : dword;
+             acsFlags : byte;
+             firstCreated : byte;
+             variableSize : size_t;
+             offsetToData : off_t;
+          end;
+        volumeID : volid_t;
+        ndsObjectID : userid_t;
+        volumeState : dword;
+        nameSpaceMask : dword;
+        features : record
+             enabled : uint64_t;
+             enableModMask : uint64_t;
+             supported : uint64_t;
+          end;
+        maximumFileSize : size64_t;
+        totalSpaceQuota : size64_t;
+        numUsedBytes : size64_t;
+        numObjects : size64_t;
+        numFiles : size64_t;
+        authModelID : dword;
+        dataShreddingCount : size_t;
+        salvage : record
+             purgeableBytes : size64_t;
+             nonPurgeableBytes : size64_t;
+             numDeletedFiles : size64_t;
+             oldestDeletedTime : uint64_t;
+             minKeepSeconds : size_t;
+             maxKeepSeconds : size_t;
+             lowWaterMark : size_t;
+             highWaterMark : size_t;
+          end;
+        comp : record
+             numCompressedFiles : size64_t;
+             numCompDelFiles : size64_t;
+             numUncompressibleFiles : size64_t;
+             numPreCompressedBytes : size64_t;
+             numCompressedBytes : size64_t;
+          end;
+        pool : record
+             poolID : volid_t;
+             ndsObjectID : userid_t;
+             poolState : dword;
+             nameSpaceMask : dword;
+             features : record
+                  enabled : uint64_t;
+                  enableModMask : uint64_t;
+                  supported : uint64_t;
+               end;
+             totalSpace : size64_t;
+             numUsedBytes : size64_t;
+             purgeableBytes : size64_t;
+             nonPurgeableBytes : size64_t;
+          end;
+        extAttrUserFlags : dword;
+        variableData : array[0..0] of byte;
+     end;
+
+   Pmod_warn_t = ^mod_warn_t;
+   mod_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        modifyInfoMask : dword;
+        modifyTypeInfoMask : dword;
+        modifyInfo : Pzinfo_t;
+        modifyTypeInfo : pointer;
+     end;
+
+   Pmod_report_t = ^mod_report_t;
+   mod_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+     end;
+
+   Psetsize_warn_t = ^setsize_warn_t;
+   setsize_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        key : zkey_t;
+        curEOF : uint64_t;
+        newEOF : uint64_t;
+        setSizeFlags : dword;
+     end;
+
+   Psetsize_report_t = ^setsize_report_t;
+   setsize_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+        newEOF : uint64_t;
+     end;
+
+   Paddtrustee_warn_t = ^addtrustee_warn_t;
+   addtrustee_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        trusteeID : userid_t;
+        rights : dword;
+        attributes : dword;
+     end;
+
+   Paddtrustee_report_t = ^addtrustee_report_t;
+   addtrustee_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+     end;
+
+   Premtrustee_warn_t = ^remtrustee_warn_t;
+   remtrustee_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        trusteeID : userid_t;
+        purgedFileFlag : dword;
+     end;
+
+   Premtrustee_report_t = ^remtrustee_report_t;
+   remtrustee_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+     end;
+{ (Boolean)  }
+
+   Psetrights_warn_t = ^setrights_warn_t;
+   setrights_warn_t = record
+        enterExitID : dword;
+        slotID : dword;
+        taskID : dword;
+        zid : zid_t;
+        volID : volid_t;
+        inheritedRights : dword;
+        authorizeFlag : longint;
+     end;
+
+   Psetrights_report_t = ^setrights_report_t;
+   setrights_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+     end;
+
+   Pxvolstate_warn_t = ^xvolstate_warn_t;
+   xvolstate_warn_t = record
+        enterExitID : dword;
+        oldState : word;
+        newState : word;
+        mode : dword;
+        volID : volid_t;
+        poolID : volid_t;
+     end;
+
+   Pxvolstate_report_t = ^xvolstate_report_t;
+   xvolstate_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+        oldState : word;
+        newState : word;
+        mode : dword;
+        volID : volid_t;
+        poolID : volid_t;
+     end;
+
+   Pxpoolstate_warn_t = ^xpoolstate_warn_t;
+   xpoolstate_warn_t = record
+        enterExitID : dword;
+        oldState : word;
+        newState : word;
+        mode : dword;
+        poolID : volid_t;
+     end;
+
+   Pxpoolstate_report_t = ^xpoolstate_report_t;
+   xpoolstate_report_t = record
+        enterExitID : dword;
+        enterRetStatus : longint;
+        opRetCode : longint;
+        oldState : word;
+        newState : word;
+        mode : dword;
+        poolID : volid_t;
+     end;
+{============================================================
+ Traditional file system hooks
+ These were interfaced by CLib in its NDK header, nwfshook.h.
+============================================================}
+{ values for 'requestedAccessRights'...  }
+{ values for 'dataStreamNumber'...  }
+{ values for 'flags' in fst_info_t...  }
+
+   PEraseFileCallBackStruct = ^EraseFileCallBackStruct;
+   EraseFileCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        attributeMatchBits : dword;
+     end;
+{ (see fsio.h)  }
+
+   POpenFileCallBackStruct = ^OpenFileCallBackStruct;
+   OpenFileCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        attributeMatchBits : dword;
+        requestedAccessRights : dword;
+        dataStreamNumber : longint;
+        fileHandle : Plongint;
+     end;
+
+   PCreateFileCallBackStruct = ^CreateFileCallBackStruct;
+   CreateFileCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        createAttributeBits : dword;
+        createFlagBits : dword;
+        dataStreamNumber : longint;
+        fileHandle : Plongint;
+     end;
+
+   PCreateAndOpenCallBackStruct = ^CreateAndOpenCallBackStruct;
+   CreateAndOpenCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        createAttributeBits : dword;
+        requestedAccessRights : dword;
+        createFlagBits : dword;
+        dataStreamNumber : longint;
+        fileHandle : Plongint;
+     end;
+
+   PRenameMoveEntryCallBackStruct = ^RenameMoveEntryCallBackStruct;
+   RenameMoveEntryCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        attributeMatchBits : dword;
+        subDirsOnlyFlag : longint;
+        newDirBase : longint;
+        newPathString : Pchar;
+        originalNewCount : longint;
+        compatibilityFlag : dword;
+        allowRenamesToMyselfFlag : longint;
+     end;
+
+   PCloseFileCallBackStruct = ^CloseFileCallBackStruct;
+   CloseFileCallBackStruct = record
+        slot : longint;
+        task : longint;
+        fileHandle : longint;
+     end;
+
+   PCreateDirCallBackStruct = ^CreateDirCallBackStruct;
+   CreateDirCallBackStruct = record
+        slot : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        directoryAccessMask : dword;
+     end;
+
+   PDeleteDirCallBackStruct = ^DeleteDirCallBackStruct;
+   DeleteDirCallBackStruct = record
+        slot : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+     end;
+
+   Tmodifyvector = record
+             MModifyName : Pchar;
+             MFileAttributes : dword;
+             MFileAttributesMask : dword;
+             MCreateDate : word;
+             MCreateTime : word;
+             MOwnerID : dword;
+             MLastArchivedDate : word;
+             MLastArchivedTime : word;
+             MLastArchivedID : dword;
+             MLastUpdatedDate : word;
+             MLastUpdatedTime : word;
+             MLastUpdatedID : dword;
+             MLastAccessedDate : word;
+             MInheritanceGrantMask : word;
+             MInheritanceRevokeMask : word;
+             MMaximumSpace : size_t;
+             MLastUpdatedInSeconds : time_t;
+          end;
+   Pmodifyvector = ^Tmodifyvector;
+
+   PModifyDirEntryCallBackStruct = ^ModifyDirEntryCallBackStruct;
+   ModifyDirEntryCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        attributeMatchBits : dword;
+        targetNameSpace : longint;
+        modifyVector : Pmodifyvector;
+        modifyBits : dword;
+        allowWildCardsFlag : longint;
+     end;
+
+   PSalvageDeletedCallBackStruct = ^SalvageDeletedCallBackStruct;
+   SalvageDeletedCallBackStruct = record
+        slot : longint;
+        volume : longint;
+        dirBase : longint;
+        toBeSalvagedDirBase : longint;
+        nameSpace : longint;
+        newName : Pchar;
+     end;
+
+   PPurgeDeletedCallBackStruct = ^PurgeDeletedCallBackStruct;
+   PurgeDeletedCallBackStruct = record
+        slot : longint;
+        volume : longint;
+        dirBase : longint;
+        toBePurgedDirBase : longint;
+        nameSpace : longint;
+     end;
+
+   PRenameNSEntryCallBackStruct = ^RenameNSEntryCallBackStruct;
+   RenameNSEntryCallBackStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        pathComponentCount : longint;
+        nameSpace : longint;
+        matchBits : dword;
+        newName : Pchar;
+     end;
+
+   PGenericSalvageDeletedCBStruct = ^GenericSalvageDeletedCBStruct;
+   GenericSalvageDeletedCBStruct = record
+        slot : longint;
+        nameSpace : longint;
+        sequence : longint;
+        volume : longint;
+        dirBase : longint;
+        newName : Pchar;
+     end;
+
+   PGenericPurgeDeletedCBStruct = ^GenericPurgeDeletedCBStruct;
+   GenericPurgeDeletedCBStruct = record
+        slot : longint;
+        nameSpace : longint;
+        sequence : longint;
+        volume : longint;
+        dirBase : longint;
+     end;
+
+   PGenericOpenCreateCBStruct = ^GenericOpenCreateCBStruct;
+   GenericOpenCreateCBStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        pathComponentCount : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        nameSpace : longint;
+        dataStreamNumber : longint;
+        openCreateFlags : dword;
+        searchAttributes : dword;
+        createAttributes : dword;
+        requestedAccessRights : dword;
+        returnInfoMask : dword;
+        fileHandle : Plongint;
+        openCreateAction : Pchar;
+     end;
+
+   PGenericRenameCBStruct = ^GenericRenameCBStruct;
+   GenericRenameCBStruct = record
+        slot : longint;
+        task : longint;
+        nameSpace : longint;
+        renameFlag : longint;
+        searchAttributes : dword;
+        srcVolume : longint;
+        srcPathComponentCount : longint;
+        srcDirBase : longint;
+        srcPathString : Pchar;
+        dstVolume : longint;
+        dstPathComponentCount : longint;
+        dstDirBase : longint;
+        dstPathString : Pchar;
+     end;
+
+   PGenericEraseFileCBStruct = ^GenericEraseFileCBStruct;
+   GenericEraseFileCBStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        pathComponentCount : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        nameSpace : longint;
+        searchAttributes : dword;
+     end;
+
+   PGenericModifyDOSInfoCBStruct = ^GenericModifyDOSInfoCBStruct;
+   GenericModifyDOSInfoCBStruct = record
+        slot : longint;
+        task : longint;
+        volume : longint;
+        pathComponentCount : longint;
+        dirBase : longint;
+        pathString : Pchar;
+        nameSpace : longint;
+        searchAttributes : dword;
+        modifyMask : dword;
+        modifyInfo : pointer;
+     end;
+
+   PGenericModifyNSInfoCBStruct = ^GenericModifyNSInfoCBStruct;
+   GenericModifyNSInfoCBStruct = record
+        slot : longint;
+        task : longint;
+        dataLength : size_t;
+        srcNameSpace : longint;
+        dstNameSpace : longint;
+        volume : longint;
+        dirBase : longint;
+        modifyMask : dword;
+        modifyInfo : pointer;
+     end;
+{============================================================================
+** NSS file system hook prototypes...
+ }
+
+type TCdeclPfsEventFunc = function (info:Pfsevent_info_t):longint; cdecl;
+function fs_register(_type:longint; cbFunc:TCdeclPfsEventFunc; userParm:pointer):longint;cdecl;external libc_nlm name 'fs_register';
+function fs_unregister(_type:longint; cbFunc:TCdeclPfsEventFunc):longint;cdecl;external libc_nlm name 'fs_unregister';
+function fs_mapkeytopath(key:zkey_t; path:Punicode_t; maxpathlen:Psize_t; want_volume:longint):longint;cdecl;external libc_nlm name 'fs_mapkeytopath';
+function fs_mapzidtopath(zid:zid_t; volId:Pvolid_t; path:Punicode_t; maxpathlen:Psize_t; want_volume:longint):longint;cdecl;external libc_nlm name 'fs_mapzidtopath';
+function fs_read(key:zkey_t; buf:pointer; off:off64_t; len:size_t; bytes:Pssize_t):longint;cdecl;external libc_nlm name 'fs_read';
+function fs_write(key:zkey_t; buf:pointer; off:off64_t; len:size_t; bytes:Pssize_t):longint;cdecl;external libc_nlm name 'fs_write';
+
+
+{============================================================================
+ Generic information (NEB and traditional) based on connection slot. This
+ has little to do with file system hooks, but in LibC, there is no way to
+ get a hold of a connection slot except through file system hook interfaces.}
+function fs_getslotinfo(slot:longint; name:Pchar; objectType:Pword; objectId:Pdword; loginTime:Pchar):longint;cdecl;external libc_nlm name 'fs_getslotinfo';
+function fs_getslotinfo(slot:longint; name:Pchar; var objectType:word; var objectId:dword; loginTime:Pchar):longint;cdecl;external libc_nlm name 'fs_getslotinfo';
+
+
+{==========================================
+ Traditional file system hook prototypes... }
+
+type TCDeclFunc1PtrArgLongint = function (info:pointer):longint; cdecl;
+
+function fst_register(_type:longint; cbFunc:TCDeclFunc1PtrArgLongint):longint;cdecl;external libc_nlm name 'fst_register';
+function fst_unregister(_type:longint; cbFunc:TCDeclFunc1PtrArgLongint):longint;cdecl;external libc_nlm name 'fst_unregister';
+function fst_getvoldir(slot:longint; fileHandle:longint; namespace:longint; volNum:Plongint; dirBase:Plongint):longint;cdecl;external libc_nlm name 'fst_getvoldir';
+function fst_getorignamespace(volNum:longint; dirBase:longint; namespace:Plongint):longint;cdecl;external libc_nlm name 'fst_getorignamespace';
+function fst_mapvoldirtopath(volNum:longint; dirBase:longint; namespace:longint; path:Pchar; maxPathLen:size_t):longint;cdecl;external libc_nlm name 'fst_mapvoldirtopath';
+function fst_mapvoltoname(volNum:longint; name:Pchar):longint;cdecl;external libc_nlm name 'fst_mapvoltoname';
+function fst_read(slot:longint; fileHandle:longint; buffer:pointer; offset:off64_t; length:size_t;
+           bytes:Pssize_t):longint;cdecl;external libc_nlm name 'fst_read';
+function fst_write(slot:longint; fileHandle:longint; buffer:pointer; offset:off64_t; length:size_t;
+           bytes:Pssize_t):longint;cdecl;external libc_nlm name 'fst_write';
+function fst_size(slot:longint; fileHandle:longint; length:Poff64_t):longint;cdecl;external libc_nlm name 'fst_size';
+function fst_flush(slot:longint; fileHandle:longint):longint;cdecl;external libc_nlm name 'fst_flush';
+
+type
+   Pfst_info_t = ^fst_info_t;
+   fst_info_t = record
+        volNum : longint;
+        DosBase : longint;
+        dirBase : longint;
+        namespace : longint;
+        datastream : longint;
+        flags : dword;
+     end;
+
+function fst_getinfo(slot:longint; fileHandle:longint; info:Pfst_info_t):longint;cdecl;external libc_nlm name 'fst_getinfo';
+
+
+// getopt.h
+
+{ values for 'has_arg'...  }
+const
+  no_argument = 0;
+  required_argument = 1;
+  optional_argument = 2;
+
+{ definition for getopt_long() and getopt_long_only()...  }
+
+type
+   Poption = ^option;
+   option = record
+        name    : Pchar;
+        has_arg : longint;
+        flag    : Plongint;
+        val     : longint;
+     end;
+
+function getopt_long(argc:longint; argv:array of Pchar; optstring:Pchar; longopts:Poption; longindex:Plongint):longint;cdecl;external libc_nlm name 'getopt_long';
+function getopt_long_only(argc:longint; argv:array of Pchar; optstring:Pchar; longopts:Poption; longindex:Plongint):longint;cdecl;external libc_nlm name 'getopt_long_only';
+
+// err.h
+
+  const
+     GLOB_APPEND = $0001;
+     GLOB_DOOFFS = $0002;        { use gl_offs                                }
+     GLOB_ERR = $0004;           { return on error                            }
+     GLOB_MARK = $0008;          { append / to matching directories           }
+     GLOB_NOCHECK = $0010;       { return pattern itself if nothing matches   }
+     GLOB_NOSORT = $0020;        { don't sort                                 }
+     GLOB_ALTDIRFUNC = $0040;    { use alternately specified directory funcs  }
+     GLOB_BRACE = $0080;         { expand braces ala csh                      }
+     GLOB_MAGCHAR = $0100;       { pattern had globbing characters            }
+     GLOB_NOMAGIC = $0200;       { GLOB_NOCHECK without magic chars (csh)     }
+     GLOB_QUOTE = $0400;         { quote special chars with \                 }
+     GLOB_TILDE = $0800;         { expand tilde names from the passwd file    }
+     GLOB_NOESCAPE = $1000;      { disable backslash escaping                 }
+     GLOB_LIMIT = $2000;         { limit pattern match output to ARG_MAX      }
+  { error values returned by glob(3)  }
+     GLOB_NOSPACE = -(1);        { malloc call failed                         }
+     GLOB_ABORTED = -(2);        { unignored error                            }
+     GLOB_NOMATCH = -(3);        { no match and GLOB_NOCHECK not set          }
+  { function not supported }
+     GLOB_NOSYS = -(4);
+     GLOB_ABEND = GLOB_ABORTED;
+
+type
+   Pglob_t = ^glob_t;
+   glob_t = record
+        gl_pathc : longint;
+        gl_matchc : longint;
+        gl_offs : longint;
+        gl_flags : longint;
+        gl_pathv : ^Pchar;
+        gl_errfunc : function (_para1:Pchar; _para2:longint):longint;cdecl;
+        gl_closedir : procedure (_para1:pointer);
+        gl_readdir : function (_para1:pointer):Pdirent;
+        gl_opendir : function (_para1:Pchar):pointer;
+        gl_lstat : function (_para1:Pchar; _para2:Pstat):longint;
+        gl_stat : function (_para1:Pchar; _para2:Pstat):longint;
+     end;
+
+// grp.h
+
+type
+   Pgroup = ^group;
+   group = record
+        gr_name : Pchar;
+        gr_passwd : Pchar;
+        gr_gid : gid_t;
+        gr_spare : gid_t;
+        gr_mem : ^Pchar;
+     end;
+
+function getgrgid(gid:gid_t):Pgroup;cdecl;external libc_nlm name 'getgrgid';
+function getgrnam(name:Pchar):Pgroup;cdecl;external libc_nlm name 'getgrnam';
+
+// guid.h
+// iconv.h
+
+type
+   Piconv_t = ^iconv_t;
+   iconv_t = longint;
+
+function iconv_open(tocode:Pchar; fromcode:Pchar):iconv_t;cdecl;external libc_nlm name 'iconv_open';
+function iconv(cd:iconv_t; inbuf:PPchar; inbytesleft:Psize_t; outbuf:PPchar; outbytesleft:Psize_t):size_t;cdecl;external libc_nlm name 'iconv';
+function iconv_close(cd:iconv_t):longint;cdecl;external libc_nlm name 'iconv_close';
+
+
+// inttypes.h
+
+{ printf-style macros for signed and unsigned integers...  }
+{ scanf-style macros for signed and unsigned integers...  }
+
+
+// iso646.h
+
+// nl_types.h
+
+  const
+     NL_SETD = 1;
+  { 'oflag' value for catopen()...  }
+  { base on value of environment variable "LANG"  }
+     NL_CAT_DEFAULT = 0;
+  { base on LC_MESSAGES in effect  }
+     NL_CAT_LOCALE = 1;
+{$define _NL_ITEM}
+
+type
+   Pnl_item = ^nl_item;
+   nl_item = longint;
+   Pnl_catd = ^nl_catd;
+   nl_catd = longint;
+
+function catclose(catd:nl_catd):longint;cdecl;external libc_nlm name 'catclose';
+function catgets(catd:nl_catd; set_id:longint; msg_id:longint; _string:Pchar):Pchar;cdecl;external libc_nlm name 'catgets';
+function catopen(name:Pchar; oflag:longint):nl_catd;cdecl;external libc_nlm name 'catopen';
+
+// langinfo.h
+
+{ Sunday                                           }
+
+  const
+     DAY_1 = 1;
+  { Monday                                           }
+     DAY_2 = 2;
+  { Tuesday                                          }
+     DAY_3 = 3;
+  { Wednesday                                        }
+     DAY_4 = 4;
+  { Thursday                                         }
+     DAY_5 = 5;
+  { Friday                                           }
+     DAY_6 = 6;
+  { Saturday                                         }
+     DAY_7 = 7;
+  { Sun                                              }
+     ABDAY_1 = 8;
+  { Mon                                              }
+     ABDAY_2 = 9;
+  { Tue                                              }
+     ABDAY_3 = 10;
+  { Wed                                              }
+     ABDAY_4 = 11;
+  { Thu                                              }
+     ABDAY_5 = 12;
+  { Fri                                              }
+     ABDAY_6 = 13;
+  { Sat                                              }
+     ABDAY_7 = 14;
+  { January                                          }
+     MON_1 = 15;
+  { February                                         }
+     MON_2 = 16;
+  { March                                            }
+     MON_3 = 17;
+  { April                                            }
+     MON_4 = 18;
+  { May                                              }
+     MON_5 = 19;
+  { June                                             }
+     MON_6 = 20;
+  { July                                             }
+     MON_7 = 21;
+  { August                                           }
+     MON_8 = 22;
+  { September                                        }
+     MON_9 = 23;
+  { October                                          }
+     MON_10 = 24;
+  { November                                         }
+     MON_11 = 25;
+  { December                                         }
+     MON_12 = 26;
+     ABMON_1 = 27;
+     ABMON_2 = 28;
+     ABMON_3 = 29;
+     ABMON_4 = 30;            { Apr }
+     ABMON_5 = 31;            { May }
+     ABMON_6 = 32;            { Jun }
+     ABMON_7 = 33;            { Jul }
+     ABMON_8 = 34;            { Aug }
+     ABMON_9 = 35;            { Sep }
+     ABMON_10 = 36;           { Oct }
+     ABMON_11 = 37;           { Nov }
+     ABMON_12 = 38;           { Dec }
+     RADIXCHAR = 39;          { radix character                 (not supported)  }
+     THOUSEP = 40;            { separator for thousand                           }
+     CRNCYSTR = 43;           { currency symbol                                  }
+     D_T_FMT = 44;            { string for formatting date and time              }
+     D_FMT = 45;              { date format                                      }
+     T_FMT = 46;              { time format                                      }
+     AM_STR = 47;             { am string                                        }
+     PM_STR = 48;             { pm string                                        }
+     CODESET = 49;            { code set name                                    }
+     T_FMT_AMPM = 50;         { a.m. or p.m. time format string (not supported)  }
+     ERA = 51;                { era description segments        (not supported)  }
+     ERA_D_FMT = 52;          { era date format string          (not supported)  }
+     ERA_D_T_FMT = 53;        { era date and time format string (not supported)  }
+     ERA_T_FMT = 54;          { era time format string          (not supported)  }
+     ALT_DIGITS = 55;         { alternative symbols for digits  (not supported)  }
+     _MAXSTRMSG = 57;         { maximum number of strings in langinfo            }
+
+
+function nl_langinfo(item:nl_item):Pchar;cdecl;external libc_nlm name 'nl_langinfo';
+
+
+// libgen.h
+
+function basename(path:Pchar):Pchar;cdecl;external libc_nlm name 'basename';
+function dirname(path:Pchar):Pchar;cdecl;external libc_nlm name 'dirname';
+
+
+// library.h
+
+{ return flags for get_app_type()...  }
+  const
+     LIBRARY_UNKNOWN = $01;
+     LIBRARY_LIBC    = $02;  { thread has specific NKS/LibC context    }
+     LIBRARY_CLIB    = $04;  { thread has CLib context                 }
+     LIBRARY_JAVA    = $08;  { thread belongs to Java Virtual Machine  }
+
+type
+   Paddrsp_t = ^addrsp_t;
+   addrsp_t = void;
+{ O_RDONLY, etc. from fcntl.h...  }
+
+   Predirect_t = ^redirect_t;
+   redirect_t = record
+        pathname : Pchar;
+        oflag : longint;
+     end;
+{ traditional NetWare solution for libraries...  }
+
+function get_app_data(lib_id:longint):pointer;cdecl;external libc_nlm name 'get_app_data';
+function get_app_type:longint;cdecl;external libc_nlm name 'get_app_type';
+function register_library(cleanupFunc:TCDeclFunc1PtrArgLongint):longint;cdecl;external libc_nlm name 'register_library';
+function register_destructor(libid:longint; cleanupFunc:TCDeclFunc1PtrArgLongint):longint;cdecl;external libc_nlm name 'register_destructor';
+function set_app_data(lib_id:longint; data_area:pointer):longint;cdecl;external libc_nlm name 'set_app_data';
+function unregister_library(lib_id:longint):longint;cdecl;external libc_nlm name 'unregister_library';
+{ more prototypes for library creators, debugging and other uses...  }
+function cleardontunloadflag(handle:pointer):longint;cdecl;external libc_nlm name 'cleardontunloadflag';
+function findnlmhandle(name:Pchar; space:addrsp_t):pointer;cdecl;external libc_nlm name 'findnlmhandle';
+function getaddressspace:addrsp_t;cdecl;external libc_nlm name 'getaddressspace';
+function getaddressspacename(space:addrsp_t; name:Pchar):Pchar;cdecl;external libc_nlm name 'getaddressspacename';
+function getallocresourcetag:rtag_t;cdecl;external libc_nlm name 'getallocresourcetag';
+function getnativethread:pointer;cdecl;external libc_nlm name 'getnativethread';
+{ (current process)  }
+function getnlmhandle:pointer;cdecl;external libc_nlm name 'getnlmhandle';
+function getnlmhandlefromthread(thread:pointer):pointer;cdecl;external libc_nlm name 'getnlmhandlefromthread';
+function getnlmname(handle:pointer; name:Pchar):Pchar;cdecl;external libc_nlm name 'getnlmname';
+function getnlmloadpath(loadpath:Pchar):Pchar;cdecl;external libc_nlm name 'getnlmloadpath';
+function getthreadname(threadid:pointer; name:Pchar; maxlen:size_t):longint;cdecl;external libc_nlm name 'getthreadname';
+function getthreadid:pointer;cdecl;external libc_nlm name 'getthreadid';
+function library_calloc(handle:pointer; size:size_t; count:size_t):pointer;cdecl;external libc_nlm name 'library_calloc';
+procedure library_free(addr:pointer);cdecl;external libc_nlm name 'library_free';
+function library_malloc(handle:pointer; size:size_t):pointer;cdecl;external libc_nlm name 'library_malloc';
+function library_msize(addr:pointer):size_t;cdecl;external libc_nlm name 'library_msize';
+function library_realloc(handle:pointer; old:pointer; size:size_t):pointer;cdecl;external libc_nlm name 'library_realloc';
+function nlmisloadedprotected:longint;cdecl;external libc_nlm name 'nlmisloadedprotected';
+function setdontunloadflag(handle:pointer):longint;cdecl;external libc_nlm name 'setdontunloadflag';
+function setthreadname(threadid:pointer; name:Pchar):longint;cdecl;external libc_nlm name 'setthreadname';
+//!! function uname2(handle:pointer; info:Putsname; bits:dword):longint;cdecl;external libc_nlm name 'uname2';
+function validateaddressrange(addr:pointer; bytes:size_t):longint;cdecl;external libc_nlm name 'validateaddressrange';
+function verifynlmhandle(handle:pointer):pointer;cdecl;external libc_nlm name 'verifynlmhandle';
+function construct_argc_argv(command_line:Pchar; argv0:Pchar; argc:Plongint; argv:array of Pchar):longint;cdecl;external libc_nlm name 'construct_argc_argv';
+type TRedirectSpecs = array [0..2] of redirect_t;
+function detect_redirection(r:TRedirectSpecs; argc:Plongint; argv:array of Pchar):longint;cdecl;external libc_nlm name 'detect_redirection';
+{ name-logical additions to library_malloc...  }
+
+
+// locale.h
+
+{ locale categories...  }
+{ turn on 1-byte packing...  }
+
+  { for use with LC_ALL                          }
+
+const
+   MAX_LOCNAME_LEN = 31 + 1;
+  { locale categories...  }
+   LC_CTYPE    = 0;  { character classification (unsupported) }
+   LC_COLLATE  = 1;  { the locale's collation table (unsupported) }
+   LC_NUMERIC  = 2;  { the numeric part of struct lconv }
+   LC_MONETARY = 3;  { the monetary part of struct lconv }
+   LC_TIME     = 4;  { the time and date part of struct lconv }
+   LC_MESSAGES = 5;  { new starting in NetWare v4.11 (unsupported) }
+   LC_ALL      = 6;
+
+
+
+{ for the current locale...                    }
+{ internal representations...                  }
+{ ibid                                         }
+{ as returned from setlocale(LC_ALL, NULL)     }
+{ -------------------------- [Numeric Conventions] ---------------------  }
+{ decimal point                                }
+{ separator for digits left of decimal         }
+{ digit grouping size                          }
+{ -------------------------- [Monetary Conventions] --------------------  }
+{ currency symbol                              }
+{ decimal point                                }
+{ separator for digits left of decimal         }
+{ digit grouping sizes                         }
+{ string indicating positive quantities        }
+{ string indicating negative quantities        }
+{ count of digits right of decimal             }
+{ for positive monetary quantities:            }
+{   currency symbol precedes quantity          }
+{   currency symbol separated by blank         }
+{   position of positive symbol                }
+{ for negative monetary quantities:            }
+{   currency symbol precedes quantity          }
+{   currency symbol separated by blank         }
+{   position of negative symbol                }
+{ (reserved for future use)                    }
+{ -------------------------- [International Monetary Conventions] ------  }
+{ international currency symbol and separator  }
+{ (international) digits right of decimal      }
+{ -------------------------- [Time and Date Conventions] ---------------  }
+{ always enforce 24-hour display (Boolean)     }
+{ hour and seconds separator                   }
+{ hour separator when no seconds displayed     }
+{ month/day/year separator                     }
+{ hours:minutes:seconds format (hh:mm:ss)      }
+{ month/day/year format (mm/dd/yyyy)           }
+{ weekday, month, day and year format          }
+{ delimited string indicating am and pm        }
+{ delimited string indicating AM and PM        }
+{ delimited string of day names                }
+{ delimited string of abbreviated day names    }
+{ delimited string of month names              }
+{ delimited string of abbreviated month names  }
+type
+   Plconv = ^lconv;
+   lconv = record
+        country : longint;//cdecl;
+        language : longint;
+        name : array[0..7] of char;
+        decimal_point : array[0..3] of char;
+        thousands_sep : array[0..3] of char;
+        grouping : array[0..3] of char;
+        currency_symbol : array[0..3] of char;
+        mon_decimal_point : array[0..3] of char;
+        mon_thousands_sep : array[0..3] of char;
+        mon_grouping : array[0..7] of char;
+        positive_sign : array[0..3] of char;
+        negative_sign : array[0..3] of char;
+        frac_digits : char;
+        p_cs_precedes : char;
+        p_sep_by_space : char;
+        p_sign_posn : char;
+        n_cs_precedes : char;
+        n_sep_by_space : char;
+        n_sign_posn : char;
+        reserved : char;
+        int_curr_symbol : array[0..14] of char;
+        int_frac_digits : char;
+        always_24 : longint;
+        hour_sep : array[0..3] of char;
+        hour_sans_sec_sep : array[0..3] of char;
+        date_sep : array[0..3] of char;
+        time_fmt : array[0..15] of char;
+        date_fmt : array[0..15] of char;
+        full_date_fmt : array[0..31] of char;
+        ampm : array[0..31] of char;
+        _AMPM : array[0..31] of char;
+        days : array[0..159] of char;
+        day_abbrevs : array[0..159] of char;
+        months : array[0..159] of char;
+        month_abbrevs : array[0..159] of char;
+     end;
+
+{ sizeof(struct lconv) == 0x360 (864.)         }
+
+
+(** unsupported pragma#pragma pack()*)
+{ prototypes for functions standard and nonstandard...  }
+
+function localeconv:Plconv;cdecl;external libc_nlm name 'localeconv';
+function setlocale(_para1:longint; _para2:Pchar):Pchar;cdecl;external libc_nlm name 'setlocale';
+//!! function derivelocale(_para1:Pchar; _para2:Pchar; _para3:array[0..(31 + 1)-1] of char):Pchar;cdecl;external libc_nlm name 'derivelocale';
+function setlocale_r(_para1:longint; _para2:Pchar; _para3:Plconv; _para4:Pchar):Pchar;cdecl;external libc_nlm name 'setlocale_r';
+
+
+// malloc.h
+{
+** According to ISO/IEC (ANSI) 9899:1990 and 1999, memory allocation and
+** management functions are properly the domain of stdlib.h:
+** void   *calloc ( size_t, size_t );
+** void    free   ( void * );
+** void   *malloc ( size_t );
+** void   *realloc( void *, size_t );
+**
+** Non-standard functions from stdlib.h (don't define __STDC__ or these
+** disappear):
+** void   *alloca        ( size_t );
+** size_t  msize         ( void * );
+** int     mvalidate     ( void * );
+** size_t  stackavail    ( void );
+** void   *stackbase     ( void );
+** size_t  stackwatermark( void );
+ }
+
+
+// math.h
+
+{ constants for type exception using matherr()       }
+{ turn on 1-byte packing...  }
+
+  const
+     DOMAIN = 1;
+     SING = 2;      { argument singularity }
+     OVERFLOW = 3;  { overflow range error }
+     UNDERFLOW = 4; { underflow range error  }
+     TLOSS = 5;     { total loss of significance }
+     PLOSS = 6;     { partial loss of significance  }
+
+
+{ for C++, __fp_exception; for C, exception  }
+type
+   Pexception = ^Texception;
+   Texception = record
+        _type : longint;
+        name : Pchar;
+        arg1 : double;
+        arg2 : double;
+        retval : double;
+     end;
+
+{ for C++, __COMPLEX; for C, complex  }
+   Pcomplex = ^complex;
+   complex = record
+        real : double;
+        imag : double;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{const }  var
+     ___nan_float : double;cvar;external;
+{const }     ___huge_float : double;cvar;external;
+{const }     ___huge_double : double;cvar;external;
+{const }     ___huge_long_double : double;cvar;external;
+
+function acos(_para1:double):double;cdecl;external libc_nlm name 'acos';
+function asin(_para1:double):double;cdecl;external libc_nlm name 'asin';
+function atan(_para1:double):double;cdecl;external libc_nlm name 'atan';
+function atan2(_para1:double; _para2:double):double;cdecl;external libc_nlm name 'atan2';
+function cbrt(_para1:double):double;cdecl;external libc_nlm name 'cbrt';
+function ceil(_para1:double):double;cdecl;external libc_nlm name 'ceil';
+function cos(_para1:double):double;cdecl;external libc_nlm name 'cos';
+function cosh(_para1:double):double;cdecl;external libc_nlm name 'cosh';
+function exp(_para1:double):double;cdecl;external libc_nlm name 'exp';
+function fabs(_para1:double):double;cdecl;external libc_nlm name 'fabs';
+function floor(_para1:double):double;cdecl;external libc_nlm name 'floor';
+function fmod(_para1:double; _para2:double):double;cdecl;external libc_nlm name 'fmod';
+function frexp(_para1:double; _para2:Plongint):double;cdecl;external libc_nlm name 'frexp';
+function hypot(_para1:double; _para2:double):double;cdecl;external libc_nlm name 'hypot';
+function ldexp(_para1:double; _para2:longint):double;cdecl;external libc_nlm name 'ldexp';
+function log(_para1:double):double;cdecl;external libc_nlm name 'log';
+function log10(_para1:double):double;cdecl;external libc_nlm name 'log10';
+function modf(_para1:double; _para2:Pdouble):double;cdecl;external libc_nlm name 'modf';
+function pow(_para1:double; _para2:double):double;cdecl;external libc_nlm name 'pow';
+function remainder(_para1:double; _para2:double):double;cdecl;external libc_nlm name 'remainder';
+function rint(_para1:double):double;cdecl;external libc_nlm name 'rint';
+function sin(_para1:double):double;cdecl;external libc_nlm name 'sin';
+function sinh(_para1:double):double;cdecl;external libc_nlm name 'sinh';
+function sqrt(_para1:double):double;cdecl;external libc_nlm name 'sqrt';
+function tan(_para1:double):double;cdecl;external libc_nlm name 'tan';
+function tanh(_para1:double):double;cdecl;external libc_nlm name 'tanh';
+function cabs(_para1:complex):double;cdecl;external libc_nlm name 'cabs';
+function finite(_para1:double):longint;cdecl;external libc_nlm name 'finite';
+function j0(_para1:double):double;cdecl;external libc_nlm name 'j0';
+function j1(_para1:double):double;cdecl;external libc_nlm name 'j1';
+function jn(_para1:longint; _para2:double):double;cdecl;external libc_nlm name 'jn';
+function y0(_para1:double):double;cdecl;external libc_nlm name 'y0';
+function y1(_para1:double):double;cdecl;external libc_nlm name 'y1';
+function yn(_para1:longint; _para2:double):double;cdecl;external libc_nlm name 'yn';
+function matherr(_para1:Pexception):longint;cdecl;external libc_nlm name 'matherr';
+type TmathErrHandlerFunc = function (_para1:Pexception):longint; cdecl;
+function matherr_handler(_para1:TmathErrHandlerFunc):longint;cdecl;external libc_nlm name 'matherr_handler';
+function ___fpclassify_f(_para1:double):longint;cdecl;external libc_nlm name '___fpclassify_f';
+function ___fpclassify_d(_para1:double):longint;cdecl;external libc_nlm name '___fpclassify_d';
+function ___fpclassify_ld(double:longint):longint;cdecl;external libc_nlm name '___fpclassify_ld';
+function ___isfinite_f(_para1:double):longint;cdecl;external libc_nlm name '___isfinite_f';
+function ___isfinite_d(_para1:double):longint;cdecl;external libc_nlm name '___isfinite_d';
+function ___isfinite_ld(double:longint):longint;cdecl;external libc_nlm name '___isfinite_ld';
+function ___signbit_f(_para1:double):longint;cdecl;external libc_nlm name '___signbit_f';
+function ___signbit_d(_para1:double):longint;cdecl;external libc_nlm name '___signbit_d';
+function ___signbit_ld(double:longint):longint;cdecl;external libc_nlm name '___signbit_ld';
+
+
+// monitor.h
+{ turn on 1-byte packing...  }
+
+type
+   Pconn_info = ^Tconn_info;
+   Tconn_info = record
+        codepage : longint;
+        spares   : array[0..507] of byte;
+     end;
+
+{ additional processor information that may be available...  }
+{ (may not equal 'ThreadsOnProcessor' when totalled:)  }
+   Pcpu_info = ^Tcpu_info;
+   Tcpu_info = record
+        which : longint;
+        CurrentProcessor : longint;
+        ProcessorUtilization : dword;
+        ThreadsOnProcessor : dword;
+        reserved1 : dword;
+        Family : dword;
+        Model : dword;
+        Stepping : dword;
+        Revision : dword;
+        FeatureFlags : dword;
+        SerialNumber : uint64_t;
+        Speed : dword;
+        L1CacheSize : dword;
+        L2CacheSize : dword;
+        L3CacheSize : dword;
+        ReadyThreads : dword;
+        RunningThreads : dword;
+        SuspendedThreads : dword;
+        reserved2 : dword;
+        ThreadCPUTime : uint64_t;
+        reserved3 : uint64_t;
+        reserved4 : array[0..7] of dword;
+     end;
+
+   Pfilesystem_info = ^Tfilesystem_info;
+   Tfilesystem_info = record
+        OpenFileCount : longint;
+        CurrentDiskRequests : longint;
+        reserved : array[0..61] of dword;
+     end;
+
+   Prestag_info = ^Trestag_info;
+   Trestag_info = record                      { per-NLM resource-allocation information  }
+        tag_count : longint;                  { count of discrete resource tags  }
+        res_count : size_t;                   { total number of resources across tags  }
+        reserved1 : longint;                  { used only by 'ALRT' tags  }
+        signature : dword;                    { type of resource (see netware.h)  }
+        description : array[0..79] of char;   { resource tag description string  }
+     end;
+
+   Pmem_restag_info = ^Tmem_restag_info;
+   Tmem_restag_info = record                  { per-NLM memory information  }
+        tag_count   : longint;                { discrete memory allocation resource tags  }
+        total_bytes : size_t;                 { total number of bytes allocated across tags  }
+        allocations : longint;                { total actual calls to allocator  }
+        reserved2   : dword;                  { always signature ('ALRT')  }
+        description : array[0..79] of char;   { resource tag description string  }
+     end;
+
+   Pmemory_info = ^Tmemory_info;
+   Tmemory_info = record
+        AllocatedMemoryPool    : size64_t;
+        CacheBufferSize        : size64_t;
+        CacheBufferMemory      : size64_t;
+        CacheMoveableMemory    : size64_t;
+        CacheNonmoveableMemory : size64_t;
+        CodeMemory             : size64_t;
+        DataMemory             : size64_t;
+        TotalWorkMemory        : size64_t;
+        OtherCachePagesMemory  : size64_t;
+        reserved1              : size64_t;
+        TotalKnownSystemMemoryUnder4Gb : size64_t;
+        TotalKnownSystemMemory : size64_t;
+        reserved               : array[0..11] of dword;
+     end;
+
+   Pvmemory_info = ^Tvmemory_info;
+   Tvmemory_info = record
+        PageInCount : uint64_t;
+        PageOutCount : uint64_t;
+        SwapResvCount : uint64_t;
+        SwapPageCount : uint64_t;
+        SwapFreeCount : uint64_t;
+        PageFaultCount : uint64_t;
+        freeCachePages : uint64_t;
+        freeCleanPages : uint64_t;
+        freeDirtyPages : uint64_t;
+        VMPhysicalPageCount : uint64_t;
+        reserved : array[0..19] of dword;
+     end;
+
+   Pnet_info = ^Tnet_info;
+   Tnet_info = record
+        MaximumConnections : longint;
+        spare0 : array[0..11] of dword;
+        IPXAddr : array[0..5] of byte;
+        spare1 : array[0..1] of byte;
+        MaximumBoards : dword;
+        spare3 : array[0..11] of dword;
+        IPAddrsBound : array[0..11] of dword;
+        spare4 : array[0..23] of dword;
+     end;
+
+   Pos_info = ^Tos_info;
+   Tos_info = record
+        AbendedProcessCount    : longint;
+        CurrentServerProcesses : longint;
+        reserved               : array[0..61] of dword;
+     end;
+
+{ includes namespace list  }
+   Pvolume_info = ^Tvolume_info;
+   Tvolume_info = record
+        which : longint;
+        flags : dword;
+        name : array[0..(31 + 1)-1] of char;
+        SectorSize : dword;
+        SectorsPerCluster : dword;
+        VolumeSizeInClusters : dword;
+        FreedClusters : dword;
+        SubAllocFreeableClusters : dword;
+        FreeableLimboSectors : dword;
+        NonFreeableLimboSectors : dword;
+        NonFreeableAvailableSubAllocSectors : dword;
+        NotUsableSubAllocSectors : dword;
+        SubAllocClusters : dword;
+        DataStreamsCount : dword;
+        LimboDataStreamsCount : dword;
+        OldestDeletedFileAgeInTicks : dword;
+        CompressedDataStreamsCount : dword;
+        CompressedLimboDataStreamsCount : dword;
+        UnCompressableDataStreamsCount : dword;
+        PreCompressedSectors : dword;
+        CompressedSectors : dword;
+        MigratedFiles : dword;
+        MigratedSectors : dword;
+        ClustersUsedByFAT : dword;
+        ClustersUsedByDirectories : dword;
+        ClustersUsedByExtendedDirectories : dword;
+        TotalDirectoryEntries : dword;
+        UnUsedDirectoryEntries : dword;
+        TotalExtendedDirectoryExtants : dword;
+        UnUsedExtendedDirectoryExtants : dword;
+        ExtendedAttributesDefined : dword;
+        ExtendedAttributeExtantsUsed : dword;
+        DirectoryServicesObjectID : dword;
+        VolumeLastModifiedDateAndTime : dword;
+        mounted : longint;
+        BlockCount : uint64_t;
+        BlocksFree : uint64_t;
+        BlockSize : dword;
+        reserved : array[0..57] of dword;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ prototypes...  }
+
+function netware_conn_info(info:Pconn_info; sequence:Plongint):longint;cdecl;external libc_nlm name 'netware_conn_info';
+function netware_conn_info_from_slot(info:Pconn_info; slot:longint):longint;cdecl;external libc_nlm name 'netware_conn_info_from_slot';
+function netware_cpu_info(info:Pcpu_info; sequence:Plongint):longint;cdecl;external libc_nlm name 'netware_cpu_info';
+function netware_fs_info(info:Pfilesystem_info):longint;cdecl;external libc_nlm name 'netware_fs_info';
+function netware_net_info(info:Pnet_info):longint;cdecl;external libc_nlm name 'netware_net_info';
+//!! function netware_net_macaddr(board:longint; macAddr:array[0..5] of byte):longint;cdecl;external libc_nlm name 'netware_net_macaddr';
+function netware_mem_info(info:Pmemory_info):longint;cdecl;external libc_nlm name 'netware_mem_info';
+function netware_mem_info_for_nlm(info:Pmem_restag_info; handle:pointer):longint;cdecl;external libc_nlm name 'netware_mem_info_for_nlm';
+function netware_os_info(info:Pos_info):longint;cdecl;external libc_nlm name 'netware_os_info';
+function netware_vmem_info(info:Pvmemory_info):longint;cdecl;external libc_nlm name 'netware_vmem_info';
+function netware_vol_info(info:Pvolume_info; sequence:Plongint):longint;cdecl;external libc_nlm name 'netware_vol_info';
+function netware_vol_info_from_number(info:Pvolume_info; volNum:longint):longint;cdecl;external libc_nlm name 'netware_vol_info_from_number';
+function netware_vol_info_from_name(info:Pvolume_info; name:Pchar):longint;cdecl;external libc_nlm name 'netware_vol_info_from_name';
+function netware_restag_info_for_nlm(info:Prestag_info; handle:pointer; signature:dword; which:longint):longint;cdecl;external libc_nlm name 'netware_restag_info_for_nlm';
+
+function netware_conn_info(var info:Tconn_info; var sequence:longint):longint;cdecl;external libc_nlm name 'netware_conn_info';
+function netware_conn_info_from_slot(var info:Tconn_info; slot:longint):longint;cdecl;external libc_nlm name 'netware_conn_info_from_slot';
+function netware_cpu_info(var info:Tcpu_info; var sequence:longint):longint;cdecl;external libc_nlm name 'netware_cpu_info';
+function netware_fs_info(var info:Tfilesystem_info):longint;cdecl;external libc_nlm name 'netware_fs_info';
+function netware_net_info(var info:Tnet_info):longint;cdecl;external libc_nlm name 'netware_net_info';
+//!! function netware_net_macaddr(board:longint; macAddr:array[0..5] of byte):longint;cdecl;external libc_nlm name 'netware_net_macaddr';
+function netware_mem_info(var info:Tmemory_info):longint;cdecl;external libc_nlm name 'netware_mem_info';
+function netware_mem_info_for_nlm(var info:Tmem_restag_info; handle:pointer):longint;cdecl;external libc_nlm name 'netware_mem_info_for_nlm';
+function netware_os_info(var info:Tos_info):longint;cdecl;external libc_nlm name 'netware_os_info';
+function netware_vmem_info(var info:Tvmemory_info):longint;cdecl;external libc_nlm name 'netware_vmem_info';
+function netware_vol_info(var info:Tvolume_info; var sequence:longint):longint;cdecl;external libc_nlm name 'netware_vol_info';
+function netware_vol_info_from_number(var info:Tvolume_info; volNum:longint):longint;cdecl;external libc_nlm name 'netware_vol_info_from_number';
+function netware_vol_info_from_name(var info:Tvolume_info; name:Pchar):longint;cdecl;external libc_nlm name 'netware_vol_info_from_name';
+function netware_restag_info_for_nlm(var info:Trestag_info; handle:pointer; signature:dword; which:longint):longint;cdecl;external libc_nlm name 'netware_restag_info_for_nlm';
+
+
+// ncpx.h
+
+const
+     MAX_NCPX_NAMELEN = 33;
+     NCPX_BEGIN_SCAN = $FFFFFFFF;
+     NCPX_REPLY_IS_FRAGGED = $FFFFFFFF;
+     NCPX_BEING_RESTARTED = $01101001;
+     NCPX_BEING_KILLED = $02202002;
+     NCPX_BEING_LOGGED_OUT = $03303003;
+     NCPX_BEING_FREED = $04404004;
+
+type
+
+   Pncpx_id_t = ^ncpx_id_t;
+   ncpx_id_t = dword;
+
+   Pncpx_client_t = ^ncpx_client_t;
+   ncpx_client_t = uint64_t;
+
+   Pncpx_frag_element_t = ^ncpx_frag_element_t;
+   ncpx_frag_element_t = record
+        addr : pointer;
+        size : size_t;
+     end;
+
+   Pncpx_msgfrag_t = ^ncpx_msgfrag_t;
+   ncpx_msgfrag_t = record
+        totalMessageSize : size_t;
+        fragCount : longint;
+        fragList : array[0..3] of ncpx_frag_element_t;
+     end;
+
+   Pncpx_vers_t = ^ncpx_vers_t;
+   ncpx_vers_t = record
+        major : longint;
+        minor : longint;
+        revision : longint;
+     end;
+{ the handler that implements the extended NCP service... }
+
+   ncpx_handler_t = function (client:Pncpx_client_t; request:pointer; requestLen:size_t; reply:pointer; replyLen:Psize_t):longint;cdecl;
+{ the call-back made when the session goes away for whatever reason... }
+
+   sess_handler_t = procedure (session:longint; _type:longint);cdecl;
+{ the handler that replies to extended NCP requests (if any)... }
+
+   reply_mgr_t = procedure (client:Pncpx_client_t; repBuffer:pointer);cdecl;
+{ server registering an extended NCP service...  }
+function NcpxRegister(name:Pchar; ncpHandler:ncpx_handler_t; sessionHandler:sess_handler_t; replyManager:reply_mgr_t; version:ncpx_vers_t;
+           queryData:Ppointer):longint;cdecl;external libc_nlm name 'NcpxRegister';
+function NcpxRegisterWithId(id:ncpx_id_t; name:Pchar; ncpHandler:ncpx_handler_t; sessionHandler:sess_handler_t; replyManager:reply_mgr_t;
+           version:ncpx_vers_t; queryData:Ppointer):longint;cdecl;external libc_nlm name 'NcpxRegisterWithId';
+function NcpxDeregister(queryData:pointer):longint;cdecl;external libc_nlm name 'NcpxDeregister';
+{ client getting information about extended NCP services...  }
+function NcpxGetInfoByName(name:Pchar; id:Pncpx_id_t; version:ncpx_vers_t; queryData:pointer):longint;cdecl;external libc_nlm name 'NcpxGetInfoByName';
+function NcpxGetInfoById(id:ncpx_id_t; name:Pchar; version:ncpx_vers_t; queryData:pointer):longint;cdecl;external libc_nlm name 'NcpxGetInfoById';
+function NcpxScan(id:Pncpx_id_t; name:Pchar; version:ncpx_vers_t; queryData:pointer):longint;cdecl;external libc_nlm name 'NcpxScan';
+{ for the client sending extended NCP packets to a service...  }
+
+function NcpxSend(id:ncpx_id_t; request:pointer; requestLen:size_t; reply:pointer; replyLen:Psize_t):longint;cdecl;external libc_nlm name 'NcpxSend';
+function NcpxSendFragged(id:ncpx_id_t; reqFrag:Pncpx_msgfrag_t; repFrag:Pncpx_msgfrag_t):longint;cdecl;external libc_nlm name 'NcpxSendFragged';
+
+// ndkvers.h
+{==============================================================================
+=  This is a timestamp offered by the NDK. Calling libcthreshold() with the
+=  defined value as first argument (the second argument returns that of the
+=  currently loaded libc.nlm), will ensure at least the functionality and
+=  semantics offered by the NDK this file accompanied or this function returns
+=  an error (ENOTSUP). Whether or not this function fails, it always returns
+=  the loaded library's threshold.
+==============================================================================}
+
+  const
+     CURRENT_NDK_THRESHOLD = 406230000;
+  { timestamps for known releases of LibC on NetWare...  }
+     NETWARE_65_FCS = 306250000;        { 25 June 2003  }
+     NETWARE_65_SP1 = 310090000;        { 9 October 2003  }
+     NETWARE_CSP10  = 310070000;        { 7 October 2003  }
+     NETWARE_51_SP7 = NETWARE_CSP10;
+     NETWARE_60_SP4 = NETWARE_CSP10;
+     NETWARE_CSP11  = 405260000;        { 26 May 2004  }
+     NETWARE_60_SP5 = NETWARE_CSP11;
+     NETWARE_65_SP2 = NETWARE_CSP11;
+     NETWARE_CSP12  = 410310000;       { 31 October 2004 (just a guess)  }
+     NETWARE_51_SP8 = NETWARE_CSP12;
+     NETWARE_65_SP3 = NETWARE_CSP12;
+
+
+function libcthreshold(desiredthreshold:longint; libthreshold:Plongint):longint;cdecl;external libc_nlm name 'libcthreshold';
+function libcthreshold(desiredthreshold:longint; var libthreshold:longint):longint;cdecl;external libc_nlm name 'libcthreshold';
+
+// netdb.h
+
+  const
+     NETDB_INTERNAL = -(1);
+     NETDB_SUCCESS = 0;      { no problem  }
+     HOST_NOT_FOUND = 1;     { authoritative answer host not found  }
+     TRY_AGAIN = 2;          { non authoritative host not found or SERVERFAIL  }
+     NO_RECOVERY = 3;        { non recoverable: FORMERR, REFUSED, NOTIMP  }
+     NO_DATA = 4;            { valid name, no data record of requested type  }
+     NO_ADDRESS = NO_DATA;   { no address, look for MX record  }
+
+
+{ Addresses are supplied in host order and returned in network order. }
+type
+   Phostent = ^hostent;
+   hostent = record
+        h_name      : Pchar;     { official name of host }
+        h_aliases   : PPchar;    { alias list }
+        h_addrtype  : smallint;  { host address type }
+        h_length    : smallint;  { length of address }
+        h_addr_list : PPchar;    { list of addresses }
+     end;
+
+{ It is assumed here that a network number fits in 32 bits. }
+   Pnetent = ^netent;
+   netent = record
+        n_name     : Pchar;      { official name of net }
+        n_aliases  : PPchar;     { alias list }
+        n_addrtype : smallint;   { net address type }
+        n_net      : u_long;     { network number }
+     end;
+
+   Pservent = ^servent;
+   servent = record
+        s_name    : Pchar;       { official service name }
+        s_aliases : PPchar;      { alias list }
+        s_port    : smallint;    { port number }
+        s_proto   : Pchar;       { protocol to use }
+     end;
+
+   Pprotoent = ^protoent;
+   protoent = record
+        p_name    : Pchar;       { official protocol name }
+        p_aliases : PPchar;      { alias list }
+        p_proto   : smallint;    { protocol number }
+     end;
+
+
+function gethostbyaddr(_para1:Pchar; _para2:longint; _para3:longint):Phostent;cdecl;external libc_nlm name 'gethostbyaddr';
+function gethostbyname(_para1:Pchar):Phostent;cdecl;external libc_nlm name 'gethostbyname';
+function gethostname(_para1:Pchar; _para2:longint):longint;cdecl;external libc_nlm name 'gethostname';
+function getprotobyname(_para1:Pchar):Pprotoent;cdecl;external libc_nlm name 'getprotobyname';
+function getprotobynumber(_para1:longint):Pprotoent;cdecl;external libc_nlm name 'getprotobynumber';
+function getservbyname(_para1:Pchar; _para2:Pchar):Pservent;cdecl;external libc_nlm name 'getservbyname';
+function getservbyport(_para1:longint; _para2:Pchar):Pservent;cdecl;external libc_nlm name 'getservbyport';
+function ___h_errno:Plongint;cdecl;external libc_nlm name '___h_errno';
+
+
+// nks/nksapi.h
+// nlmformat.h
+
+{ 0x002E --------------------------- }
+{ 0x0032 --------------------------- }
+{ 0x0036 --------------------------- }
+{ 0x003A --------------------------- }
+{ 0x003E --------------------------- }
+{ 0x0042 --------------------------- }
+{ 0x0046 --------------------------- }
+{ 0x004A --------------------------- }
+{ 0x004E --------------------------- }
+{ 0x0052 --------------------------- }
+{ 0x0056 --------------------------- }
+{ 0x005A --------------------------- }
+{ 0x005E --------------------------- }
+{ 0x0062 --------------------------- }
+{ 0x0066 --------------------------- }
+{ 0x006A --------------------------- }
+{ 0x006E --------------------------- }
+{ 0x0072 --------------------------- }
+{ 0x0076 --------------------------- }
+{ 0x007A --------------------------- }
+{ 0x007E --------------------------- }
+{ 0x0082 --------------------------- }
+{ -------------------------------------------------------------------------
+   ** NB: Here begins the variable part of this structure's format; what is
+   ** shown here are the maximums. Consequently, sizeof(NLM_HEADER) is almost
+   ** always meaningless--the 400 bytes of 'otherData' actually referring to
+   ** the original size of the scratch buffer in NLMLINK set up to hold the
+   ** data before writing it to the binary file.
+   ** -------------------------------------------------------------------------
+    }
+
+const
+ MAX_DESCRIPTION_LENGTH   = 127;
+ OLD_THREAD_NAME_LENGTH   = 5;    // (exactly " LONG")
+ MAX_SCREEN_NAME_LENGTH   = 71;
+ MAX_THREAD_NAME_LENGTH   = 71;
+
+
+{ 0x0083 --------------------------- }
+{ 0x0103 --------------------------- }
+{ 0x0107 --------------------------- }
+{ 0x010B --------------------------- }
+{ 0x0110 --------------------------- }
+{ 0x0111 --------------------------- }
+{ 0x0158 --------------------------- }
+{ 0x015C --------------------------- }
+{ 0x01A3 --------------------------- }
+type
+
+   PNLM_HEADER = ^NLM_HEADER;
+   NLM_HEADER = record                                       { offset in structure -------------- }
+        signature                  : array[0..23] of char;   { "NetWare Loadable Modulex\1A" }
+        version                    : dword;               { 0x0018 --------------------------- }
+        moduleName                 : array[0..13] of char;   { 0x001C --------------------------- }
+        codeImageOffset            : dword;               { 0x002A --------------------------- }
+        codeImageSize              : dword;
+        dataImageOffset            : dword;
+        dataImageSize              : dword;
+        uninitializedDataSize      : dword;
+        customDataOffset           : dword;
+        customDataSize             : dword;
+        moduleDependencyOffset     : dword;
+        numberOfModuleDependencies : dword;
+        relocationFixupOffset      : dword;
+        numberOfRelocationFixups   : dword;
+        externalReferencesOffset   : dword;
+        numberOfExternalReferences : dword;
+        publicsOffset              : dword;
+        numberOfPublics            : dword;
+        debugInfoOffset            : dword;
+        numberOfDebugRecords       : dword;
+        codeStartOffset            : dword;
+        exitProcedureOffset        : dword;
+        checkUnloadProcedureOffset : dword;
+        moduleType                 : dword;
+        flags                      : dword;
+        descriptionLength          : byte;
+        descriptionText            : array[0..126] of char;
+        stackSize                  : dword;
+        reserved                   : dword;
+        reserved2                  : array[0..4] of byte;
+        screenNameLength           : byte;
+        screenName                 : array[0..70] of char;
+        threadNameLength           : byte;
+        threadName                 : array[0..70] of char;
+        otherData                  : array[0..399] of byte;
+     end;
+{ (note: length not actually 0x0333) }
+{ starts 'otherData' of NLM_HEADER }
+{ offset in structure -------------- }
+{ 0x0000 (exactly "VeRsIoN#") }
+{ 0x0008 --------------------------- }
+{ 0x000C --------------------------- }
+{ 0x0010 --------------------------- }
+{ 0x0014 --------------------------- }
+{ 0x0018 --------------------------- }
+{ 0x001A --------------------------- }
+
+   PVERSION_MASK = ^VERSION_MASK;
+   VERSION_MASK = record
+        VeRsIoN : array[0..7] of char;
+        majorVersion : dword;
+        minorVersion : dword;
+        revision : dword;
+        year : dword;
+        month : dword;
+        day : dword;
+     end;                                           { 0x0020 (structure length) }
+
+
+   PCOPYRIGHT_MASK = ^COPYRIGHT_MASK;               { immediately follows VERSION_MASK }
+   COPYRIGHT_MASK = record                          { offset in structure -------------- }
+        _CoPyRiGhT      : array[0..9] of char;      { 0x0000 (exactly "CoPyRiGhT=") }
+        copyrightLength : byte;                  { 0x000A --------------------------- }
+        copyright       : array[0..251] of char;    { 0x000B --------------------------- }
+     end;
+{ 0x0107 (structure length) }
+{ immediately follows COPYRIGHT_MASK }
+{ offset in structure -------------- }
+{ 0x0000 (exactly "MeSsAgEs") }
+{ 0x0008 --------------------------- }
+{ 0x000C --------------------------- }
+{ 0x0010 --------------------------- }
+{ 0x0014 --------------------------- }
+{ 0x0018 --------------------------- }
+{ 0x001C --------------------------- }
+{ 0x0020 --------------------------- }
+{ 0x0024 --------------------------- }
+{ 0x0028 (ignore to end of structure }
+{ 0x0030     ...all these are either }
+{ 0x0034     no longer used or never }
+{ 0x0038     really have been) }
+{ 0x003C --------------------------- }
+{ 0x0040 --------------------------- }
+{ 0x0044 --------------------------- }
+{ 0x0048 --------------------------- }
+{ 0x004C --------------------------- }
+{ 0x0050 --------------------------- }
+{ 0x0054 --------------------------- }
+{ 0x0058 --------------------------- }
+{ 0x0064 --------------------------- }
+{ 0x0068 --------------------------- }
+{ 0x006C --------------------------- }
+{ 0x0070 --------------------------- }
+{ 0x0074 --------------------------- }
+{ 0x0078 --------------------------- }
+{ 0x007C (* see CODEWARRIOR_LASTMOD) }
+
+   PEXTENDED_HEADER = ^EXTENDED_HEADER;
+   EXTENDED_HEADER = record
+        MeSsAgEs : array[0..7] of char;
+        languageID : dword;
+        messageFileOffset : dword;
+        messageFileLength : dword;
+        messageCount : dword;
+        helpFileOffset : dword;
+        helpFileLength : dword;
+        RPCDataOffset : dword;
+        RPCDataLength : dword;
+        sharedCodeOffset : dword;
+        sharedCodeLength : dword;
+        sharedDataOffset : dword;
+        sharedDataLength : dword;
+        sharedRelocationFixupOffset : dword;
+        sharedRelocationFixupLength : dword;
+        sharedExternalReferenceOffset : dword;
+        sharedExternalReferenceCount : dword;
+        sharedPublicsOffset : dword;
+        sharedPublicsCount : dword;
+        sharedDebugRecordOffset : dword;
+        sharedDebugRecordCount : dword;
+        sharedInitializationOffset : function :dword;cdecl;
+        sharedExitProcedureOffset : procedure ;
+        productID : dword;
+        reserved0 : dword;
+        reserved1 : dword;
+        reserved2 : dword;
+        reserved3 : dword;
+        reserved4 : dword;
+        reserved5 : dword;
+     end;
+{ 0x0080 (structure length) }
+{
+** The following syntagm appears only in NLMs linked with Metrowerks
+** Code Warrior. In the hexadecimal dump, it appears starting at 'reserved5'
+** in EXTENDED_HEADER above and appears thus (purely for example):
+**
+** 1C0: 4C 61 53 74  4D 6F 44 69  20 54 68 75  20 4F 63 74   "LaStMoDi Thu Oct"
+** 1D0: 20 20 39 20  31 35 3A 30  33 3A 33 30  20 32 30 30   "  9 19:22:31 200"
+** 1E0: 33 0A 00                                             "3..             "
+**
+** The start point shown (1C0) is variable, but LASTMOD_MASK will appear at
+** very nearly this offset.
+ }
+{ at 'reserved5' in EXTENDED_HEADER }
+{ offset in structure }
+{ 0x0000 (exactly "LaStMoDi") }
+{ 0x0009 --------------------------- }
+{ 0x000A --------------------------- }
+{ 0x000D --------------------------- }
+{ 0x000E --------------------------- }
+{ 0x0011 --------------------------- }
+{ 0x0012 (blank-padded) ------------ }
+{ 0x0014 --------------------------- }
+{ 0x0015 --------------------------- }
+{ 0x0017 --------------------------- }
+{ 0x0018 --------------------------- }
+{ 0x001A --------------------------- }
+{ 0x001B --------------------------- }
+{ 0x001D --------------------------- }
+{ 0x001E --------------------------- }
+{ 0x0022 --------------------------- }
+{ 0x0023 --------------------------- }
+
+   PLASTMOD_MASK = ^LASTMOD_MASK;
+   LASTMOD_MASK = record
+        LaStMoDi : array[0..7] of char;
+        space : char;
+        weekday : array[0..2] of char;
+        space2 : char;
+        month : array[0..2] of char;
+        space3 : char;
+        day : array[0..1] of char;
+        space4 : char;
+        hours24 : array[0..1] of char;
+        colon1 : char;
+        minutes : array[0..1] of char;
+        colon2 : char;
+        seconds : array[0..1] of char;
+        space5 : char;
+        year : array[0..3] of char;
+        newline : char;
+        null : char;
+     end;
+
+
+   PCUSTOM_HEADER_MASK = ^CUSTOM_HEADER_MASK;    { 0x0024 (structure length) }
+   CUSTOM_HEADER_MASK = record                   { offset in structure -------------- }
+        CuStHeAd : array[0..7] of byte;          { 0x0000 "CuStHeAd" }
+     end;                                        { (note: length is custom) }
+
+// nwieeefp.h
+
+type fp_except = longint;
+const
+  FP_X_INV  = $01;  { invalid operation exception }
+  FP_X_DNML = $02;  { denormal operation exception }
+  FP_X_DZ   = $04;  { divide by zero exception }
+  FP_X_OFL  = $08;  { overflow exception }
+  FP_X_UFL  = $10;  { underflow exception }
+  FP_X_IMP  = $20;  { inexact (precision) exception  }
+
+type
+   Pfp_rnd = ^fp_rnd;
+   fp_rnd =  Longint;
+Const
+   FP_RN = 0;   { round to nearest representable number, tie -> even }
+   FP_RM = 1;   { round toward minus infinity }
+   FP_RP = 2;   { round toward plus infinity }
+   FP_RZ = 3;   { round toward zero (truncate) }
+
+(** unsupported pragma#pragma pack()*)
+
+function fpgetmask:longint;cdecl;external libc_nlm name 'fpgetmask';
+function fpgetround:fp_rnd;cdecl;external libc_nlm name 'fpgetround';
+function fpgetsticky:longint;cdecl;external libc_nlm name 'fpgetsticky';
+function fpsetmask(newmask:longint):longint;cdecl;external libc_nlm name 'fpsetmask';
+function fpsetround(newround:fp_rnd):fp_rnd;cdecl;external libc_nlm name 'fpsetround';
+function fpsetsticky(newsticky:longint):longint;cdecl;external libc_nlm name 'fpsetsticky';
+
+
+(** unsupported pragma#pragma pack()*)
+
+
+// paths.h
+
+const
+  _PATH_DEFPATH = '/system';
+  _PATH_STDPATH = '/system';
+  _PATH_DEVNULL = '/dev/null';
+  _PATH_MAILDIR = '/mail';
+  _PATH_DEV     = '/system/';
+  _PATH_TMP     = '/tmp/';
+
+
+// proc.h
+
+const
+  PROC_DETACHED = $00000001;
+  PROC_CURRENT_SPACE = $00000004;    { use current address space    }
+  PROC_MEMORY_DEBUG = $00000008;     { same as load -m              }
+  PROC_LOAD_SILENT = $00000010;      { no console messages          }
+  PROC_INHERIT_CWD = $00000020;      { child start in same CWD      }
+  PROC_INHERIT_ID = $00000040;       { child inherits identity      }
+  FD_UNUSED  = -1;                   { ignore: do not wire the console }
+
+type
+   Pwiring_t = ^wiring_t;    { standard console wiring for process()... }
+   wiring_t = record
+        infd  : longint;     { new process' standard input, etc. }
+        outfd : longint;
+        errfd : longint;
+     end;
+
+{$ifndef DisableArrayOfConst}
+function procle(path:Pchar; flags:dword; env:array of Pchar; wiring:Pwiring_t; fds:Pfd_set;
+           appdata:pointer; appdata_size:size_t; reserved:pointer; arg0:Pchar; args:array of const):pid_t;cdecl;external libc_nlm name 'procle';
+{$endif}
+function procle(path:Pchar; flags:dword; env:array of Pchar; wiring:Pwiring_t; fds:Pfd_set;
+           appdata:pointer; appdata_size:size_t; reserved:pointer; arg0:Pchar):pid_t;cdecl;external libc_nlm name 'procle';
+function procve(path:Pchar; flags:dword; env:array of Pchar; wiring:Pwiring_t; fds:Pfd_set;
+           appdata:pointer; appdata_size:size_t; reserved:pointer; argv:array of Pchar):pid_t;cdecl;external libc_nlm name 'procve';
+function procve(path:Pchar; flags:dword; env:pointer; wiring:Pwiring_t; fds:Pfd_set;
+           appdata:pointer; appdata_size:size_t; reserved:pointer; argv:array of Pchar):pid_t;cdecl;external libc_nlm name 'procve';
+
+
+// pthread.h
+// sched.h
+{ turn on 1-byte packing...  }
+
+const
+  SCHED_UNKNOWN = 0;
+  SCHED_FIFO = 1;         { first-in, first-out      (default NetWare MPK)  }
+  SCHED_RR = 2;           { round-robin                    (unimplemented)  }
+  SCHED_SPORADIC = 3;     { Single UNIX Specification      (unimplemented)  }
+  SCHED_OTHER = 4;        { "other" policy                 (unimplemented)  }
+
+type
+   Psched_param = ^sched_param;
+   sched_param = record
+        sched_priority        : longint;    { for SPORADIC (unimplemented):   }
+        sched_ss_low_priority : longint;    { low scheduling priority         }
+        sched_ss_repl_period  : Ttimespec;  { replenishment period for        }
+        sched_ss_init_budget  : Ttimespec;  { initial budget                  }
+        sched_ss_max_repl     : longint;    { maximum pending replenishments  }
+        sched_policy          : longint;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+  const
+     PTHREAD_KEYS_MAX = 64;
+  { no actual maximum   }
+     PTHREAD_THREADS_MAX = 32767;
+     PTHREAD_STACK_MIN = 16384;
+  { pthread_setdetachstate, etc...  }
+     PTHREAD_CREATE_DETACHED = $00000010;
+     PTHREAD_CREATE_JOINABLE = 0;
+  { values for field 'attr_scope'...  }
+     PTHREAD_SCOPE_PROCESS = 0;
+  { as yet unsupported  }
+     PTHREAD_SCOPE_SYSTEM = 1;
+  { values for field 'mattr_flags', 'cattr_flags' and 'rwattr_flags'...  }
+     PTHREAD_PROCESS_PRIVATE = 0;
+  { as yet unsupported  }
+     PTHREAD_PROCESS_SHARED = 1;
+  { pthread_setcancelstate, etc...  }
+     PTHREAD_CANCELED = -(1);
+     PTHREAD_CANCEL_ASYNCHRONOUS = 1;
+     PTHREAD_CANCEL_DEFERRED = 2;
+     PTHREAD_CANCEL_DISABLE = 0;
+     PTHREAD_CANCEL_ENABLE = 1;
+  { values for field 'attr_flags'...  }
+     PTHREAD_EXPLICIT_SCHED = $0002;
+  { as yet unsupported  }
+     PTHREAD_INHERIT_SCHED = $0004;
+  { values for field 'mattr_protocol'...  }
+  { as yet unsupported  }
+     PTHREAD_PRIO_PROTECT = -(1);
+  { as yet unsupported  }
+     PTHREAD_PRIO_INHERIT = 1;
+  { as yet unsupported  }
+     PTHREAD_PRIO_NONE = 0;
+     PTHREAD_ONCE_INIT = 0;
+  { values for field 'mattr_kind'...  }
+     PTHREAD_MUTEX_NORMAL = $0000;
+     PTHREAD_MUTEX_RECURSIVE = $0010;
+  { as yet unsupported  }
+     PTHREAD_MUTEX_ERRORCHECK = $0020;
+  { as yet unsupported  }
+     PTHREAD_MUTEX_DEFAULT = $0040;
+
+type
+   Ppthread_once_t = ^pthread_once_t;
+   pthread_once_t = longint;
+
+   Ppthread_key_t = ^pthread_key_t;
+   pthread_key_t = longint;
+
+   Ppthread_t = ^pthread_t;
+   pthread_t = pointer; // longint;
+
+{ turn on 1-byte packing...  }
+
+   Ppthread_cond_t = ^pthread_cond_t;
+   pthread_cond_t = record
+        cond : pointer;
+        spares : array[0..5] of longint;
+     end;
+
+   Ppthread_mutex_t = ^pthread_mutex_t;
+   pthread_mutex_t = record
+        mutex : pointer;
+        reserved : array[0..52] of dword;
+     end;
+
+   Ppthread_rwlock_t = ^pthread_rwlock_t;
+   pthread_rwlock_t = record
+        rwlock : pointer;
+        reserved : array[0..2] of dword;
+     end;
+
+   Ppthread_attr_t = ^pthread_attr_t;
+   pthread_attr_t = record
+        attr_flags : dword;
+        attr_scope : longint;
+        attr_priority : longint;
+        attr_detachstate : longint;
+        attr_stackaddr : pointer;
+        attr_stacksize : size_t;
+        attr_policy : longint;
+        attr_name : array[0..19] of char;
+     end;
+
+   Ppthread_condattr_t = ^pthread_condattr_t;
+   pthread_condattr_t = record
+        cattr_flags : dword;
+        cattr_arg : pointer;
+        cattr_spare1 : longint;
+        cattr_spare2 : longint;
+     end;
+
+   Ppthread_mutexattr_t = ^pthread_mutexattr_t;
+   pthread_mutexattr_t = record
+        mattr_flags : dword;
+        mattr_kind : longint;
+        mattr_priority : longint;
+        mattr_prioceiling : longint;
+        mattr_protocol : longint;
+        mattr_spares2 : array[0..5] of longint;
+        mattr_name : array[0..31] of char;
+     end;
+   Ppthread_mutex_attr_t = Ppthread_mutexattr_t;
+   pthread_mutex_attr_t = pthread_mutexattr_t;
+
+   Ppthread_rwlockattr_t = ^pthread_rwlockattr_t;
+   pthread_rwlockattr_t = record
+        rwattr_flags : dword;
+        rwattr_spare1 : longint;
+        rwattr_priority : longint;
+        rwattr_prioceiling : longint;
+        rwattr_protocol : longint;
+        rwattr_spares2 : array[0..5] of longint;
+        rwattr_name : array[0..31] of char;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+{ pthread functions...  }
+
+
+type TPTThreadStartFunction = function (_para1:pointer):pointer; cdecl;
+
+function pthread_create(thread:Ppthread_t; attr:Ppthread_attr_t; start_routine:TPTThreadStartFunction; arg:pointer):longint;cdecl;external libc_nlm name 'pthread_create';
+function pthread_cancel(thread:pthread_t):longint;cdecl;external libc_nlm name 'pthread_cancel';
+function pthread_join(thread:pthread_t; status:Ppointer):longint;cdecl;external libc_nlm name 'pthread_join';
+procedure pthread_exit(status:pointer);cdecl;external libc_nlm name 'pthread_exit';
+function pthread_equal(t1:pthread_t; t2:pthread_t):longint;cdecl;external libc_nlm name 'pthread_equal';
+procedure pthread_yield;cdecl;external libc_nlm name 'pthread_yield';
+function pthread_kill(thread:pthread_t; sig:longint):longint;cdecl;external libc_nlm name 'pthread_kill';
+function pthread_detach(thread:pthread_t):longint;cdecl;external libc_nlm name 'pthread_detach';
+
+function pthread_once(once_control:Ppthread_once_t; init_routine:TCDeclProcedure ):longint;cdecl;external libc_nlm name 'pthread_once';
+function pthread_self:pthread_t;cdecl;external libc_nlm name 'pthread_self';
+function pthread_key_create(_para1:Ppthread_key_t; _destructor:TCDeclProc1PtrArg):longint;cdecl;external libc_nlm name 'pthread_key_create';
+function pthread_key_delete(key:pthread_key_t):longint;cdecl;external libc_nlm name 'pthread_key_delete';
+function pthread_getspecific(key:pthread_key_t):pointer;cdecl;external libc_nlm name 'pthread_getspecific';
+
+function pthread_setspecific(key:pthread_key_t; value:pointer):longint;cdecl;external libc_nlm name 'pthread_setspecific';
+function pthread_getschedparam(thread:pthread_t; policy:Plongint; param:Psched_param):longint;cdecl;external libc_nlm name 'pthread_getschedparam';
+
+function pthread_setschedparam(thread:pthread_t; policy:longint; param:Psched_param):longint;cdecl;external libc_nlm name 'pthread_setschedparam';
+function pthread_setcancelstate(state:longint; oldstate:Plongint):longint;cdecl;external libc_nlm name 'pthread_setcancelstate';
+function pthread_setcanceltype(_type:longint; oldtype:Plongint):longint;cdecl;external libc_nlm name 'pthread_setcanceltype';
+procedure pthread_testcancel;cdecl;external libc_nlm name 'pthread_testcancel';
+
+function pthread_sigmask(how:longint; _set:Psigset_t; oset:Psigset_t):longint;cdecl;external libc_nlm name 'pthread_sigmask';
+procedure pthread_cleanup_push(routine:TCDeclProc1PtrArg; arg:pointer);cdecl;external libc_nlm name 'pthread_cleanup_push';
+procedure pthread_cleanup_pop(execute:longint);cdecl;external libc_nlm name 'pthread_cleanup_pop';
+{ pthread attribute functions...  }
+function pthread_attr_init(attr:Ppthread_attr_t):longint;cdecl;external libc_nlm name 'pthread_attr_init';
+function pthread_attr_destroy(attr:Ppthread_attr_t):longint;cdecl;external libc_nlm name 'pthread_attr_destroy';
+
+function pthread_attr_getdetachstate(attr:Ppthread_attr_t; detachstate:Plongint):longint;cdecl;external libc_nlm name 'pthread_attr_getdetachstate';
+function pthread_attr_setdetachstate(attr:Ppthread_attr_t; detachstate:longint):longint;cdecl;external libc_nlm name 'pthread_attr_setdetachstate';
+
+function pthread_attr_getinheritsched(attr:Ppthread_attr_t; inheritsched:Plongint):longint;cdecl;external libc_nlm name 'pthread_attr_getinheritsched';
+function pthread_attr_setinheritsched(attr:Ppthread_attr_t; inheritsched:longint):longint;cdecl;external libc_nlm name 'pthread_attr_setinheritsched';
+function pthread_attr_getschedparam(attr:Ppthread_attr_t; param:Psched_param):longint;cdecl;external libc_nlm name 'pthread_attr_getschedparam';
+function pthread_attr_setschedparam(attr:Ppthread_attr_t; param:Psched_param):longint;cdecl;external libc_nlm name 'pthread_attr_setschedparam';
+function pthread_attr_getschedpolicy(attr:Ppthread_attr_t; policy:Plongint):longint;cdecl;external libc_nlm name 'pthread_attr_getschedpolicy';
+function pthread_attr_setschedpolicy(attr:Ppthread_attr_t; policy:longint):longint;cdecl;external libc_nlm name 'pthread_attr_setschedpolicy';
+function pthread_attr_getscope(attr:Ppthread_attr_t; contentionscope:Plongint):longint;cdecl;external libc_nlm name 'pthread_attr_getscope';
+function pthread_attr_setscope(attr:Ppthread_attr_t; contentionscope:longint):longint;cdecl;external libc_nlm name 'pthread_attr_setscope';
+function pthread_attr_getstackaddr(attr:Ppthread_attr_t; stackaddr:Ppointer):longint;cdecl;external libc_nlm name 'pthread_attr_getstackaddr';
+function pthread_attr_setstackaddr(attr:Ppthread_attr_t; stackaddr:pointer):longint;cdecl;external libc_nlm name 'pthread_attr_setstackaddr';
+function pthread_attr_getstacksize(attr:Ppthread_attr_t; stacksize:Psize_t):longint;cdecl;external libc_nlm name 'pthread_attr_getstacksize';
+function pthread_attr_setstacksize(attr:Ppthread_attr_t; stacksize:size_t):longint;cdecl;external libc_nlm name 'pthread_attr_setstacksize';
+function pthread_attr_getname_np(attr:Ppthread_attr_t; name:Pchar; len:size_t; mbz:Ppointer):longint;cdecl;external libc_nlm name 'pthread_attr_getname_np';
+function pthread_attr_setname_np(attr:Ppthread_attr_t; name:Pchar; mbz:pointer):longint;cdecl;external libc_nlm name 'pthread_attr_setname_np';
+{ condition variable functions...  }
+
+function pthread_cond_init(cond:Ppthread_cond_t; attr:Ppthread_condattr_t):longint;cdecl;external libc_nlm name 'pthread_cond_init';
+function pthread_cond_destroy(cond:Ppthread_cond_t):longint;cdecl;external libc_nlm name 'pthread_cond_destroy';
+function pthread_cond_signal(cond:Ppthread_cond_t):longint;cdecl;external libc_nlm name 'pthread_cond_signal';
+function pthread_cond_broadcast(cond:Ppthread_cond_t):longint;cdecl;external libc_nlm name 'pthread_cond_broadcast';
+function pthread_cond_wait(cond:Ppthread_cond_t; mutex:Ppthread_mutex_t):longint;cdecl;external libc_nlm name 'pthread_cond_wait';
+
+function pthread_cond_timedwait(cond:Ppthread_cond_t; mutex:Ppthread_mutex_t; abstime:Ptimespec):longint;cdecl;external libc_nlm name 'pthread_cond_timedwait';
+{ condition variable attribute functions...  }
+function pthread_condattr_init(attr:Ppthread_condattr_t):longint;cdecl;external libc_nlm name 'pthread_condattr_init';
+function pthread_condattr_destroy(attr:Ppthread_condattr_t):longint;cdecl;external libc_nlm name 'pthread_condattr_destroy';
+function pthread_condattr_getpshared(attr:Ppthread_condattr_t; pshared:Plongint):longint;cdecl;external libc_nlm name 'pthread_condattr_getpshared';
+function pthread_condattr_setpshared(attr:Ppthread_condattr_t; pshared:longint):longint;cdecl;external libc_nlm name 'pthread_condattr_setpshared';
+{ mutex functions...  }
+
+function pthread_mutex_init(mutex:Ppthread_mutex_t; attr:Ppthread_mutexattr_t):longint;cdecl;external libc_nlm name 'pthread_mutex_init';
+function pthread_mutex_destroy(mutex:Ppthread_mutex_t):longint;cdecl;external libc_nlm name 'pthread_mutex_destroy';
+function pthread_mutex_lock(mutex:Ppthread_mutex_t):longint;cdecl;external libc_nlm name 'pthread_mutex_lock';
+function pthread_mutex_trylock(mutex:Ppthread_mutex_t):longint;cdecl;external libc_nlm name 'pthread_mutex_trylock';
+function pthread_mutex_unlock(mutex:Ppthread_mutex_t):longint;cdecl;external libc_nlm name 'pthread_mutex_unlock';
+{ mutex attribute functions...  }
+function pthread_mutexattr_init(attr:Ppthread_mutexattr_t):longint;cdecl;external libc_nlm name 'pthread_mutexattr_init';
+function pthread_mutexattr_destroy(attr:Ppthread_mutexattr_t):longint;cdecl;external libc_nlm name 'pthread_mutexattr_destroy';
+function pthread_mutexattr_getprioceiling(attr:Ppthread_mutexattr_t; prioceiling:Plongint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_getprioceiling';
+function pthread_mutexattr_setprioceiling(attr:Ppthread_mutexattr_t; prioceiling:longint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_setprioceiling';
+function pthread_mutexattr_getprotocol(attr:Ppthread_mutexattr_t; protocol:Plongint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_getprotocol';
+function pthread_mutexattr_setprotocol(attr:Ppthread_mutexattr_t; protocol:longint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_setprotocol';
+function pthread_mutexattr_getpshared(attr:Ppthread_mutexattr_t; pshared:Plongint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_getpshared';
+function pthread_mutexattr_setpshared(attr:Ppthread_mutexattr_t; pshared:longint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_setpshared';
+function pthread_mutexattr_gettype(attr:Ppthread_mutexattr_t; kind:Plongint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_gettype';
+function pthread_mutexattr_settype(attr:Ppthread_mutexattr_t; kind:longint):longint;cdecl;external libc_nlm name 'pthread_mutexattr_settype';
+{ reader-writer lock functions...  }
+function pthread_rwlock_init(rwlp:Ppthread_rwlock_t; attr:Ppthread_rwlockattr_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_init';
+function pthread_rwlock_destroy(rwlp:Ppthread_rwlock_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_destroy';
+function pthread_rwlock_rdlock(rwlp:Ppthread_rwlock_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_rdlock';
+function pthread_rwlock_wrlock(rwlp:Ppthread_rwlock_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_wrlock';
+function pthread_rwlock_tryrdlock(rwlp:Ppthread_rwlock_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_tryrdlock';
+function pthread_rwlock_trywrlock(rwlp:Ppthread_rwlock_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_trywrlock';
+function pthread_rwlock_unlock(rwlp:Ppthread_rwlock_t):longint;cdecl;external libc_nlm name 'pthread_rwlock_unlock';
+function pthread_rwlock_timedrdlock(rwlock:Ppthread_rwlock_t; abs_timeout:Ptimespec):longint;cdecl;external libc_nlm name 'pthread_rwlock_timedrdlock';
+function pthread_rwlock_timedwrlock(rwlock:Ppthread_rwlock_t; abs_timeout:Ptimespec):longint;cdecl;external libc_nlm name 'pthread_rwlock_timedwrlock';
+{ reader-writer lock attribute functions...  }
+function pthread_rwlockattr_init(attr:Ppthread_rwlockattr_t):longint;cdecl;external libc_nlm name 'pthread_rwlockattr_init';
+function pthread_rwlockattr_destroy(attr:Ppthread_rwlockattr_t):longint;cdecl;external libc_nlm name 'pthread_rwlockattr_destroy';
+function pthread_rwlockattr_getpshared(attr:Ppthread_rwlockattr_t; pshared:Plongint):longint;cdecl;external libc_nlm name 'pthread_rwlockattr_getpshared';
+function pthread_rwlockattr_setpshared(attr:Ppthread_rwlockattr_t; pshared:longint):longint;cdecl;external libc_nlm name 'pthread_rwlockattr_setpshared';
+{ registering functions to execute at call to fork()...  }
+function pthread_atfork(prepare, parent, child:TCDeclProcedure):longint;cdecl;external libc_nlm name 'pthread_atfork';
+
+
+// pwd.h
+
+{ user ID                }
+{ group ID               }
+{ username               }
+{ home directory         }
+{ default shell          }
+{ non-mandated fields    }
+{ real name              }
+{ password (always nil)  }
+{ general information    }
+{ comment                }
+{ password change time   }
+{ account expiration     }
+type
+   Ppasswd = ^passwd;
+   passwd = record
+        pw_uid : uid_t;//cdecl;
+        pw_spare1 : uid_t;
+        pw_gid : gid_t;
+        pw_spare2 : gid_t;
+        pw_name : Pchar;
+        pw_dir : Pchar;
+        pw_shell : Pchar;
+        pw_LDAPName : Pchar;
+        pw_passwd : Pchar;
+        pw_gecos : Pchar;
+        pw_comment : Pchar;
+        pw_change : time_t;
+        pw_expire : time_t;
+        spare1 : array[0..2] of pointer;
+        spare2 : array[0..3] of pointer;
+     end;
+
+
+//!! function geteuid:uid_t;cdecl;external libc_nlm name 'geteuid';
+//!! function getuid:uid_t;cdecl;external libc_nlm name 'getuid';
+function posixlogin(host:Pchar; port:longint; name:Pchar; pwd:Pchar; ctx:Pchar):longint;cdecl;external libc_nlm name 'posixlogin';
+function posixlogout:longint;cdecl;external libc_nlm name 'posixlogout';
+
+{$ifdef EnableLibcRegex}
+
+
+// regex.h
+type
+   Pregoff_t = ^regoff_t;
+   regoff_t = off_t;
+
+   Preg_syntax_t = ^reg_syntax_t;
+   reg_syntax_t = dword;
+
+   Ps_reg_t = ^s_reg_t;
+   s_reg_t = longint;
+
+   Pactive_reg_t = ^active_reg_t;
+   active_reg_t = dword;
+{ number of parenthesized subexpressions  }
+
+{ end pointer for REG_PEND                }
+{ not visible                             }
+
+   Pregex_t = ^regex_t;
+   regex_t = record
+        re_magic : longint;
+        re_nsub : size_t;
+        re_endp : Pchar;
+        re_g : Pre_guts;
+     end;
+
+  const
+     REG_BASIC = 0000;
+     REG_EXTENDED = 0001;
+     REG_ICASE = 0002;
+     REG_NOSUB = 0004;
+     REG_NEWLINE = 0010;
+     REG_NOSPEC = 0020;
+     REG_PEND = 0040;
+     REG_DUMP = 0200;
+  { regerror() flags  }
+     REG_NOMATCH = 1;
+     REG_BADPAT = 2;
+     REG_ECOLLATE = 3;
+     REG_ECTYPE = 4;
+     REG_EESCAPE = 5;
+     REG_ESUBREG = 6;
+     REG_EBRACK = 7;
+     REG_EPAREN = 8;
+     REG_EBRACE = 9;
+     REG_BADBR = 10;
+     REG_ERANGE = 11;
+     REG_ESPACE = 12;
+     REG_BADRPT = 13;
+     REG_EMPTY = 14;
+     REG_ASSERT = 15;
+     REG_INVARG = 16;
+  { convert name to number (!)  }
+     REG_ATOI = 255;
+  { convert number to name (!)  }
+     REG_ITOA = 0400;
+  { regexec() flags  }
+     REG_NOTBOL = 00001;
+     REG_NOTEOL = 00002;
+     REG_STARTEND = 00004;
+  { tracing of execution        }
+     REG_TRACE = 00400;
+  { force large representation  }
+     REG_LARGE = 01000;
+  { force use of backref code   }
+     REG_BACKR = 02000;
+
+
+   Pregmatch_t = ^regmatch_t;
+   regmatch_t = record
+        rm_so : regoff_t;
+        rm_eo : regoff_t;
+     end;
+{ regcomp() flags...  }
+{ regerror() flags  }
+{ regexec() flags  }
+
+{$endif EnableLibcRegex}
+
+
+// ringx.h
+
+const PAGE_SIZE = 4096;
+
+
+type RxCleanup_t = procedure (addr:pointer);cdecl;
+{ preliminary (registration and clean-up)...  }
+
+function RxIdentifyCode(startFuncAddr:pointer; endFuncAddrPlusOne:pointer; marshallingCodeReference:Plongint):longint;cdecl;external system_nlm name 'RxIdentifyCode';
+function RxUnidentifyCode(marshallingCodeReference:longint):longint;cdecl;external system_nlm name 'RxUnidentifyCode';
+function RxRegisterSysCall(marshalledFuncAddr:pointer; unmarshalledName:Pchar; argCount:longint):longint;cdecl;external system_nlm name 'RxRegisterSysCall';
+function RxUnregisterSysCall(unmarshalledName:Pchar):longint;cdecl;external system_nlm name 'RxUnregisterSysCall';
+{ mundane calls...  }
+function RxLockMemory(addr:pointer; length:size_t):longint;cdecl;external system_nlm name 'RxLockMemory';
+function RxUnlockMemory(addr:pointer; length:size_t):longint;cdecl;external system_nlm name 'RxUnlockMemory';
+{ to handle address space fault and threads caught in kernel...  }
+function RxRegisterKernelResource(_para1:pointer; _para2:RxCleanup_t):longint;cdecl;external system_nlm name 'RxRegisterKernelResource';
+function RxRegisterThreadResource(_para1:pointer; _para2:RxCleanup_t):longint;cdecl;external system_nlm name 'RxRegisterThreadResource';
+function RxUnregisterKernelResource(_para1:pointer):longint;cdecl;external system_nlm name 'RxUnregisterKernelResource';
+function RxUnregisterThreadResource(_para1:pointer):longint;cdecl;external system_nlm name 'RxUnregisterThreadResource';
+{ data; referenced to avoid compiler optimization of code including this  }
+//??  var
+//??     RxTmp : longint;cvar;public;
+{ main working macros (buffers and structures, char and wide strings...  }
+
+
+// semaphore.h
+
+const
+  SEM_VALUE_MAX = $7FFFFFFF;
+// #define SEM_FAILED      ((sem_t *) 0)
+
+type
+   Psem_t = ^sem_t;
+   sem_t = record
+        sema : pointer;
+        spares : array[0..5] of longint;
+     end;
+
+function sem_init(sem:Psem_t; pshared:longint; value:dword):longint;cdecl;external libc_nlm name 'sem_init';
+function sem_destroy(sem:Psem_t):longint;cdecl;external libc_nlm name 'sem_destroy';
+function sem_getvalue(sem:Psem_t; sval:Plongint):longint;cdecl;external libc_nlm name 'sem_getvalue';
+function sem_post(sem:Psem_t):longint;cdecl;external libc_nlm name 'sem_post';
+function sem_wait(sem:Psem_t):longint;cdecl;external libc_nlm name 'sem_wait';
+function sem_trywait(sem:Psem_t):longint;cdecl;external libc_nlm name 'sem_trywait';
+function sem_timedwait(sem:Psem_t; abstime:Ptimespec):longint;cdecl;external libc_nlm name 'sem_timedwait';
+
+
+// setjmp.h
+
+type
+   _Pjmp_buf = ^_jmp_buf;
+   _jmp_buf = double;
+
+procedure __longjmp(_para1:_jmp_buf; _para2:longint);cdecl;external libc_nlm name '__longjmp';
+function __setjmp(_para1:_jmp_buf):longint;cdecl;external libc_nlm name '__setjmp';
+
+// synch.h
+
+const
+  USYNC_THREAD    = 0;
+  USYNC_PROCESS   = 1;  { shared between processes (unsupported)}
+  USYNC_DESTROYED = 2;  { deallocated object }
+
+type
+   //!! timespec = timestruc_t;
+   Pbarrier = ^barrier;
+   barrier = record
+        reserved : array[0..7] of longint;
+     end;
+   barrier_t = barrier;
+   Pbarrier_t = ^barrier_t;
+
+   Pcond_t = ^cond_t;
+   cond_t = pthread_cond_t;
+
+   Pmutex_t = ^mutex_t;
+   mutex_t = pthread_mutex_t;
+
+   Prwlock_t = ^rwlock_t;
+   rwlock_t = pthread_rwlock_t;
+
+   Psema_t = ^sema_t;
+   sema_t = sem_t;
+
+function barrier_init(bp:Pbarrier_t; threads:longint):longint;cdecl;external libc_nlm name 'barrier_init';
+procedure barrier_destroy(bp:Pbarrier_t);cdecl;external libc_nlm name 'barrier_destroy';
+function barrier_wait(bp:Pbarrier_t):longint;cdecl;external libc_nlm name 'barrier_wait';
+function barrier_inc(bp:Pbarrier_t):longint;cdecl;external libc_nlm name 'barrier_inc';
+function barrier_dec(bp:Pbarrier_t):longint;cdecl;external libc_nlm name 'barrier_dec';
+function cond_init(cvp:Pcond_t; _type:longint; arg:longint):longint;cdecl;external libc_nlm name 'cond_init';
+function cond_destroy(cvp:Pcond_t):longint;cdecl;external libc_nlm name 'cond_destroy';
+function cond_broadcast(cvp:Pcond_t):longint;cdecl;external libc_nlm name 'cond_broadcast';
+function cond_signal(cvp:Pcond_t):longint;cdecl;external libc_nlm name 'cond_signal';
+function cond_wait(cvp:Pcond_t; mp:Pmutex_t):longint;cdecl;external libc_nlm name 'cond_wait';
+//!! function cond_timedwait(cvp:Pcond_t; mp:Pmutex_t; abstime:Ptimestruc_t):longint;cdecl;external libc_nlm name 'cond_timedwait';
+function mutex_init(mp:Pmutex_t; _type:longint; arg:pointer):longint;cdecl;external libc_nlm name 'mutex_init';
+function mutex_destroy(mp:Pmutex_t):longint;cdecl;external libc_nlm name 'mutex_destroy';
+function mutex_lock(mp:Pmutex_t):longint;cdecl;external libc_nlm name 'mutex_lock';
+function mutex_trylock(mp:Pmutex_t):longint;cdecl;external libc_nlm name 'mutex_trylock';
+function mutex_unlock(mp:Pmutex_t):longint;cdecl;external libc_nlm name 'mutex_unlock';
+function rwlock_init(rwlp:Prwlock_t; _type:longint; arg:pointer):longint;cdecl;external libc_nlm name 'rwlock_init';
+function rwlock_destroy(rwlp:Prwlock_t):longint;cdecl;external libc_nlm name 'rwlock_destroy';
+function rw_rdlock(rwlp:Prwlock_t):longint;cdecl;external libc_nlm name 'rw_rdlock';
+function rw_wrlock(rwlp:Prwlock_t):longint;cdecl;external libc_nlm name 'rw_wrlock';
+function rw_tryrdlock(rwlp:Prwlock_t):longint;cdecl;external libc_nlm name 'rw_tryrdlock';
+function rw_trywrlock(rwlp:Prwlock_t):longint;cdecl;external libc_nlm name 'rw_trywrlock';
+function rw_unlock(rwlp:Prwlock_t):longint;cdecl;external libc_nlm name 'rw_unlock';
+function sema_init(sp:Psema_t; count:dword; _type:longint; arg:pointer):longint;cdecl;external libc_nlm name 'sema_init';
+function sema_destroy(sp:Psema_t):longint;cdecl;external libc_nlm name 'sema_destroy';
+function sema_post(sp:Psema_t):longint;cdecl;external libc_nlm name 'sema_post';
+function sema_trywait(sp:Psema_t):longint;cdecl;external libc_nlm name 'sema_trywait';
+function sema_wait(sp:Psema_t):longint;cdecl;external libc_nlm name 'sema_wait';
+
+// syslog.h
+
+{ log options for openlog()...  }
+{ message facilities for openlog()...  }
+{ for constructing 'maskpri' for setlogmask()...  }
+{ values for priority argument of syslog()...  }
+{ with no filename argument, syslogd.nlm uses this configuration file:  }
+// termio.h
+// termios.h
+{
+** Note: This is a very primitive and narrow adaptation of POSIX termios.h.
+** Most of what is in this file is for completeness and to avoid locking
+** termios.h interfaces off from advancing progressively as needed.}
+
+
+  const
+     NCCS = 32;
+  { ^C  }
+     INTR = $03;
+  { ^D  }
+     QUIT = $04;
+  { ^Z  }
+     SUSP = $1A;
+  { currently unsupported                          }
+     ECHO = $01;
+  { currently unsupported                          }
+     ECHOE = $02;
+  { currently unsupported                          }
+     ECHOK = $04;
+  { currently unsupported                          }
+     ECHONL = $08;
+  { currently unsupported                          }
+     ICANON = $10;
+  { currently unsupported                          }
+     IEXTEN = $20;
+  { check against INTR, QUIT and SUSP (default)    }
+     ISIG = $40;
+  { currently unsupported                          }
+     NOFLSH = $80;
+  { c_iflag bits...  }
+     IGNBRK = 0000001;
+     BRKINT = 0000002;
+     IGNPAR = 0000004;
+     PARMRK = 0000010;
+     INPCK = 0000020;
+     ISTRIP = 0000040;
+     INLCR = 0000100;
+     IGNCR = 0000200;
+     ICRNL = 0000400;
+     IUCLC = 0001000;
+     IXON = 0002000;
+     IXANY = 0004000;
+     IXOFF = 0010000;
+     IMAXBEL = 0020000;
+     CSIZE = 0000060;
+     CS5 = 0000000;
+     CS6 = 0000020;
+     CS7 = 0000040;
+     CS8 = 0000060;
+     CSTOPB = 0000100;
+     CREAD = 0000200;
+     PARENB = 0000400;
+     PARODD = 0001000;
+     HUPCL = 0002000;
+     CLOCAL = 0004000;
+  { 'c_cc' control characters...  }
+  { ^C                                             }
+     VINTR = 1;
+  { ^\   (unsupported)                             }
+     VQUIT = 2;
+  { del  (unsupported)                             }
+     VERASE = 3;
+  { ^D                                             }
+     VEOF = 4;
+  { @    (unsupported)                             }
+     VKILL = 5;
+  { currently unsupported                          }
+     VTIME = 6;
+  { currently unsupported                          }
+     VMIN = 7;
+  { ^q   (unsupported)                             }
+     VSTART = 8;
+  { ^s   (unsupported)                             }
+     VSTOP = 9;
+  { ^z                                             }
+     VSUSP = 10;
+  { '\0' (unsupported)                             }
+     VEOL = 11;
+  { 'optional_actions' causes action to be effectuated when:  }
+  { immediately                                    }
+     TCSANOW = 1;
+  { output done                     (unsupported)  }
+     TCSADRAIN = 2;
+  { output done and input discarded (unsupported)  }
+     TCSAFLUSH = 3;
+
+
+{ c_iflag bits...  }
+{ 'c_cc' control characters...  }
+{ 'optional_actions' causes action to be effectuated when:  }
+type
+   Ptcflag_t = ^tcflag_t;
+   tcflag_t = dword;
+
+   Pcc_t = ^cc_t;
+   cc_t = byte;
+
+   Pspeed_t = ^speed_t;
+   speed_t =  Longint;
+   Const
+     B0 = 0;
+     B50 = 50;
+     B75 = 75;
+     B110 = 110;
+     B134 = 134;
+     B150 = 150;
+     B200 = 200;
+     B300 = 300;
+     B600 = 600;
+     B1200 = 1200;
+     B1800 = 1800;
+     B2400 = 2400;
+     B4800 = 4800;
+     B9600 = 9600;
+     B19200 = 19200;
+     B38400 = 38400;
+
+{ ioctl() control packet...  }
+{ input modes     --currently unused          }
+{ output modes    --currently unused          }
+{ control modes   --currently unused          }
+{ local modes     --ISIG currently supported  }
+{ input speed     --currently unused          }
+{ output speed    --currently unused          }
+{ line discipline --currently unused          }
+{ control chars   --currently used            }
+type
+   Ptermios = ^termios;
+   termios = record
+        c_iflag : tcflag_t;
+        c_oflag : tcflag_t;
+        c_cflag : tcflag_t;
+        c_lflag : tcflag_t;
+        c_ispeed : speed_t;
+        c_ospeed : speed_t;
+        c_line : cc_t;
+        c_spare1 : dword;
+        c_cc : array[0..31] of cc_t;
+        c_spare2 : dword;
+        c_spare3 : dword;
+        c_spare4 : dword;
+        c_spare5 : dword;
+     end;
+
+{ POSIX-defined functions...  }
+
+function tcgetattr(fildes:longint; tp:Ptermios):longint;cdecl;external libc_nlm name 'tcgetattr';
+function tcsetattr(fildes:longint; optional_actions:longint; tp:Ptermios):longint;cdecl;external libc_nlm name 'tcsetattr';
+
+// tgmath.h
+
+{ syslog.h
+  ==============================================================================}
+  { log options for openlog()...  }
+  { log the process ID with each message  }
+
+  const
+     LOG_PID = $00000001;
+     LOG_CONS = $00000002;                   { log to the system console on error    }
+     LOG_NDELAY = $00000004;                 { connect to syslog daemon immediately  }
+     LOG_ODELAY = $00000008;                 { delay open until syslog() is called   }
+     LOG_NOWAIT = $00000010;                 { do not wait for child processes       }
+  { message facilities for openlog()...  }
+     LOG_KERN = $00000001;                   { generated by system  }
+     LOG_USER = $00000002;                   { generated by a process                }
+     LOG_MAIL = $00000004;                   { generated by mail system              }
+     LOG_NEWS = $00000008;                   { generated by news system              }
+     LOG_UUCP = $00000010;                   { generated by UUCP system              }
+     LOG_DAEMON = $00000020;                 { generated by daemon                   }
+     LOG_AUTH = $00000040;                   { generated by auth. daemon             }
+     LOG_CRON = $00000080;                   { generated by clock daemon             }
+     LOG_LPR = $00000100;                    { generated by printer system           }
+     LOG_LOCAL0 = $00000200;                 { local use                             }
+     LOG_LOCAL1 = $00000400;
+     LOG_LOCAL2 = $00000800;
+     LOG_LOCAL3 = $00001000;
+     LOG_LOCAL4 = $00002000;
+     LOG_LOCAL5 = $00004000;
+     LOG_LOCAL6 = $00008000;
+     LOG_LOCAL7 = $00010000;
+     LOG_UNUSED1 = $00020000;
+     LOG_UNUSED2 = $00040000;
+     LOG_UNUSED3 = $00080000;
+     LOG_UNUSED4 = $00100000;
+     LOG_UNUSED5 = $00200000;
+     LOG_UNUSED6 = $00400000;                { unused                                }
+     LOG_UNUSED7 = $00800000;                { unused                                }
+  { for constructing 'maskpri' for setlogmask()...  }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }
+//  function LOG_MASK(p : longint) : longint;
+     LOG_EMERG = $01000000;
+     LOG_ALERT = $02000000;                  { condition to correct immediately       }
+     LOG_CRIT = $04000000;                   { critical condition                     }
+     LOG_ERR = $08000000;                    { error message                          }
+     LOG_WARNING = $10000000;                { warning message                        }
+     LOG_NOTICE = $20000000;                 { condition requiring special handling   }
+     LOG_INFO = $40000000;                   { general information message            }
+     LOG_DEBUG = $80000000;                  { message useful for debugging programs  }
+     P_cfgfile = 'sys:/etc/syslog.conf';     { with no filename argument, syslogd.nlm uses this configuration file:  }
+
+  procedure closelog;cdecl;external libc_nlm name 'closelog';
+  procedure openlog(ident:Pchar; logopt:longint; facility:longint);cdecl;external libc_nlm;
+  function setlogmask(maskpri:longint):longint;cdecl;external libc_nlm name 'setlogmask';
+{$ifndef DisableArrayOfConst}
+  procedure syslog(priority:longint; message:Pchar; args:array of const);cdecl;external libc_nlm name 'syslog';
+{$endif}
+  procedure syslog(priority:longint; message:Pchar);cdecl;external libc_nlm name 'syslog';
+
+
+
+// thread.h
+
+  const
+     THR_BOUND = $00000080;
+     THR_DETACHED = PTHREAD_CREATE_DETACHED;
+     THR_NEW_LWP = $FFFFFFFE;
+     THR_SUSPENDED = $00000020;
+     THR_DAEMON = $00000040;
+
+
+{ type definitions...  }
+type
+
+//!!   Pthread_t = ^thread_t;
+   thread_t = pthread_t;
+
+//!!   Pthread_key_t = ^thread_key_t;
+   thread_key_t = pthread_key_t;
+{ prototypes...  }
+
+type TThrStartRoutine = function (_para1:pointer):pointer; cdecl;
+function thr_create(stack_based:pointer; stack_size:size_t;
+           start_routine:TThrStartRoutine; arg:pointer; flags:longint;
+           new_thr:Pthread_t):longint;cdecl;external libc_nlm name 'thr_create';
+function thr_self:thread_t;cdecl;external libc_nlm name 'thr_self';
+function thr_suspend(thr:thread_t):longint;cdecl;external libc_nlm name 'thr_suspend';
+function thr_continue(thr:thread_t):longint;cdecl;external libc_nlm name 'thr_continue';
+function thr_join(wait_for:thread_t; dead:Pthread_t; status:Ppointer):longint;cdecl;external libc_nlm name 'thr_join';
+procedure thr_yield;cdecl;external libc_nlm name 'thr_yield';
+procedure thr_exit(status:pointer);cdecl;external libc_nlm name 'thr_exit';
+function thr_minstack:size_t;cdecl;external libc_nlm name 'thr_minstack';
+function thr_kill(thr:thread_t; sig:longint):longint;cdecl;external libc_nlm name 'thr_kill';
+
+function thr_sigsetmask(how:longint; _set:Psigset_t; oset:Psigset_t):longint;cdecl;external libc_nlm name 'thr_sigsetmask';
+function thr_getconcurrency:longint;cdecl;external libc_nlm name 'thr_getconcurrency';
+function thr_setconcurrency(new_level:longint):longint;cdecl;external libc_nlm name 'thr_setconcurrency';
+function thr_getprio(thr:thread_t; pri:Plongint):longint;cdecl;external libc_nlm name 'thr_getprio';
+function thr_setprio(thr:thread_t; pri:longint):longint;cdecl;external libc_nlm name 'thr_setprio';
+function thr_keycreate(key:Pthread_key_t; _destructor:TCDeclProc1PtrArg):longint;cdecl;external libc_nlm name 'thr_keycreate';
+function thr_getspecific(key:thread_key_t; value:Ppointer):longint;cdecl;external libc_nlm name 'thr_getspecific';
+function thr_setspecific(key:thread_key_t; value:pointer):longint;cdecl;external libc_nlm name 'thr_setspecific';
+
+// utf8.h
+
+type
+   Putf8_t = ^utf8_t;
+   utf8_t = byte;
+   PPutf8_t = ^Putf8_t;
+  var
+     __utf8width : array of byte;cvar;external;
+{ prototypes...  }
+
+
+function utf8width(ch:Putf8_t):size_t;cdecl;external libc_nlm name 'utf8width';
+function utf8cat(tgt:Putf8_t; src:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8cat';
+function utf8chr(_string:Putf8_t; ch:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8chr';
+function utf8cmp(s1:Putf8_t; s2:Putf8_t):longint;cdecl;external libc_nlm name 'utf8cmp';
+function utf8cpy(tgt:Putf8_t; src:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8cpy';
+function utf8cspn(_string:Putf8_t; charset:Putf8_t):size_t;cdecl;external libc_nlm name 'utf8cspn';
+function utf8dup(s:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8dup';
+function utf8index(_string:Putf8_t; search:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8index';
+function utf8len(_string:Putf8_t):size_t;cdecl;external libc_nlm name 'utf8len';
+{$ifndef DisableArrayOfConst}
+function utf8list(tgt:Putf8_t; s1:Putf8_t; args:array of const):Putf8_t;cdecl;external libc_nlm name 'utf8list';
+{$endif}
+function utf8list(tgt:Putf8_t; s1:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8list';
+function utf8lwr(_string:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8lwr';
+function utf8ncat(tgt:Putf8_t; src:Putf8_t; n:size_t):Putf8_t;cdecl;external libc_nlm name 'utf8ncat';
+function utf8ncmp(s1:Putf8_t; s2:Putf8_t; n:size_t):longint;cdecl;external libc_nlm name 'utf8ncmp';
+function utf8ncpy(tgt:Putf8_t; src:Putf8_t; n:size_t):Putf8_t;cdecl;external libc_nlm name 'utf8ncpy';
+function utf8next(_string:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8next';
+function utf8nlen(_string:Putf8_t; nbytes:size_t):size_t;cdecl;external libc_nlm name 'utf8nlen';
+function utf8nset(base:Putf8_t; ch:Putf8_t; n:size_t):Putf8_t;cdecl;external libc_nlm name 'utf8nset';
+function utf8pbrk(s1:Putf8_t; s2:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8pbrk';
+function utf8prev(_string:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8prev';
+function utf8rchr(_string:Putf8_t; ch:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8rchr';
+function utf8rev(_string:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8rev';
+function utf8size(_string:Putf8_t):size_t;cdecl;external libc_nlm name 'utf8size';
+function utf8spn(_string:Putf8_t; charset:Putf8_t):size_t;cdecl;external libc_nlm name 'utf8spn';
+function utf8str(as1:Putf8_t; as2:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8str';
+function utf8tolower(_string:Putf8_t; dest:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8tolower';
+function utf8tok_r(_string:Putf8_t; sepset:Putf8_t; lasts:PPutf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8tok_r';
+function utf8toupper(_string:Putf8_t; dest:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8toupper';
+function utf8upr(_string:Putf8_t):Putf8_t;cdecl;external libc_nlm name 'utf8upr';
+function isutf8ascii(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8ascii';
+function isutf8digit(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8digit';
+function isutf8xdigit(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8xdigit';
+function isutf8space(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8space';
+function isutf8alnum(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8alnum';
+function isutf8alpha(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8alpha';
+function isutf8lower(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8lower';
+function isutf8upper(_string:Putf8_t):longint;cdecl;external libc_nlm name 'isutf8upper';
+
+
+// utime.h
+{ turn on 1-byte packing...  }
+
+{ access time  }
+{ modification time  }
+type
+   Putimbuf = ^Tutimbuf;
+   Tutimbuf = record
+        actime  : time_t;
+        modtime : time_t;
+     end;
+
+(** unsupported pragma#pragma pack()*)
+
+
+
+function utime(path:Pchar; times:Putimbuf):longint;cdecl;external libc_nlm name 'utime';
+function utime(path:Pchar; var times:Tutimbuf):longint;cdecl;external libc_nlm name 'utime';
+
+
+// utsname.h
+// wctype.h
+type
+   Pwctype_t = ^wctype_t;
+   wctype_t =  Longint;
+Const
+   WCTYPE_UNDEF = 0;
+   WCTYPE_ALNUM = 1;
+   WCTYPE_ALPHA = 2;
+   WCTYPE_BLANK = 3;
+   WCTYPE_CNTRL = 4;
+   WCTYPE_DIGIT = 5;
+   WCTYPE_GRAPH = 6;
+   WCTYPE_LOWER = 7;
+   WCTYPE_PRINT = 8;
+   WCTYPE_PUNCT = 9;
+   WCTYPE_SPACE = 10;
+   WCTYPE_UPPER = 11;
+   WCTYPE_XDIGIT = 12;
+
+type
+   Pwctrans_t = ^wctrans_t;
+   wctrans_t = wchar_t;
+
+function iswalnum(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswalnum';
+function iswalpha(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswalpha';
+function iswblank(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswblank';
+function iswcntrl(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswcntrl';
+function iswdigit(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswdigit';
+function iswgraph(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswgraph';
+function iswlower(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswlower';
+function iswprint(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswprint';
+function iswpunct(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswpunct';
+function iswspace(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswspace';
+function iswupper(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswupper';
+function iswxdigit(_para1:longint):longint;cdecl;external libc_nlm name 'iswxdigit';
+function towlower(_para1:wint_t):wint_t;cdecl;external libc_nlm name 'towlower';
+function towupper(_para1:wint_t):wint_t;cdecl;external libc_nlm name 'towupper';
+function iswctype(_para1:wint_t; _para2:wctype_t):longint;cdecl;external libc_nlm name 'iswctype';
+
+function wctype(_para1:Pchar):wctype_t;cdecl;external libc_nlm name 'wctype';
+function towctrans(_para1:wint_t; _para2:wctrans_t):wint_t;cdecl;external libc_nlm name 'towctrans';
+
+function wctrans(_para1:Pchar):wctrans_t;cdecl;external libc_nlm name 'wctrans';
+function iswascii(_para1:wint_t):longint;cdecl;external libc_nlm name 'iswascii';
+
+
+// windows.h
+
+
+  const
+     DLL_ACTUAL_DLLMAIN = 0;
+     DLL_NLM_STARTUP = 1;        { start-up, 'lpvReserved' is NLM handle  }
+     DLL_NLM_SHUTDOWN = 2;       { unload, 'lpvReserved' is NLM handle    }
+     { standard DllMain() messages...  }
+     DLL_PROCESS_ATTACH = 3;     { DLL "loaded" into application space    }
+     DLL_THREAD_ATTACH = 4;      { application creating new thread        }
+     DLL_THREAD_DETACH = 5;      { application thread exiting cleanly     }
+     DLL_PROCESS_DETACH = 6;     { DLL "unloaded" from application space  }
+     TLS_MINIMUM_AVAILABLE = 64; { minumum number of keys available       }
+
+
+type
+
+   PLPVOID = ^LPVOID;
+   LPVOID = void;
+
+   PBOOL = ^BOOL;
+   BOOL = longint;
+
+   PHMODULE = ^HMODULE;
+   HMODULE = void;
+
+   PLPCTSTR = ^LPCTSTR;
+   LPCTSTR = char;
+
+   PHINSTANCE = ^HINSTANCE;
+   HINSTANCE = void;
+{ Win32 DLL solutions for dynamic NLM libraries on NetWare...  }
+
+function GetLastError:dword;cdecl;external libc_nlm name 'GetLastError';
+procedure SetLastError(dwErrCode:dword);cdecl;external libc_nlm name 'SetLastError';
+function FreeLibrary(hModule:HMODULE):BOOL;cdecl;external libc_nlm name 'FreeLibrary';
+function LoadLibrary(lpFileName:LPCTSTR):HMODULE;cdecl;external libc_nlm name 'LoadLibrary';
+{
+** Prototype for libraries writing their own start-up and shut-down code.
+** This is not an interface, but only a prototype for code furnished by the
+** NLM library.
+ }
+function DllMain(hinstDLL:HINSTANCE; fdwReason:dword; lpvReserve:LPVOID):BOOL;cdecl;external libc_nlm name 'DllMain';
+
+
+// xmalloc.h
+
+function xcalloc(_para1,_para2:size_t):pointer;cdecl;external libc_nlm name 'xcalloc';
+procedure xfree(_para1:pointer);cdecl;external libc_nlm name 'xfree';
+function xmalloc(_para1:size_t):pointer;cdecl;external libc_nlm name 'xmalloc';
+function xrealloc(_para1:pointer; _para2:size_t):pointer;cdecl;external libc_nlm name 'xrealloc';
+
+
+{$ifndef INCLUDED_FROM_SYSTEM}
+
+implementation
+
+function bisecond(var a : Tdos_tm) : word;
+begin
+   bisecond:=(a.flag0 and bm_dos_tm_bisecond) shr bp_dos_tm_bisecond;
+end;
+
+procedure set_bisecond(var a : Tdos_tm; __bisecond : word);
+begin
+   a.flag0:=a.flag0 or ((__bisecond shl bp_dos_tm_bisecond) and bm_dos_tm_bisecond);
+end;
+
+function minute(var a : Tdos_tm) : word;
+begin
+   minute:=(a.flag0 and bm_dos_tm_minute) shr bp_dos_tm_minute;
+end;
+
+procedure set_minute(var a : Tdos_tm; __minute : word);
+begin
+   a.flag0:=a.flag0 or ((__minute shl bp_dos_tm_minute) and bm_dos_tm_minute);
+end;
+
+function hour(var a : Tdos_tm) : word;
+begin
+   hour:=(a.flag0 and bm_dos_tm_hour) shr bp_dos_tm_hour;
+end;
+
+procedure set_hour(var a : Tdos_tm; __hour : word);
+begin
+   a.flag0:=a.flag0 or ((__hour shl bp_dos_tm_hour) and bm_dos_tm_hour);
+end;
+
+function day(var a : Tdos_tm) : word;
+begin
+   day:=(a.flag0 and bm_dos_tm_day) shr bp_dos_tm_day;
+end;
+
+procedure set_day(var a : Tdos_tm; __day : word);
+begin
+   a.flag0:=a.flag0 or ((__day shl bp_dos_tm_day) and bm_dos_tm_day);
+end;
+
+function month(var a : Tdos_tm) : word;
+begin
+   month:=(a.flag0 and bm_dos_tm_month) shr bp_dos_tm_month;
+end;
+
+procedure set_month(var a : Tdos_tm; __month : word);
+begin
+   a.flag0:=a.flag0 or ((__month shl bp_dos_tm_month) and bm_dos_tm_month);
+end;
+
+function year(var a : Tdos_tm) : word;
+begin
+   year:=(a.flag0 and bm_dos_tm_year) shr bp_dos_tm_year;
+end;
+
+procedure set_year(var a : Tdos_tm; __year : word);
+begin
+   a.flag0:=a.flag0 or ((__year shl bp_dos_tm_year) and bm_dos_tm_year);
+end;
+
+
+end.
+{$endif}

+ 2 - 0
rtl/netwlibc/libcclib.imp

@@ -0,0 +1,2 @@
+ CLibLoadBroker,
+ CLibUnloadBroker

+ 122 - 0
rtl/netwlibc/mouse.pp

@@ -0,0 +1,122 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 Armin Diehl, member of the 
+    Free Pascal development team
+
+    Dummy Mouse unit for netware
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+{2001/04/14 armin: first version, only a dummy, i think there is no 'official' way to support
+                   a mouse under netware }
+unit Mouse;
+interface
+
+{$ifdef NOMOUSE}
+{$DEFINE NOGPM}
+{$ENDIF}
+
+{const
+  MouseEventBufSize = 16; }
+
+{$i mouseh.inc}
+
+implementation
+
+
+procedure PlaceMouseCur(ofs:longint);
+begin
+end;
+
+
+procedure InitMouse;
+begin
+end;
+
+
+procedure DoneMouse;
+begin
+end;
+
+
+function DetectMouse:byte;
+begin
+  DetectMouse:=0;
+end;
+
+
+procedure ShowMouse;
+begin
+end;
+
+
+procedure HideMouse;
+begin
+end;
+
+
+function GetMouseX:word;
+begin
+  GetMouseX:=0;
+end;
+
+
+function GetMouseY:word;
+begin
+  GetMouseY:=0;
+end;
+
+
+function GetMouseButtons:word;
+begin
+  GetMouseButtons:=0;
+end;
+
+
+procedure SetMouseXY(x,y:word);
+begin
+end;
+
+
+procedure GetMouseEvent(var MouseEvent: TMouseEvent);
+begin
+  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
+end;
+
+
+procedure PutMouseEvent(const MouseEvent: TMouseEvent);
+begin
+end;
+
+
+function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
+begin
+  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
+  exit(false);
+end;
+
+Procedure SetMouseDriver(Const Driver : TMouseDriver);
+{ Sets the mouse driver. }
+begin
+end;
+
+Procedure GetMouseDriver(Var Driver : TMouseDriver);
+{ Returns the currently active mouse driver }
+begin
+  FillChar (Driver, sizeof(Driver),0);
+end;
+
+end.
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 122 - 0
rtl/netwlibc/netware.imp

@@ -0,0 +1,122 @@
+ Abend,
+ ActivateScreen,
+ AddSearchPathAtEnd,
+ AddSoftBreakpoint,
+ AddressOfSoftBreakpoint,
+ Alloc,
+ AllocSleepOK,
+ AllocateResourceTag,
+ CSetABreakpoint,
+ CanEventBlock,
+ CheckForRegisteredEvent,
+ CheckIfScreenActive,
+ CheckKeyStatus,
+ ClearScreen,
+ CloseScreen,
+ DSAllocateEventTag,
+ DeRegisterCommand,
+ DeleteSearchPath,
+ DisableInputCursor,
+ DisplayScreenLine,
+ DisplayScreenText,
+ DisplayScreenTextWithAttribute,
+ EnableInputCursor,
+ EnterDebugger,
+ ESMAlloc,
+ ESMAllocWindow,
+ ESMCopy,
+ ESMFill,
+ ESMFree,
+ ESMFreeWindow,
+ ESMMapMemory,
+ ESMQuery,
+ EventCheck,
+ EventReport,
+ FillScreenArea,
+ FillScreenAreaAttribute,
+ Free,
+ GetActiveScreen,
+ GetActualScreenSize,
+ GetCursorStyle,
+ GetDebuggerActiveCount,
+ GetHighResolutionTimer,
+ GetInputCursorPosition,
+ GetKey,
+ GetOutputCursorPosition,
+ GetScreenAddress,
+ GetScreenName,
+ GetScreenSize,
+ GetSearchPathElement,
+ GetSetableParameterValue,
+ GetSuperHighResolutionTimer,
+ InsertSearchPath,
+ IsScreenModeSupported,
+ KernelSpinLock,
+ KernelSpinLockInit,
+ KernelSpinTryLock,
+ KernelSpinTryLockDisable,
+ KernelSpinUnlock,
+ KernelSpinUnlockRestore,
+ KillMe,
+ LoadLanguageMessageTable,
+ LoadModule,
+ NVMKernelLock,
+ NVMKernelUnlock,
+ NWGarbageCollect,
+ NWGetAvailableMemory,
+ NWGetPageSize,
+ NWMemorySizeAddressable,
+ OpenScreen,
+ OutputToScreen,
+ OutputToScreenWithAttribute,
+ OutputToScreenWithPointer,
+ ParseCommand,
+ Pause,
+ PauseWithEscape,
+ PositionInputCursor,
+ PositionOutputCursor,
+ ReadScreenCharacter,
+ RegisterCommand,
+ RegisterConsoleCommand,
+ RegisterDebugCommandParser,
+ RegisterForEventNotification,
+ RegisterTrackedResource,
+ RemoveSoftBreakpoint,
+ RestartServer,
+ RestoreFullScreen,
+ RestoreScreenArea,
+ ReturnMessageInformation,
+ ReturnScreenType,
+ RingTheBell,
+ RxIdentifyCode,
+ RxRegisterKernelResource,
+ RxRegisterSyscall,
+ RxRegisterThreadResource,
+ RxUnidentifyCode,
+ RxUnregisterKernelResource,
+ RxUnregisterSyscall,
+ RxUnregisterThreadResource,
+ SaveFullScreen,
+ SaveScreenArea,
+ ScanSetableParameters,
+ ScrollScreenArea,
+ SetAutoUnloadFlag,
+ SetCursorStyle,
+ SetInputToOutputCursorPosition,
+ SetSetableParameterValue,
+ ShowTitleBarText,
+ ShutdownServer,
+ SizeOfAllocBlock,
+ StopServer,
+ SynchronizeStart,
+ UnRegisterConsoleCommand,
+ UnRegisterDebugCommandParser,
+ UnRegisterEventNotification,
+ UnRegisterTrackedResource,
+ UngetKey,
+ UnloadModule,
+ ValidateScreenHandle,
+ WaitForKey,
+ WriteScreenCharacter,
+ WriteScreenCharacterAttribute,
+ preferredModule

+ 147 - 0
rtl/netwlibc/nwsnut.imp

@@ -0,0 +1,147 @@
+ NWSAlert,
+ NWSAlertWithHelp,
+ NWSAlloc,
+ NWSAppendBoolField,
+ NWSAppendCommentField,
+ NWSAppendGenericBoolField,
+ NWSAppendScrollableStringField,
+ NWSAppendHexField,
+ NWSAppendHotSpotField,
+ NWSAppendIntegerField,
+ NWSAppendMenuField,
+ NWSAppendPasswordField,
+ NWSAppendPromptField,
+ NWSAppendStringField,
+ NWSAppendToForm,
+ NWSAppendToList,
+ NWSAppendToMenu,
+ NWSAppendToMenuField,
+ NWSAppendUnsignedIntegerField,
+ NWSAsciiHexToInt,
+ NWSAsciiToInt,
+ NWSAsciiToLONG,
+ NWSClearPortal,
+ NWSComputePortalPosition,
+ NWSConfirm,
+ NWSCreatePortal,
+ NWSDeleteFromList,
+ NWSDeleteFromPortalList,
+ NWSDeselectPortal,
+ NWSDestroyForm,
+ NWSDestroyList,
+ NWSDestroyMenu,
+ NWSDestroyPortal,
+ NWSDisableAllFunctionKeys,
+ NWSDisableAllInterruptKeys,
+ NWSDisableFunctionKey,
+ NWSDisableInterruptKey,
+ NWSDisablePortalCursor,
+ NWSDisplayErrorCondition,
+ NWSDisplayErrorText,
+ NWSDisplayHelpScreen,
+ NWSDisplayInformation,
+ NWSDisplayInformationInPortal,
+ NWSDisplayPreHelp,
+ NWSDisplayTextInPortal,
+ NWSDisplayTextJustifiedInPortal,
+ NWSDrawPortalBorder,
+ NWSEditForm,
+ NWSEditPortalForm,
+ NWSEditPortalFormField,
+ NWSEditString,
+ NWSEditText,
+ NWSEditTextWithScrollBars,
+ NWSEnableAllFunctionKeys,
+ NWSEnableFunctionKey,
+ NWSEnableFunctionKeyList,
+ NWSEnableInterruptKey,
+ NWSEnableInterruptList,
+ NWSEnablePortalCursor,
+ NWSEndWait,
+ NWSFillPortalZone,
+ NWSFillPortalZoneAttribute,
+ NWSFree,
+ NWSGetADisk,
+ NWSGetCurrentPortal,
+ NWSGetDefaultCompare,
+ NWSGetFieldFunctionPtr,
+ NWSGetHandleCustomData,
+ NWSGetKey,
+ NWSGetLineDrawCharacter,
+ NWSGetList,
+ NWSGetListElementText,
+ NWSGetListHead,
+ NWSGetListNotifyProcedure,
+ NWSGetListSortFunction,
+ NWSGetListTail,
+ NWSGetMessage,
+ NWSGetNUTVersion,
+ NWSGetPCB,
+ NWSGetScreenPalette,
+ NWSGetSortCharacter,
+ NWSInitForm,
+ NWSInitializeNut,
+ NWSInitList,
+ NWSInitListPtr,
+ NWSInitMenu,
+ NWSInitMenuField,
+ NWSInsertInList,
+ NWSInsertInPortalList,
+ NWSIsdigit,
+ NWSIsxdigit,
+ NWSKeyStatus,
+ NWSList,
+ NWSMemmove,
+ NWSMenu,
+ NWSModifyInPortalList,
+ NWSPopHelpContext,
+ NWSPopList,
+ NWSPopMarks,
+ NWSPositionCursor,
+ NWSPositionPortalCursor,
+ NWSPromptForPassword,
+ NWSPushHelpContext,
+ NWSPushList,
+ NWSPushMarks,
+ NWSRemovePreHelp,
+ NWSRestoreDisplay,
+ NWSRestoreList,
+ NWSRestoreNut,
+ NWSRestoreZone,
+ NWSSaveFunctionKeyList,
+ NWSSaveInterruptList,
+ NWSSaveList,
+ NWSSaveZone,
+ NWSScreenSize,
+ NWSScrollPortalZone,
+ NWSScrollZone,
+ NWSSelectPortal,
+ NWSSetDefaultCompare,
+ NWSSetDynamicMessage,
+ NWSSetErrorLabelDisplayFlag,
+ NWSSetFieldFunctionPtr,
+ NWSSetFormNoWrap,
+ NWSSetHandleCustomData,
+ NWSSetHelpHelp,
+ NWSSetList,
+ NWSSetListNotifyProcedure,
+ NWSSetListSortFunction,
+ NWSSetScreenPalette,
+ NWSSetScrollableFieldInsertProc,
+ NWSShowLine,
+ NWSShowLineAttribute,
+ NWSShowPortalLine,
+ NWSShowPortalLineAttribute,
+ NWSSortList,
+ NWSStartWait,
+ NWSStrcat,
+ NWSToupper,
+ NWSTrace,
+ NWSUngetKey,
+ NWSUnmarkList,
+ NWSUpdatePortal,
+ NWSViewText,
+ NWSViewTextWithScrollBars,
+ NWSWaitForEscape,
+ NWSWaitForEscapeOrCancel,
+ NWSWaitForKeyAndValue

+ 9 - 0
rtl/netwlibc/nwsnut.pp

@@ -0,0 +1,9 @@
+{$I ../netware/nwsnut.pp}
+
+
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

BIN
rtl/netwlibc/pre/libcpre.gcc.o


+ 1 - 0
rtl/netwlibc/qos.inc

@@ -0,0 +1 @@
+{$i ../netware/qos.inc}

+ 1007 - 0
rtl/netwlibc/system.pp

@@ -0,0 +1,1007 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+    System.pp for Netware libc environment
+ **********************************************************************}
+{ no stack check in system }
+{$S-}
+unit system;
+
+interface
+
+{$define netware}
+{$define netware_libc}
+
+{$define StdErrToConsole}
+{$define autoHeapRelease}
+{$define IOpossix}
+{$define DisableArrayOfConst}
+
+{$ifdef SYSTEMDEBUG}
+  {$define SYSTEMEXCEPTIONDEBUG}
+{$endif SYSTEMDEBUG}
+
+{$ifdef cpui386}
+  {$define Set_i386_Exception_handler}
+{$endif cpui386}
+
+{ include system-independent routine headers }
+
+{$I systemh.inc}
+
+type THandle = DWord;
+
+{Platform specific information}
+const
+ LineEnding = #13#10;
+ LFNSupport : boolean = false;
+ DirectorySeparator = '/';
+ DriveSeparator = ':';
+ PathSeparator = ';';
+{ FileNameCaseSensitive is defined separately below!!! }
+ maxExitCode = $ffff;
+
+
+{ include heap support headers }
+{$I heaph.inc}
+
+CONST
+  { Default filehandles }
+   UnusedHandle    : THandle = -1;
+   StdInputHandle  : THandle = 0;
+   StdOutputHandle : THandle = 0;
+   StdErrorHandle  : THandle = 0;
+
+   FileNameCaseSensitive : boolean = false;
+
+   sLineBreak = LineEnding;
+   DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
+
+TYPE
+   TNWCheckFunction = procedure (var code : longint);
+
+VAR
+   ArgC   : INTEGER;
+   ArgV   : ppchar;
+   NetwareCheckFunction    : TNWCheckFunction;
+   NetwareMainThreadGroupID: longint;
+   NetwareCodeStartAddress : dword;
+
+
+CONST
+   envp   : ppchar = nil;
+
+
+
+{type
+  TSysCloseAllRemainingSemaphores = procedure;
+  TSysReleaseThreadVars = procedure;
+  TSysSetThreadDataAreaPtr = function (newPtr:pointer):pointer;
+
+procedure NWSysSetThreadFunctions (crs:TSysCloseAllRemainingSemaphores;
+                                   rtv:TSysReleaseThreadVars;
+				   stdata:TSysSetThreadDataAreaPtr);
+}
+
+implementation
+{ Indicate that stack checking is taken care by OS}
+{$DEFINE NO_GENERIC_STACK_CHECK}
+
+{ include system independent routines }
+{$I system.inc}
+
+{ some declarations for Netware API calls }
+{ I nwlibc.inc}
+{$I errno.inc}
+{$define INCLUDED_FROM_SYSTEM}
+{$I libc.pp}
+
+
+var
+  HeapAllocResourceTag,HeapListAllocResourceTag : rtag_t;
+  NLMHandle : pointer;
+  {$ifdef StdErrToConsole}
+  NWLoggerScreen : Tscr;
+  {$endif}
+  {CloseAllRemainingSemaphores : TSysCloseAllRemainingSemaphores = nil;
+  ReleaseThreadVars : TSysReleaseThreadVars = nil;
+  SetThreadDataAreaPtr : TSysSetThreadDataAreaPtr = nil;
+
+procedure NWSysSetThreadFunctions (crs:TSysCloseAllRemainingSemaphores;
+                                   rtv:TSysReleaseThreadVars;
+				   stdata:TSysSetThreadDataAreaPtr);
+begin
+  CloseAllRemainingSemaphores := crs;
+  ReleaseThreadVars := rtv;
+  SetThreadDataAreaPtr := stdata;
+end;}
+
+
+
+
+procedure PASCALMAIN;external name 'PASCALMAIN';
+procedure fpc_do_exit;external name 'FPC_DO_EXIT';
+
+
+{*****************************************************************************
+                         System Dependent Exit code
+*****************************************************************************}
+
+{$ifdef autoHeapRelease}
+procedure FreeSbrkMem; forward;
+{$endif}
+
+var SigTermHandlerActive : boolean;
+
+Procedure system_exit;
+begin
+  //if assigned (CloseAllRemainingSemaphores) then CloseAllRemainingSemaphores;
+  //if assigned (ReleaseThreadVars) then ReleaseThreadVars;
+
+  {$ifdef autoHeapRelease}
+  FreeSbrkMem;            { free memory allocated by heapmanager }
+  {$endif}
+
+  if not SigTermHandlerActive then
+  begin
+    //if ExitCode <> 0 Then   { otherwise we dont see runtime-errors }
+    //  _SetAutoScreenDestructionMode (false);
+
+    _exit (ExitCode);
+  end;
+end;
+
+{*****************************************************************************
+                         Stack check code
+*****************************************************************************}
+
+const StackErr : boolean = false;
+
+procedure int_stackcheck(stack_size:Cardinal);[saveregisters,public,alias:'FPC_STACKCHECK'];
+{
+  called when trying to get local stack if the compiler directive $S
+  is set this function must preserve all registers
+
+  With a 2048 byte safe area used to write to StdIo without crossing
+  the stack boundary
+}
+begin
+  if StackErr then exit;  // avoid recursive calls
+  if stackavail > stack_size + 2048 THEN EXIT;
+  StackErr := true;
+  HandleError (202);
+end;
+{*****************************************************************************
+                              ParamStr/Randomize
+*****************************************************************************}
+
+{ number of args }
+function paramcount : longint;
+begin
+  paramcount := argc - 1;
+end;
+
+{ argument number l }
+function paramstr(l : longint) : string;
+begin
+  if (l>=0) and (l+1<=argc) then
+  begin
+    paramstr:=strpas(argv[l]);
+    if l = 0 then  // fix nlm path
+    begin
+      for l := 1 to length (paramstr) do
+        if paramstr[l] = '\' then paramstr[l] := '/';
+    end;
+  end else
+   paramstr:='';
+end;
+
+{ set randseed to a new pseudo random value }
+procedure randomize;
+begin
+  randseed := time (NIL);
+end;
+
+{*****************************************************************************
+                              Heap Management
+*****************************************************************************}
+
+var
+  heap : longint;external name 'HEAP';
+  intern_heapsize : longint;external name 'HEAPSIZE';
+
+{ first address of heap }
+function getheapstart:pointer;
+assembler;
+asm
+        leal    HEAP,%eax
+end ['EAX'];
+
+{ current length of heap }
+function getheapsize:longint;
+assembler;
+asm
+        movl    intern_HEAPSIZE,%eax
+end ['EAX'];
+
+{$ifdef autoHeapRelease}
+
+const HeapInitialMaxBlocks = 32;
+type THeapSbrkBlockList = array [1.. HeapInitialMaxBlocks] of pointer;
+var  HeapSbrkBlockList : ^THeapSbrkBlockList = nil;
+     HeapSbrkLastUsed  : dword = 0;
+     HeapSbrkAllocated : dword = 0;
+
+{ function to allocate size bytes more for the program }
+{ must return the first address of new data space or nil if fail }
+{ for netware all allocated blocks are saved to free them at }
+{ exit (to avoid message "Module did not release xx resources") }
+Function SysOSAlloc(size : longint):pointer;
+var P2 : POINTER;
+    i  : longint;
+    Slept : longint;
+begin
+  SysOSAlloc := _Alloc (size,HeapAllocResourceTag);
+  if SysOSAlloc <> nil then begin
+    if HeapSbrkBlockList = nil then
+    begin
+      Pointer (HeapSbrkBlockList) := _Alloc (sizeof (HeapSbrkBlockList^),HeapListAllocResourceTag);
+      if HeapSbrkBlockList = nil then
+      begin
+        _free (SysOSAlloc);
+        SysOSAlloc := nil;
+        exit;
+      end;
+      fillchar (HeapSbrkBlockList^,sizeof(HeapSbrkBlockList^),0);
+      HeapSbrkAllocated := HeapInitialMaxBlocks;
+    end;
+    if (HeapSbrkLastUsed > 0) then
+      for i := 1 to HeapSbrkLastUsed do
+        if (HeapSbrkBlockList^[i] = nil) then
+        begin  // reuse free slot
+          HeapSbrkBlockList^[i] := SysOSAlloc;
+          exit;
+        end;
+    if (HeapSbrkLastUsed = HeapSbrkAllocated) then
+    begin  { grow }
+      slept := 0;
+      p2 := _ReallocSleepOK (HeapSbrkBlockList, (HeapSbrkAllocated + HeapInitialMaxBlocks) * sizeof(pointer),HeapListAllocResourceTag,Slept);
+      if p2 = nil then  // should we better terminate with error ?
+      begin
+        _free (SysOSAlloc);
+        SysOSAlloc := nil;
+        exit;
+      end;
+      HeapSbrkBlockList := p2;
+      inc (HeapSbrkAllocated, HeapInitialMaxBlocks);
+    end;
+    inc (HeapSbrkLastUsed);
+    HeapSbrkBlockList^[HeapSbrkLastUsed] := SysOSAlloc;
+  end;
+end;
+
+
+procedure FreeSbrkMem;
+var i : longint;
+begin
+  if HeapSbrkBlockList <> nil then
+  begin
+    for i := 1 to HeapSbrkLastUsed do
+      if (HeapSbrkBlockList^[i] <> nil) then
+        _free (HeapSbrkBlockList^[i]);
+    _free (HeapSbrkBlockList);
+    HeapSbrkAllocated := 0;
+    HeapSbrkLastUsed := 0;
+    HeapSbrkBlockList := nil;
+  end;
+end;
+
+{*****************************************************************************
+      OS Memory allocation / deallocation
+ ****************************************************************************}
+
+{$define HAS_SYSOSFREE}
+
+procedure SysOSFree(p: pointer; size: ptrint);
+var i : longint;
+begin
+//fpmunmap(p, size);
+  if (HeapSbrkLastUsed > 0) then
+    for i := 1 to HeapSbrkLastUsed do
+      if (HeapSbrkBlockList^[i] = p) then
+      begin
+        _free (p);
+        HeapSbrkBlockList^[i] := nil;
+        exit;
+      end;
+  HandleError (204);  // invalid pointer operation
+end;
+
+{$else autoHeapRelease}
+
+{$define HAS_SYSOSFREE}
+
+procedure SysOSFree(p: pointer; size: ptrint);
+begin
+  _free (p);
+end;
+
+function SysOSAlloc(size: ptrint): pointer;
+begin
+  writeln ('Alloc ',size,' bytes');
+  SysOSAlloc := _Alloc(size,HeapAllocResourceTag);
+end;
+
+{$endif autoHeapRelease}
+
+{ include standard heap management }
+{$I heap.inc}
+
+
+{****************************************************************************
+                        Low level File Routines
+       All these functions can set InOutRes on errors
+ ****************************************************************************}
+
+
+PROCEDURE NW2PASErr (Err : LONGINT);
+BEGIN
+  if Err = 0 then { Else it will go through all the cases }
+   exit;
+  case Err of
+   Sys_ENFILE,
+   Sys_EMFILE : Inoutres:=4;
+   Sys_ENOENT : Inoutres:=2;
+    Sys_EBADF : Inoutres:=6;
+   Sys_ENOMEM,
+   Sys_EFAULT : Inoutres:=217;
+   Sys_EINVAL : Inoutres:=218;
+    Sys_EPIPE,
+    Sys_EINTR,
+      Sys_EIO,
+   Sys_EAGAIN,
+   Sys_ENOSPC : Inoutres:=101;
+ Sys_ENAMETOOLONG,
+    Sys_ELOOP,
+  Sys_ENOTDIR : Inoutres:=3;
+    Sys_EROFS,
+   Sys_EEXIST,
+   Sys_EACCES : Inoutres:=5;
+  Sys_EBUSY   : Inoutres:=162;
+  end;
+END;
+
+FUNCTION errno : LONGINT;
+BEGIN
+  errno := ___errno^;
+END;
+
+PROCEDURE Errno2Inoutres;
+BEGIN
+  NW2PASErr (errno);
+END;
+
+PROCEDURE SetFileError (VAR Err : LONGINT);
+BEGIN
+  IF Err >= 0 THEN
+    InOutRes := 0
+  ELSE
+  BEGIN
+    libc_perror ('SetFileError');
+    Err := errno;
+    NW2PASErr (Err);
+    Err := 0;
+  END;
+END;
+
+{ close a file from the handle value }
+procedure do_close(handle : thandle);
+VAR res : LONGINT;
+begin
+  {$ifdef IOpossix}
+  res := FpClose (handle);
+  {$else}
+  res := _fclose (_TFILE(handle));
+  {$endif}
+  IF res <> 0 THEN
+    SetFileError (res)
+  ELSE
+    InOutRes := 0;
+end;
+
+procedure do_erase(p : pchar);
+VAR res : LONGINT;
+begin
+  res := unlink (p);
+  IF Res < 0 THEN
+    SetFileError (res)
+  ELSE
+    InOutRes := 0;
+end;
+
+procedure do_rename(p1,p2 : pchar);
+VAR res : LONGINT;
+begin
+  res := rename (p1,p2);
+  IF Res < 0 THEN
+    SetFileError (res)
+  ELSE
+    InOutRes := 0
+end;
+
+function do_write(h:thandle;addr:pointer;len : longint) : longint;
+var res : LONGINT;
+begin
+  {$ifdef IOpossix}
+  res := libc_write  (h,addr,len);
+  {$else}
+  res := _fwrite (addr,1,len,_TFILE(h));
+  {$endif}
+  if res > 0 then
+    InOutRes := 0
+  else
+    SetFileError (res);
+  do_write := res;
+end;
+
+function do_read(h:thandle;addr:pointer;len : longint) : longint;
+VAR res : LONGINT;
+begin
+  {$ifdef IOpossix}
+  res := libc_write  (h,addr,len);
+  {$else}
+  res := _fread (addr,1,len,_TFILE(h));
+  {$endif}
+  IF res > 0 THEN
+    InOutRes := 0
+  ELSE
+    SetFileError (res);
+  do_read := res;
+end;
+
+
+function do_filepos(handle : thandle) : longint;
+var res : LONGINT;
+begin
+  InOutRes:=1;
+  {$ifdef IOpossix}
+  res := tell (handle);
+  {$else}
+  res := _ftell (_TFILE(handle));
+  {$endif}
+  if res < 0 THEN
+    SetFileError (res)
+  else
+    InOutRes := 0;
+  do_filepos := res;
+end;
+
+
+procedure do_seek(handle:thandle;pos : longint);
+VAR res : LONGINT;
+begin
+  {$ifdef IOpossix}
+  res := lseek (handle,pos, SEEK_SET);
+  {$else}
+  res := _fseek (_TFILE(handle),pos, SEEK_SET);
+  {$endif}
+  IF res >= 0 THEN
+    InOutRes := 0
+  ELSE
+    SetFileError (res);
+end;
+
+function do_seekend(handle:thandle):longint;
+VAR res : LONGINT;
+begin
+  {$ifdef IOpossix}
+  res := lseek (handle,0, SEEK_END);
+  {$else}
+  res := _fseek (_TFILE(handle),0, SEEK_END);
+  {$endif}
+  IF res >= 0 THEN
+    InOutRes := 0
+  ELSE
+    SetFileError (res);
+  do_seekend := res;
+end;
+
+
+function do_filesize(handle : thandle) : longint;
+VAR res     : LONGINT;
+    statbuf : TStat;
+begin
+  {$ifdef IOpossix}
+  res := fstat (handle, statbuf);
+  {$else}
+  res := _fstat (_fileno (_TFILE(handle)), statbuf);  // was _filelength for clib
+  {$endif}
+  if res <> 0 then
+  begin
+    SetFileError (Res);
+    do_filesize := -1;
+  end else
+  begin
+    InOutRes := 0;
+    do_filesize := statbuf.st_size;
+  end;
+end;
+
+{ truncate at a given position }
+procedure do_truncate (handle:thandle;pos:longint);
+VAR res : LONGINT;
+begin
+  {$ifdef IOpossix}
+  res := ftruncate (handle,pos);
+  {$else}
+  res := _ftruncate (_fileno (_TFILE(handle)),pos);
+  {$endif}
+  IF res <> 0 THEN
+    SetFileError (res)
+  ELSE
+    InOutRes := 0;
+end;
+
+{$ifdef IOpossix}
+// mostly stolen from syslinux
+procedure do_open(var f;p:pchar;flags:longint);
+{
+  filerec and textrec have both handle and mode as the first items so
+  they could use the same routine for opening/creating.
+  when (flags and $10)   the file will be append
+  when (flags and $100)  the file will be truncate/rewritten
+  when (flags and $1000) there is no check for close (needed for textfiles)
+}
+var
+  oflags : longint;
+Begin
+{ close first if opened }
+  if ((flags and $10000)=0) then
+   begin
+     case FileRec(f).mode of
+      fminput,fmoutput,fminout : Do_Close(FileRec(f).Handle);
+      fmclosed : ;
+     else
+      begin
+        inoutres:=102; {not assigned}
+        exit;
+      end;
+     end;
+   end;
+{ reset file Handle }
+  FileRec(f).Handle:=UnusedHandle;
+
+{ We do the conversion of filemodes here, concentrated on 1 place }
+  case (flags and 3) of
+   0 : begin
+         oflags := O_RDONLY;
+         filerec(f).mode := fminput;
+       end;
+   1 : begin
+         oflags := O_WRONLY;
+         filerec(f).mode := fmoutput;
+       end;
+   2 : begin
+         oflags := O_RDWR;
+         filerec(f).mode := fminout;
+       end;
+  end;
+  if (flags and $1000)=$1000 then
+   oflags:=oflags or (O_CREAT or O_TRUNC)
+  else
+   if (flags and $100)=$100 then
+    oflags:=oflags or (O_APPEND);
+{ empty name is special }
+  if p[0]=#0 then
+   begin
+     case FileRec(f).mode of
+       fminput :
+         FileRec(f).Handle:=StdInputHandle;
+       fminout, { this is set by rewrite }
+       fmoutput :
+         FileRec(f).Handle:=StdOutputHandle;
+       fmappend :
+         begin
+           FileRec(f).Handle:=StdOutputHandle;
+           FileRec(f).mode:=fmoutput; {fool fmappend}
+         end;
+     end;
+     exit;
+   end;
+{ real open call }
+  FileRec(f).Handle := open(p,oflags,438);
+  //WriteLn ('_open (',p,') returned ',ErrNo, 'Handle: ',FileRec(f).Handle);
+  // errno does not seem to be set on succsess ??
+  IF FileRec(f).Handle < 0 THEN
+    if (ErrNo=Sys_EROFS) and ((OFlags and O_RDWR)<>0) then
+    begin  // i.e. for cd-rom
+      Oflags:=Oflags and not(O_RDWR);
+      FileRec(f).Handle := open(p,oflags,438);
+    end;
+  IF FileRec(f).Handle < 0 THEN
+    Errno2Inoutres
+  ELSE
+    InOutRes := 0;
+End;
+
+
+{$else}
+procedure do_open(var f;p:pchar;flags:longint);
+{
+  filerec and textrec have both handle and mode as the first items so
+  they could use the same routine for opening/creating.
+  when (flags and $10)   the file will be append
+  when (flags and $100)  the file will be truncate/rewritten
+  when (flags and $1000) there is no check for close (needed for textfiles)
+}
+var
+  oflags : string[10];
+Begin
+{ close first if opened }
+  if ((flags and $10000)=0) then
+   begin
+     case FileRec(f).mode of
+      fminput,fmoutput,fminout : Do_Close(FileRec(f).Handle);
+      fmclosed : ;
+     else
+      begin
+        inoutres:=102; {not assigned}
+        exit;
+      end;
+     end;
+   end;
+{ reset file Handle }
+  FileRec(f).Handle:=UnusedHandle;
+
+{ We do the conversion of filemodes here, concentrated on 1 place }
+  case (flags and 3) of
+   0 : begin
+         oflags := 'rb'#0;
+         filerec(f).mode := fminput;
+       end;
+   1 : begin
+         if (flags and $1000)=$1000 then
+	   oflags := 'w+b' else
+           oflags := 'wb';
+         filerec(f).mode := fmoutput;
+       end;
+   2 : begin
+         if (flags and $1000)=$1000 then
+	   oflags := 'w+' else
+           oflags := 'r+';
+         filerec(f).mode := fminout;
+       end;
+  end;
+  {if (flags and $1000)=$1000 then
+   oflags:=oflags or (O_CREAT or O_TRUNC)
+  else
+   if (flags and $100)=$100 then
+    oflags:=oflags or (O_APPEND);}
+{ empty name is special }
+  if p[0]=#0 then
+   begin
+     case FileRec(f).mode of
+       fminput :
+         FileRec(f).Handle:=StdInputHandle;
+       fminout, { this is set by rewrite }
+       fmoutput :
+         FileRec(f).Handle:=StdOutputHandle;
+       fmappend :
+         begin
+           FileRec(f).Handle:=StdOutputHandle;
+           FileRec(f).mode:=fmoutput; {fool fmappend}
+         end;
+     end;
+     exit;
+   end;
+{ real open call }
+  FileRec(f).Handle := THandle (_fopen (p,@oflags[1]));//_open(p,oflags,438);
+  //WriteLn ('_open (',p,') returned ',ErrNo, 'Handle: ',FileRec(f).Handle);
+  // errno does not seem to be set on succsess ??
+  {IF FileRec(f).Handle < 0 THEN
+    if (ErrNo=Sys_EROFS) and ((OFlags and O_RDWR)<>0) then
+    begin  // i.e. for cd-rom
+      Oflags:=Oflags and not(O_RDWR);
+      FileRec(f).Handle := _open(p,oflags,438);
+    end;}
+  if FileRec(f).Handle = 0 then
+    Errno2Inoutres
+  else
+    InOutRes := 0;
+End;
+{$endif}
+
+function do_isdevice(handle:THandle):boolean;
+begin
+  {$ifdef IOpossix}
+  do_isdevice := (isatty (handle) > 0);
+  {$else}
+  do_isdevice := (isatty (_fileno(_TFILE(handle))) > 0);
+  {$endif}
+end;
+
+
+{*****************************************************************************
+                           UnTyped File Handling
+*****************************************************************************}
+
+{$i file.inc}
+
+{*****************************************************************************
+                           Typed File Handling
+*****************************************************************************}
+
+{$i typefile.inc}
+
+{*****************************************************************************
+                           Text File Handling
+*****************************************************************************}
+
+{ should we consider #26 as the  end of a file ? }
+{?? $DEFINE EOF_CTRLZ}
+
+{$i text.inc}
+
+{*****************************************************************************
+                           Directory Handling
+*****************************************************************************}
+procedure mkdir(const s : string);[IOCheck];
+VAR S2 : STRING;
+    Res: LONGINT;
+BEGIN
+  S2 := S;
+  IF Length (S2) = 255 THEN DEC (BYTE(S2[0]));
+  S2 := S2 + #0;
+  Res := FpMkdir (@S2[1],0);
+  IF Res = 0 THEN
+    InOutRes:=0
+  ELSE
+    SetFileError (Res);
+END;
+
+procedure rmdir(const s : string);[IOCheck];
+VAR S2 : STRING;
+    Res: LONGINT;
+BEGIN
+  S2 := S;
+  IF Length (S2) = 255 THEN DEC (BYTE(S2[0]));
+  S2 := S2 + #0;
+  Res := FpRmdir (@S2[1]);
+  IF Res = 0 THEN
+    InOutRes:=0
+  ELSE
+    SetFileError (Res);
+end;
+
+procedure chdir(const s : string);[IOCheck];
+VAR S2 : STRING;
+    Res: LONGINT;
+begin
+  S2 := S;
+  IF Length (S2) = 255 THEN DEC (BYTE(S2[0]));
+  S2 := S2 + #0;
+  Res := FpChdir (@S2[1]);
+  IF Res = 0 THEN
+    InOutRes:=0
+  ELSE
+    SetFileError (Res);
+end;
+
+procedure getdir(drivenr : byte;var dir : shortstring);
+VAR P : ARRAY [0..255] OF CHAR;
+    i : LONGINT;
+begin
+  P[0] := #0;
+  getcwd (@P, SIZEOF (P));
+  i := libc_strlen (P);
+  if i > 0 then
+  begin
+    Move (P, dir[1], i);
+    BYTE(dir[0]) := i;
+    For i := 1 to length (dir) do
+      if dir[i] = '\' then dir [i] := '/';
+    // fix / after volume, the compiler needs that
+    // normaly root of a volumes is SERVERNAME/SYS:, change that
+    // to SERVERNAME/SYS:/
+    i := pos (':',dir);
+    if (i > 0) then
+      if i = Length (dir) then dir := dir + '/' else
+      if dir [i+1] <> '/' then insert ('/',dir,i+1);
+  END ELSE
+    InOutRes := 1;
+end;
+
+
+{*****************************************************************************
+                             Thread Handling
+*****************************************************************************}
+
+procedure InitFPU;assembler;
+
+  asm
+     fninit
+     fldcw   fpucw
+  end;
+
+
+{ if return-value is <> 0, netware shows the message
+  Unload Anyway ?
+  To Disable unload at all, SetNLMDontUnloadFlag can be used on
+  Netware >= 4.0 }
+(*
+function CheckFunction : longint; CDECL; [public,alias: 'FPC_NW_CHECKFUNCTION'];
+var oldTG:longint;
+    oldPtr: pointer;
+begin
+  if assigned (NetwareCheckFunction) then
+  begin
+    { this function is called without clib context, to allow clib
+      calls, we set the thread group id before calling the
+      user-function }
+    //oldTG := _SetThreadGroupID (NetwareMainThreadGroupID);
+    { to allow use of threadvars, we simply set the threadvar-memory
+      from the main thread }
+    //if assigned (SetThreadDataAreaPtr) then
+    //  oldPtr := SetThreadDataAreaPtr (NIL);  { nil means main threadvars }
+    result := 0;
+    NetwareCheckFunction (result);
+    if assigned (SetThreadDataAreaPtr) then
+      SetThreadDataAreaPtr (oldPtr);
+
+    _SetThreadGroupID (oldTG);
+  end else
+    result := 0;
+end;
+*)
+
+
+{$ifdef StdErrToConsole}
+var ConsoleBuff : array [0..512] of char;
+
+Function ConsoleWrite(Var F: TextRec): Integer;
+var
+  i : longint;
+Begin
+  if F.BufPos>0 then
+  begin
+     if F.BufPos>sizeof(ConsoleBuff)-1 then
+       i:=sizeof(ConsoleBuff)-1
+     else
+       i:=F.BufPos;
+     Move(F.BufPtr^,ConsoleBuff,i);
+     ConsoleBuff[i] := #0;
+     screenprintf (NWLoggerScreen,@ConsoleBuff);
+  end;
+  F.BufPos:=0;
+  ConsoleWrite := 0;
+End;
+
+
+Function ConsoleClose(Var F: TextRec): Integer;
+begin
+  ConsoleClose:=0;
+end;
+
+
+Function ConsoleOpen(Var F: TextRec): Integer;
+Begin
+  TextRec(F).InOutFunc:=@ConsoleWrite;
+  TextRec(F).FlushFunc:=@ConsoleWrite;
+  TextRec(F).CloseFunc:=@ConsoleClose;
+  ConsoleOpen:=0;
+End;
+
+
+procedure AssignStdErrConsole(Var T: Text);
+begin
+  Assign(T,'');
+  TextRec(T).OpenFunc:=@ConsoleOpen;
+  Rewrite(T);
+end;
+{$endif}
+
+
+{ this will be called if the nlm is unloaded. It will NOT be
+  called if the program exits i.e. with halt.
+  Halt (or _exit) can not be called from this callback procedure }
+procedure TermSigHandler (Sig:longint); CDecl;
+begin
+  writeln ('TermSigHandler start ');
+  { _GetThreadDataAreaPtr will not be valid because the signal
+    handler is called by netware with a differnt thread. To avoid
+    problems in the exit routines, we set the data of the main thread
+    here }
+  SigTermHandlerActive := true;  { to avoid that system_exit calls _exit }
+  do_exit;                       { calls finalize units }
+  writeln ('TermSigHandler end ');
+end;
+
+
+procedure SysInitStdIO;
+begin
+{ Setup stdin, stdout and stderr }
+  {$ifdef IOpossix}
+  StdInputHandle := THandle (fileno (___stdin^));    // GetStd** returns **FILE !
+  StdOutputHandle:= THandle (fileno (___stdout^));
+  StdErrorHandle := THandle (fileno (___stderr^));
+  {$else}
+  StdInputHandle := THandle (___stdin^);    // GetStd** returns **FILE !
+  StdOutputHandle:= THandle (___stdout^);
+  StdErrorHandle := THandle (___stderr^);
+  {$endif}
+
+  OpenStdIO(Input,fmInput,StdInputHandle);
+  OpenStdIO(Output,fmOutput,StdOutputHandle);
+  OpenStdIO(StdOut,fmOutput,StdOutputHandle);
+
+  {$ifdef StdErrToConsole}
+  AssignStdErrConsole(StdErr);
+  {$else}
+  OpenStdIO(StdErr,fmOutput,StdErrorHandle);
+  {$endif}
+end;
+
+procedure nlm_main (_ArgC : LONGINT; _ArgV : ppchar); cdecl; [public,alias: 'main'];
+BEGIN
+  ArgC := _ArgC;
+  ArgV := _ArgV;
+  PASCALMAIN;
+END;
+
+
+{*****************************************************************************
+                         SystemUnit Initialization
+*****************************************************************************}
+
+Begin
+  StackBottom := SPtr - StackLength;
+  SigTermHandlerActive := false;
+  NetwareCheckFunction := nil;
+  {$ifdef StdErrToConsole}
+  NWLoggerScreen := getnetwarelogger;
+  {$endif}
+
+  envp := nxGetEnviron;
+  NLMHandle := getnlmhandle;
+  HeapAllocResourceTag :=
+    AllocateResourceTag(NLMHandle,'Heap Memory',AllocSignature);
+  HeapListAllocResourceTag :=
+    AllocateResourceTag(NLMHandle,'Heap Memory List',AllocSignature);
+  Signal (SIGTERM, @TermSigHandler);
+
+{ Setup heap }
+  InitHeap;
+  SysInitExceptions;
+
+{ Reset IO Error }
+  InOutRes:=0;
+
+(* This should be changed to a real value during *)
+(* thread driver initialization if appropriate.  *)
+  ThreadID := 1;
+
+  SysInitStdIO;
+
+{Delphi Compatible}
+  IsLibrary := FALSE;
+  IsConsole := TRUE;
+  ExitCode  := 0;
+{$ifdef HASVARIANT}
+  initvariantmanager;
+{$endif HASVARIANT}
+End.
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 481 - 0
rtl/netwlibc/systhrds.pp

@@ -0,0 +1,481 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2002 by Peter Vreman,
+    member of the Free Pascal development team.
+
+    netware (pthreads) threading support implementation
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+{$mode objfpc}
+
+unit systhrds;
+interface
+{$S-}
+
+//Procedure SetCThreadManager;
+
+{ Posix compliant definition }
+
+uses Libc;
+
+type
+  PRTLCriticalSection = Ppthread_mutex_t;
+  TRTLCriticalSection = pthread_mutex_t;
+
+
+{$i threadh.inc}
+
+implementation
+
+
+{*****************************************************************************
+                             Generic overloaded
+*****************************************************************************}
+
+{$i thread.inc}
+
+{*****************************************************************************
+                             Threadvar support
+*****************************************************************************}
+
+{$ifdef HASTHREADVAR}
+    const
+      threadvarblocksize : dword = 0;
+
+    var
+      TLSKey : pthread_key_t;
+      ThVarAllocResourceTag : rtag_t;
+
+    procedure SysInitThreadvar(var offset : dword;size : dword);
+      begin
+        offset:=threadvarblocksize;
+        inc(threadvarblocksize,size);
+      end;
+
+    function SysRelocateThreadvar(offset : dword) : pointer;
+      begin
+        SysRelocateThreadvar:=pthread_getspecific(tlskey)+Offset;
+      end;
+
+
+    procedure SysAllocateThreadVars;
+      var
+        dataindex : pointer;
+      begin
+        { we've to allocate the memory from system  }
+        { because the FPC heap management uses      }
+        { exceptions which use threadvars but       }
+        { these aren't allocated yet ...            }
+        { allocate room on the heap for the thread vars }
+        DataIndex:=_Alloc(threadvarblocksize,ThVarAllocResourceTag);
+        //DataIndex:=Pointer(Fpmmap(nil,threadvarblocksize,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0));
+        FillChar(DataIndex^,threadvarblocksize,0);
+        pthread_setspecific(tlskey,dataindex);
+      end;
+
+
+    procedure SysReleaseThreadVars;
+      begin
+        _Free (pthread_getspecific(tlskey));
+      end;
+
+{ Include OS independent Threadvar initialization }
+{$i threadvr.inc}
+
+
+{$endif HASTHREADVAR}
+
+
+{*****************************************************************************
+                            Thread starting
+*****************************************************************************}
+
+    type
+      pthreadinfo = ^tthreadinfo;
+      tthreadinfo = record
+        f : tthreadfunc;
+        p : pointer;
+        stklen : cardinal;
+      end;
+
+    procedure DoneThread;
+      begin
+        { Release Threadvars }
+{$ifdef HASTHREADVAR}
+        SysReleaseThreadVars;
+{$endif HASTHREADVAR}
+      end;
+
+
+    function ThreadMain(param : pointer) : pointer;cdecl;
+      var
+        ti : tthreadinfo;
+{$ifdef DEBUG_MT}
+        // in here, don't use write/writeln before having called
+        // InitThread! I wonder if anyone ever debugged these routines,
+        // because they will have crashed if DEBUG_MT was enabled!
+        // this took me the good part of an hour to figure out
+        // why it was crashing all the time!
+        // this is kind of a workaround, we simply write(2) to fd 0
+        s: string[100]; // not an ansistring
+{$endif DEBUG_MT}
+      begin
+{$ifdef DEBUG_MT}
+        s := 'New thread started, initing threadvars'#10;
+        fpwrite(0,s[1],length(s));
+{$endif DEBUG_MT}
+{$ifdef HASTHREADVAR}
+        { Allocate local thread vars, this must be the first thing,
+          because the exception management and io depends on threadvars }
+        SysAllocateThreadVars;
+{$endif HASTHREADVAR}
+        { Copy parameter to local data }
+{$ifdef DEBUG_MT}
+        s := 'New thread started, initialising ...'#10;
+        fpwrite(0,s[1],length(s));
+{$endif DEBUG_MT}
+        ti:=pthreadinfo(param)^;
+        dispose(pthreadinfo(param));
+        { Initialize thread }
+        InitThread(ti.stklen);
+        { Start thread function }
+{$ifdef DEBUG_MT}
+        writeln('Jumping to thread function');
+{$endif DEBUG_MT}
+        ThreadMain:=pointer(ti.f(ti.p));
+        DoneThread;
+	pthread_detach(pointer(pthread_self));
+      end;
+
+
+    function SysBeginThread(sa : Pointer;stacksize : dword;
+                         ThreadFunction : tthreadfunc;p : pointer;
+                         creationFlags : dword; var ThreadId : THandle) : DWord;
+      var
+        ti : pthreadinfo;
+        thread_attr : pthread_attr_t;
+      begin
+{$ifdef DEBUG_MT}
+        writeln('Creating new thread');
+{$endif DEBUG_MT}
+        { Initialize multithreading if not done }
+        if not IsMultiThread then
+         begin
+{$ifdef HASTHREADVAR}
+          { We're still running in single thread mode, setup the TLS }
+           pthread_key_create(@TLSKey,nil);
+           InitThreadVars(@SysRelocateThreadvar);
+{$endif HASTHREADVAR}
+           IsMultiThread:=true;
+         end;
+        { the only way to pass data to the newly created thread
+          in a MT safe way, is to use the heap }
+        getmem(ti,sizeof(pthreadinfo));
+        ti^.f:=ThreadFunction;
+        ti^.p:=p;
+        ti^.stklen:=stacksize;
+        { call pthread_create }
+{$ifdef DEBUG_MT}
+        writeln('Starting new thread');
+{$endif DEBUG_MT}
+        pthread_attr_init(@thread_attr);
+        pthread_attr_setinheritsched(@thread_attr, PTHREAD_EXPLICIT_SCHED);
+
+        // will fail under linux -- apparently unimplemented
+        pthread_attr_setscope(@thread_attr, PTHREAD_SCOPE_PROCESS);
+
+        // don't create detached, we need to be able to join (waitfor) on
+        // the newly created thread!
+        //pthread_attr_setdetachstate(@thread_attr, PTHREAD_CREATE_DETACHED);
+        if pthread_create(@threadid, @thread_attr, @ThreadMain,ti) <> 0 then begin
+          threadid := 0;
+        end;
+        SysBeginThread:=threadid;
+{$ifdef DEBUG_MT}
+        writeln('BeginThread returning ',SysBeginThread);
+{$endif DEBUG_MT}
+      end;
+
+
+    procedure SysEndThread(ExitCode : DWord);
+      begin
+        DoneThread;
+        pthread_detach(pointer(pthread_self));
+        pthread_exit(pointer(ExitCode));
+      end;
+
+
+    function  SysSuspendThread (threadHandle : dword) : dword;
+    begin
+      {$Warning SuspendThread needs to be implemented}
+    end;
+
+    function  SysResumeThread  (threadHandle : dword) : dword;
+    begin
+      {$Warning ResumeThread needs to be implemented}
+    end;
+
+    procedure SysThreadSwitch;  {give time to other threads}
+    begin
+      {extern int pthread_yield (void) __THROW;}
+      {$Warning ThreadSwitch needs to be implemented}
+    end;
+
+    function  SysKillThread (threadHandle : dword) : dword;
+    begin
+      pthread_detach(pointer(threadHandle));
+      SysKillThread := pthread_cancel(Pointer(threadHandle));
+    end;
+
+    function  SysWaitForThreadTerminate (threadHandle : dword; TimeoutMs : longint) : dword;  {0=no timeout}
+    var
+      LResultP: Pointer;
+      LResult: DWord;
+    begin
+      LResult := 0;
+      LResultP := @LResult;
+      pthread_join(Pointer(threadHandle), @LResultP);
+      SysWaitForThreadTerminate := LResult;
+    end;
+
+    function  SysThreadSetPriority (threadHandle : dword; Prio: longint): boolean; {-15..+15, 0=normal}
+    begin
+      {$Warning ThreadSetPriority needs to be implemented}
+    end;
+
+
+    function  SysThreadGetPriority (threadHandle : dword): Integer;
+    begin
+      {$Warning ThreadGetPriority needs to be implemented}
+    end;
+
+    function  SysGetCurrentThreadId : dword;
+    begin
+      SysGetCurrentThreadId:=dword(pthread_self);
+    end;
+
+
+{*****************************************************************************
+                          Delphi/Win32 compatibility
+*****************************************************************************}
+
+    procedure SysInitCriticalSection(var CS);
+
+    Var
+      P : PRTLCriticalSection;
+
+      begin
+         P:=PRTLCriticalSection(@CS);
+         FillChar (p^,sizeof(p^),0);
+         pthread_mutex_init(P,NIL);
+      end;
+
+    procedure SysEnterCriticalSection(var CS);
+      begin
+         pthread_mutex_lock(PRTLCriticalSection(@CS));
+      end;
+
+    procedure SysLeaveCriticalSection(var CS);
+      begin
+         pthread_mutex_unlock(PRTLCriticalSection(@CS));
+      end;
+
+    procedure SysDoneCriticalSection(var CS);
+      begin
+         pthread_mutex_destroy(PRTLCriticalSection(@CS));
+      end;
+
+
+{*****************************************************************************
+                           Heap Mutex Protection
+*****************************************************************************}
+
+    var
+      HeapMutex : pthread_mutex_t;
+
+    procedure PThreadHeapMutexInit;
+      begin
+         pthread_mutex_init(@heapmutex,nil);
+      end;
+
+    procedure PThreadHeapMutexDone;
+      begin
+         pthread_mutex_destroy(@heapmutex);
+      end;
+
+    procedure PThreadHeapMutexLock;
+      begin
+         pthread_mutex_lock(@heapmutex);
+      end;
+
+    procedure PThreadHeapMutexUnlock;
+      begin
+         pthread_mutex_unlock(@heapmutex);
+      end;
+
+    const
+      PThreadMemoryMutexManager : TMemoryMutexManager = (
+        MutexInit : @PThreadHeapMutexInit;
+        MutexDone : @PThreadHeapMutexDone;
+        MutexLock : @PThreadHeapMutexLock;
+        MutexUnlock : @PThreadHeapMutexUnlock;
+      );
+
+    procedure InitHeapMutexes;
+      begin
+        SetMemoryMutexManager(PThreadMemoryMutexManager);
+      end;
+
+type
+     TPthreadMutex = ppthread_mutex_t;
+     Tbasiceventstate=record
+         FSem: Pointer;
+         FManualReset: Boolean;
+         FEventSection: TPthreadMutex;
+	end;
+     plocaleventstate = ^tbasiceventstate;
+//     peventstate=pointer;
+
+Const
+	wrSignaled = 0;
+	wrTimeout  = 1;
+	wrAbandoned= 2;
+	wrError	   = 3;
+
+function IntBasicEventCreate(EventAttributes : Pointer; AManualReset,InitialState : Boolean;const Name : ansistring):pEventState;
+
+var
+  MAttr : pthread_mutex_attr_t;
+  res   : cint;
+
+
+begin
+  //new(plocaleventstate(result));
+  getmem (result,sizeof(plocaleventstate));
+  plocaleventstate(result)^.FManualReset:=AManualReset;
+  plocaleventstate(result)^.FSem:=New(PSemaphore);  //sem_t.
+//  plocaleventstate(result)^.feventsection:=nil;
+  res:=pthread_mutexattr_init(@MAttr);
+  if Res=0 then
+    try
+      Res:=pthread_mutexattr_settype(@MAttr,longint(PTHREAD_MUTEX_RECURSIVE));
+      if Res=0 then
+        Res:=pthread_mutex_init(@plocaleventstate(result)^.feventsection,@MAttr);
+    finally
+      pthread_mutexattr_destroy(@MAttr);
+    end;
+  sem_init(psem_t(plocaleventstate(result)^.FSem),ord(False),Ord(InitialState));
+end;
+
+procedure Intbasiceventdestroy(state:peventstate);
+
+begin
+  sem_destroy(psem_t(  plocaleventstate(state)^.FSem));
+end;
+
+procedure IntbasiceventResetEvent(state:peventstate);
+
+begin
+  While sem_trywait(psem_t( plocaleventstate(state)^.FSem))=0 do
+    ;
+end;
+
+procedure IntbasiceventSetEvent(state:peventstate);
+
+Var
+  Value : Longint;
+
+begin
+  pthread_mutex_lock(@plocaleventstate(state)^.feventsection);
+  Try
+    sem_getvalue(plocaleventstate(state)^.FSem,@value);
+    if Value=0 then
+      sem_post(psem_t( plocaleventstate(state)^.FSem));
+  finally
+    pthread_mutex_unlock(@plocaleventstate(state)^.feventsection);
+  end;
+end;
+
+function IntbasiceventWaitFor(Timeout : Cardinal;state:peventstate) : longint;
+
+begin
+  If TimeOut<>Cardinal($FFFFFFFF) then
+    result:=wrError
+  else
+    begin
+    sem_wait(psem_t(plocaleventstate(state)^.FSem));
+    result:=wrSignaled;
+    if plocaleventstate(state)^.FManualReset then
+      begin
+        pthread_mutex_lock(@plocaleventstate(state)^.feventsection);
+        Try
+            intbasiceventresetevent(State);
+            sem_post(psem_t( plocaleventstate(state)^.FSem));
+          Finally
+        pthread_mutex_unlock(@plocaleventstate(state)^.feventsection);
+      end;
+    end;
+    end;
+end;
+
+Var
+  NWThreadManager : TThreadManager;
+
+Procedure SetNWThreadManager;
+
+begin
+  With NWThreadManager do
+  begin
+    InitManager            :=nil;
+    DoneManager            :=nil;
+    BeginThread            :=@SysBeginThread;
+    EndThread              :=@SysEndThread;
+    SuspendThread          :=@SysSuspendThread;
+    ResumeThread           :=@SysResumeThread;
+    KillThread             :=@SysKillThread;
+    ThreadSwitch           :=@SysThreadSwitch;
+    WaitForThreadTerminate :=@SysWaitForThreadTerminate;
+    ThreadSetPriority      :=@SysThreadSetPriority;
+    ThreadGetPriority      :=@SysThreadGetPriority;
+    GetCurrentThreadId     :=@SysGetCurrentThreadId;
+    InitCriticalSection    :=@SysInitCriticalSection;
+    DoneCriticalSection    :=@SysDoneCriticalSection;
+    EnterCriticalSection   :=@SysEnterCriticalSection;
+    LeaveCriticalSection   :=@SysLeaveCriticalSection;
+{$ifdef hasthreadvar}
+    InitThreadVar          :=@SysInitThreadVar;
+    RelocateThreadVar      :=@SysRelocateThreadVar;
+    AllocateThreadVars     :=@SysAllocateThreadVars;
+    ReleaseThreadVars      :=@SysReleaseThreadVars;
+{$endif}
+    BasicEventCreate       :=@intBasicEventCreate;
+    BasicEventDestroy      :=@intBasicEventDestroy;
+    BasicEventResetEvent   :=@intBasicEventResetEvent;
+    BasicEventSetEvent     :=@intBasicEventSetEvent;
+    BasiceventWaitFor      :=@intBasiceventWaitFor;
+    end;
+  SetThreadManager(NWThreadManager);
+  InitHeapMutexes;
+end;
+
+initialization
+  {$ifdef HASTHREADVAR}
+  ThVarAllocResourceTag := AllocateResourceTag(getnlmhandle,'Threadvar Memory',AllocSignature);
+  {$endif}
+  SetNWThreadManager;
+end.
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}
+

+ 563 - 0
rtl/netwlibc/sysutils.pp

@@ -0,0 +1,563 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team.
+
+    Sysutils unit for netware (libc)
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+unit sysutils;
+interface
+
+{$MODE objfpc}
+{ force ansistrings }
+{$H+}
+
+uses Libc,DOS;
+
+
+TYPE
+  TNetwareLibcFindData =
+  RECORD
+    DirP  : Pdirent;               { used for opendir }
+    EntryP: Pdirent;               { and readdir }
+    Magic : WORD;                  { to avoid abends with uninitialized TSearchRec }
+  END;
+
+{ Include platform independent interface part }
+{$i sysutilh.inc}
+
+
+
+{ additional NetWare file flags}
+CONST
+  faSHARE              = $00000080;  { Sharable file                   }
+
+  faNO_SUBALLOC        = $00000800;  { Don't sub alloc. this file      }
+  faTRANS              = $00001000;  { Transactional file (TTS usable) }
+  faREADAUD            = $00004000;  { Read audit                      }
+  faWRITAUD            = $00008000;  { Write audit                     }
+
+  faIMMPURG            = $00010000;  { Immediate purge                 }
+  faNORENAM            = $00020000;  { Rename inhibit                  }
+  faNODELET            = $00040000;  { Delete inhibit                  }
+  faNOCOPY             = $00080000;  { Copy inhibit                    }
+
+  faFILE_MIGRATED      = $00400000;  { File has been migrated          }
+  faDONT_MIGRATE       = $00800000;  { Don't migrate this file         }
+  faIMMEDIATE_COMPRESS = $02000000;  { Compress this file immediately  }
+  faFILE_COMPRESSED    = $04000000;  { File is compressed              }
+  faDONT_COMPRESS      = $08000000;  { Don't compress this file        }
+  faCANT_COMPRESS      = $20000000;  { Can't compress this file        }
+  faATTR_ARCHIVE       = $40000000;  { Entry has had an EA modified,   }
+                                     { an ownerID changed, or trustee  }
+                                     { info changed, etc.              }
+
+
+
+implementation
+
+  uses
+    sysconst;
+
+{ Include platform independent implementation part }
+{$i sysutils.inc}
+
+
+{****************************************************************************
+                              File Functions
+****************************************************************************}
+
+Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
+VAR NWOpenFlags : longint;
+BEGIN
+  NWOpenFlags:=0;
+  Case (Mode and 3) of
+    0 : NWOpenFlags:=NWOpenFlags or O_RDONLY;
+    1 : NWOpenFlags:=NWOpenFlags or O_WRONLY;
+    2 : NWOpenFlags:=NWOpenFlags or O_RDWR;
+  end;
+  FileOpen := open (pchar(FileName),NWOpenFlags);
+
+  //!! We need to set locking based on Mode !!
+end;
+
+
+Function FileCreate (Const FileName : String) : Longint;
+
+begin
+  FileCreate:=open(Pchar(FileName),O_RdWr or O_Creat or O_Trunc);
+end;
+
+Function FileCreate (Const FileName : String; mode:longint) : Longint;
+
+begin
+  FileCreate:=FileCreate (FileName);
+end;
+
+
+Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
+
+begin
+  FileRead:=libc.fpread (Handle,@Buffer,Count);
+end;
+
+
+Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
+
+begin
+  FileWrite:=libc.fpwrite (Handle,@Buffer,Count);
+end;
+
+
+Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
+
+begin
+  FileSeek:=libc.fplseek (Handle,FOffset,Origin);
+end;
+
+
+Function FileSeek (Handle : Longint; FOffset,Origin : Int64) : Int64;
+begin
+  FileSeek:=libc.fplseek (Handle,FOffset,Origin);
+end;
+
+
+Procedure FileClose (Handle : Longint);
+
+begin
+  libc.fpclose(Handle);
+end;
+
+Function FileTruncate (Handle,Size: Longint) : boolean;
+
+begin
+  FileTruncate:=(libc.fpchsize(Handle,Size) = 0);
+end;
+
+Function FileLock (Handle,FOffset,FLen : Longint) : Longint;
+begin
+  {$warning FileLock not implemented}
+  //FileLock := _lock (Handle,FOffset,FLen);
+end;
+
+Function FileLock (Handle : Longint; FOffset,FLen : Int64) : Longint;
+begin
+  {$warning need to add 64bit FileLock call }
+  //FileLock := FileLock (Handle, longint(FOffset),longint(FLen));
+end;
+
+Function FileUnlock (Handle,FOffset,FLen : Longint) : Longint;
+begin
+  //FileUnlock := _unlock (Handle,FOffset,FLen);
+  {$warning FileUnLock not implemented}
+end;
+
+Function FileUnlock (Handle : Longint; FOffset,FLen : Int64) : Longint;
+begin
+  {$warning need to add 64bit FileUnlock call }
+  //FileUnlock := FileUnlock (Handle, longint(FOffset),longint(FLen));
+end;
+
+Function FileAge (Const FileName : String): Longint;
+
+VAR Info : TStat;
+    _PTM  : PTM;
+begin
+  If stat (pchar(FileName),Info) <> 0 then
+    exit(-1)
+  else
+    begin
+      _PTM := localtime (Info.st_mtim.tv_sec);
+      IF _PTM = NIL THEN
+        exit(-1)
+      else
+        WITH _PTM^ DO
+          Result:=DateTimeToFileDate(EncodeDate(tm_year+1900,tm_mon+1,tm_mday)+EncodeTime(tm_hour,tm_min,tm_sec,0));
+    end;
+end;
+
+
+Function FileExists (Const FileName : String) : Boolean;
+VAR Info : TStat;
+begin
+  FileExists:=(stat(pchar(filename),Info) = 0);
+end;
+
+
+
+PROCEDURE find_setfields (VAR f : TsearchRec);
+VAR T : Dos.DateTime;
+BEGIN
+  WITH F DO
+  BEGIN
+    IF FindData.Magic = $AD01 THEN
+    BEGIN
+      {attr := FindData.EntryP^.d_attr AND $FF;}  // lowest 8 bit -> same as dos
+      attr := FindData.EntryP^.d_flags;   { return complete netware attributes }
+      //!!UnpackTime(FindData.EntryP^.d_time + (LONGINT (FindData.EntryP^.d_date) SHL 16), T);
+      //!!time := DateTimeToFileDate(EncodeDate(T.Year,T.Month,T.day)+EncodeTime(T.Hour,T.Min,T.Sec,0));
+      size := FindData.EntryP^.d_size;
+      name := strpas (FindData.EntryP^.d_name);
+    END ELSE
+    BEGIN
+      FillChar (f,SIZEOF(f),0);
+    END;
+  END;
+END;
+
+
+
+Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
+begin
+  IF path = '' then
+    exit (18);
+  Rslt.FindData.DirP := opendir (pchar(Path));
+  IF Rslt.FindData.DirP = NIL THEN
+    exit (18);
+  //!!IF attr <> faAnyFile THEN
+  //!!  _SetReaddirAttribute (Rslt.FindData.DirP, attr);
+  Rslt.FindData.Magic := $AD01;
+  Rslt.FindData.EntryP := readdir (Rslt.FindData.DirP);
+  if Rslt.FindData.EntryP = nil then
+  begin
+    closedir (Rslt.FindData.DirP);
+    Rslt.FindData.DirP := NIL;
+    result := 18;
+  end else
+  begin
+    find_setfields (Rslt);
+    result := 0;
+  end;
+end;
+
+
+Function FindNext (Var Rslt : TSearchRec) : Longint;
+
+begin
+  if Rslt.FindData.Magic <> $AD01 then
+    exit (18);
+  Rslt.FindData.EntryP := readdir (Rslt.FindData.DirP);
+  if Rslt.FindData.EntryP = nil then
+    exit (18);
+  find_setfields (Rslt);
+  result := 0;
+end;
+
+
+Procedure FindClose (Var F : TSearchrec);
+begin
+  if F.FindData.Magic = $AD01 then
+  begin
+    if F.FindData.DirP <> nil then
+      closedir (F.FindData.DirP);
+    F.FindData.Magic := 0;
+    F.FindData.DirP := NIL;
+    F.FindData.EntryP := NIL;
+  end;
+end;
+
+
+Function FileGetDate (Handle : Longint) : Longint;
+Var Info : TStat;
+    _PTM  : PTM;
+begin
+  If fstat(Handle,Info) <> 0 then
+    Result:=-1
+  else
+    begin
+      _PTM := localtime (Info.st_mtim.tv_sec);
+      IF _PTM = NIL THEN
+        exit(-1)
+      else
+        with _PTM^ do
+          Result:=DateTimeToFileDate(EncodeDate(tm_year+1900,tm_mon+1,tm_mday)+EncodeTime(tm_hour,tm_min,tm_sec,0));
+    end;
+end;
+
+
+Function FileSetDate (Handle,Age : Longint) : Longint;
+begin
+  { i think its impossible under netware from FileHandle. I dident found a way to get the
+    complete pathname of a filehandle, that would be needed for ChangeDirectoryEntry }
+  FileSetDate:=-1;
+  ConsolePrintf ('warning: fpc sysutils.FileSetDate not implemented'#13#10);
+  {$warning FileSetDate not implemented (i think is impossible) }
+end;
+
+
+Function FileGetAttr (Const FileName : String) : Longint;
+Var Info : TStat;
+begin
+  If stat (pchar(FileName),Info) <> 0 then
+    Result:=-1
+  Else
+    Result := Info.st_flags AND $FFFF;
+end;
+
+
+Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
+//VAR MS : NWModifyStructure;
+begin
+  {FillChar (MS, SIZEOF (MS), 0);
+  if _ChangeDirectoryEntry (PChar (Filename), MS, MFileAtrributesBit, 0) <> 0 then
+    result := -1
+  else
+    result := 0;}
+{$warning FileSetAttr needs implementation}
+end;
+
+
+Function DeleteFile (Const FileName : String) : Boolean;
+
+begin
+  Result:= (libc.UnLink (pchar(FileName)) = 0);
+end;
+
+
+Function RenameFile (Const OldName, NewName : String) : Boolean;
+
+begin
+  RenameFile:=(libc.rename(pchar(OldName),pchar(NewName)) = 0);
+end;
+
+
+{****************************************************************************
+                              Disk Functions
+****************************************************************************}
+
+{
+  The Diskfree and Disksize functions need a file on the specified drive, since this
+  is required for the statfs system call.
+  These filenames are set in drivestr[0..26], and have been preset to :
+   0 - '.'      (default drive - hence current dir is ok.)
+   1 - '/fd0/.'  (floppy drive 1 - should be adapted to local system )
+   2 - '/fd1/.'  (floppy drive 2 - should be adapted to local system )
+   3 - '/'       (C: equivalent of dos is the root partition)
+   4..26          (can be set by you're own applications)
+  ! Use AddDisk() to Add new drives !
+  They both return -1 when a failure occurs.
+}
+Const
+  FixDriveStr : array[0..3] of pchar=(
+    '.',
+    'a:.',
+    'b:.',
+    'sys:/'
+    );
+var
+  Drives   : byte;
+  DriveStr : array[4..26] of pchar;
+
+Procedure AddDisk(const path:string);
+begin
+  if not (DriveStr[Drives]=nil) then
+   FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
+  GetMem(DriveStr[Drives],length(Path)+1);
+  StrPCopy(DriveStr[Drives],path);
+  inc(Drives);
+  if Drives>26 then
+   Drives:=4;
+end;
+
+
+Function DiskFree(Drive: Byte): int64;
+//var fs : statfs;
+Begin
+{  if ((Drive<4) and (not (fixdrivestr[Drive]=nil)) and fsstat(StrPas(fixdrivestr[drive]),fs)) or
+     ((not (drivestr[Drive]=nil)) and fsstat(StrPas(drivestr[drive]),fs)) then
+   Diskfree:=int64(fs.bavail)*int64(fs.bsize)
+  else
+   Diskfree:=-1;}
+  DiskFree := -1;
+  ConsolePrintf ('warning: fpc sysutils.diskfree not implemented'#13#10);
+  {$warning DiskFree not implemented (does it make sense ?) }
+End;
+
+
+
+Function DiskSize(Drive: Byte): int64;
+//var fs : statfs;
+Begin
+{  if ((Drive<4) and (not (fixdrivestr[Drive]=nil)) and fsstat(StrPas(fixdrivestr[drive]),fs)) or
+     ((not (drivestr[Drive]=nil)) and fsstat(StrPas(drivestr[drive]),fs)) then
+   DiskSize:=int64(fs.blocks)*int64(fs.bsize)
+  else
+   DiskSize:=-1;}
+  DiskSize := -1;
+  ConsolePrintf ('warning: fpc sysutils.disksize not implemented'#13#10);
+  {$warning DiskSize not implemented (does it make sense ?) }
+End;
+
+
+Function GetCurrentDir : String;
+begin
+  GetDir (0,Result);
+end;
+
+
+Function SetCurrentDir (Const NewDir : String) : Boolean;
+begin
+  Libc.FpChDir(pchar(NewDir));
+  result := (___errno^ = 0);
+end;
+
+
+Function CreateDir (Const NewDir : String) : Boolean;
+begin
+  Libc.FpMkDir(pchar(NewDir),0);
+  result := (___errno^ = 0);
+end;
+
+
+Function RemoveDir (Const Dir : String) : Boolean;
+begin
+  libc.FpRmDir(pchar(Dir));
+  result := (___errno^ = 0);
+end;
+
+
+function DirectoryExists (const Directory: string): boolean;
+var Info : TStat;
+begin
+  If stat (pchar(Directory),Info) <> 0 then
+    exit(false)
+  else
+    Exit ((Info.st_mode and M_A_SUBDIR) <> 0);
+end;
+
+
+{****************************************************************************
+                              Misc Functions
+****************************************************************************}
+
+procedure Beep;
+begin
+  RingBell;
+end;
+
+
+{****************************************************************************
+                              Locale Functions
+****************************************************************************}
+
+Procedure GetLocalTime(var SystemTime: TSystemTime);
+var xx : word;
+begin
+  Dos.GetTime(SystemTime.Hour, SystemTime.Minute, SystemTime.Second, xx);
+  Dos.GetDate(SystemTime.Year, SystemTime.Month, SystemTime.Day, xx);
+  SystemTime.MilliSecond := 0;
+end;
+
+
+Procedure InitAnsi;
+Var i : longint;
+begin
+  {  Fill table entries 0 to 127  }
+  for i := 0 to 96 do
+    UpperCaseTable[i] := chr(i);
+  for i := 97 to 122 do
+    UpperCaseTable[i] := chr(i - 32);
+  for i := 123 to 191 do
+    UpperCaseTable[i] := chr(i);
+  Move (CPISO88591UCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
+
+  for i := 0 to 64 do
+    LowerCaseTable[i] := chr(i);
+  for i := 65 to 90 do
+    LowerCaseTable[i] := chr(i + 32);
+  for i := 91 to 191 do
+    LowerCaseTable[i] := chr(i);
+  Move (CPISO88591LCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
+end;
+
+
+Procedure InitInternational;
+begin
+  InitAnsi;
+end;
+
+function SysErrorMessage(ErrorCode: Integer): String;
+
+begin
+  Result:='';  // StrError(ErrorCode);
+end;
+
+{****************************************************************************
+                              OS utility functions
+****************************************************************************}
+
+Function GetEnvironmentVariable(Const EnvVar : String) : String;
+
+begin
+  Result:=StrPas(libc.getenv(PChar(EnvVar)));
+end;
+
+
+function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
+
+var
+  e : EOSError;
+  CommandLine: AnsiString;
+
+begin
+  dos.exec(path,comline);
+
+  if (Dos.DosError <> 0) then
+    begin
+      if ComLine <> '' then
+       CommandLine := Path + ' ' + ComLine
+      else
+       CommandLine := Path;
+      e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,Dos.DosError]);
+      e.ErrorCode:=Dos.DosError;
+      raise e;
+    end;
+  Result := DosExitCode;
+end;
+
+
+function ExecuteProcess (const Path: AnsiString;
+                                  const ComLine: array of AnsiString): integer;
+
+var
+  CommandLine: AnsiString;
+  I: integer;
+
+begin
+  Commandline := '';
+  for I := 0 to High (ComLine) do
+   if Pos (' ', ComLine [I]) <> 0 then
+    CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
+   else
+    CommandLine := CommandLine + ' ' + Comline [I];
+  ExecuteProcess := ExecuteProcess (Path, CommandLine);
+end;
+
+
+
+{****************************************************************************
+                              Initialization code
+****************************************************************************}
+
+Initialization
+  InitExceptions;       { Initialize exceptions. OS independent }
+  InitInternational;    { Initialize internationalization settings }
+Finalization
+  DoneExceptions;
+end.
+{
+
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 332 - 0
rtl/netwlibc/tthread.inc

@@ -0,0 +1,332 @@
+{
+    $Id$
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2000 by Peter Vreman
+
+    Netware Libc TThread implementation
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+{
+  What follows, is a short description on my implementation of TThread.
+  Most information can also be found by reading the source and accompanying
+  comments.
+
+  A thread is created using BeginThread, which in turn calls
+  pthread_create. So the threads here are always posix threads.
+  Posix doesn't define anything for suspending threads as this is
+  inherintly unsafe. Just don't suspend threads at points they cannot
+  control. Therefore, I didn't implement .Suspend() if its called from
+  outside the threads execution flow (except on Linux _without_ NPTL).
+
+  The implementation for .suspend uses a semaphore, which is initialized
+  at thread creation. If the thread tries to suspend itself, we simply
+  let it wait on the semaphore until it is unblocked by someone else
+  who calls .Resume.
+
+  If a thread is supposed to be suspended (from outside its own path of
+  execution) on a system where the symbol LINUX is defined, two things
+  are possible.
+  1) the system has the LinuxThreads pthread implementation
+  2) the system has NPTL as the pthread implementation.
+
+  In the first case, each thread is a process on its own, which as far as
+  know actually violates posix with respect to signal handling.
+  But we can detect this case, because getpid(2) will
+  return a different PID for each thread. In that case, sending SIGSTOP
+  to the PID associated with a thread will actually stop that thread
+  only.
+  In the second case, this is not possible. But getpid(2) returns the same
+  PID across all threads, which is detected, and TThread.Suspend() does
+  nothing in that case. This should probably be changed, but I know of
+  no way to suspend a thread when using NPTL.
+
+  If the symbol LINUX is not defined, then the unimplemented
+  function SuspendThread is called.
+
+  Johannes Berg <[email protected]>, Sunday, November 16 2003
+}
+
+// ========== semaphore stuff ==========
+{
+  I don't like this. It eats up 2 filedescriptors for each thread,
+  and those are a limited resource. If you have a server programm
+  handling client connections (one per thread) it will not be able
+  to handle many if we use 2 fds already for internal structures.
+  However, right now I don't see a better option unless some sem_*
+  functions are added to systhrds.
+  I encapsulated all used functions here to make it easier to
+  change them completely.
+}
+
+function SemaphoreInit: Pointer;
+begin
+  SemaphoreInit := GetMem(SizeOf(TFilDes));
+  fppipe(PFilDes(SemaphoreInit)^);
+end;
+
+procedure SemaphoreWait(const FSem: Pointer);
+var
+  b: byte;
+begin
+  fpread(PFilDes(FSem)^[0], b, 1);
+end;
+
+procedure SemaphorePost(const FSem: Pointer);
+var c : char;
+begin
+  c := #0;
+  fpwrite(PFilDes(FSem)^[1], c, 1);
+end;
+
+procedure SemaphoreDestroy(const FSem: Pointer);
+begin
+  fpclose(PFilDes(FSem)^[0]);
+  fpclose(PFilDes(FSem)^[1]);
+  FreeMemory(FSem);
+end;
+
+// =========== semaphore end ===========
+
+var
+  ThreadsInited: boolean = false;
+{$IFDEF LINUX}
+  GMainPID: LongInt = 0;
+{$ENDIF}
+const
+  // stupid, considering its not even implemented...
+  Priorities: array [TThreadPriority] of Integer =
+   (-20,-19,-10,0,9,18,19);
+
+procedure InitThreads;
+begin
+  if not ThreadsInited then begin
+    ThreadsInited := true;
+    {$IFDEF LINUX}
+    GMainPid := fpgetpid();
+    {$ENDIF}
+  end;
+end;
+
+procedure DoneThreads;
+begin
+  ThreadsInited := false;
+end;
+
+{ ok, so this is a hack, but it works nicely. Just never use
+  a multiline argument with WRITE_DEBUG! }
+{$MACRO ON}
+{$IFDEF DEBUG_MT}
+{$define WRITE_DEBUG := writeln} // actually write something
+{$ELSE}
+{$define WRITE_DEBUG := //}      // just comment out those lines
+{$ENDIF}
+
+function ThreadFunc(parameter: Pointer): LongInt;
+var
+  LThread: TThread;
+  c: char;
+begin
+  WRITE_DEBUG('ThreadFunc is here...');
+  LThread := TThread(parameter);
+  {$IFDEF LINUX}
+  // save the PID of the "thread"
+  // this is different from the PID of the main thread if
+  // the LinuxThreads implementation is used
+  LThread.FPid := fpgetpid();
+  {$ENDIF}
+  WRITE_DEBUG('thread initing, parameter = ', LongInt(LThread));
+  try
+    if LThread.FInitialSuspended then begin
+      SemaphoreWait(LThread.FSem);
+      if not LThread.FInitialSuspended then begin
+        WRITE_DEBUG('going into LThread.Execute');
+        LThread.Execute;
+      end;
+    end else begin
+      WRITE_DEBUG('going into LThread.Execute');
+      LThread.Execute;
+    end;
+  except
+    on e: exception do begin
+      WRITE_DEBUG('got exception: ',e.message);
+      LThread.FFatalException :=  TObject(AcquireExceptionObject);
+      // not sure if we should really do this...
+      // but .Destroy was called, so why not try FreeOnTerminate?
+      if e is EThreadDestroyCalled then LThread.FFreeOnTerminate := true;
+    end;
+  end;
+  WRITE_DEBUG('thread done running');
+  Result := LThread.FReturnValue;
+  WRITE_DEBUG('Result is ',Result);
+  LThread.FFinished := True;
+  LThread.DoTerminate;
+  if LThread.FreeOnTerminate then begin
+    WRITE_DEBUG('Thread should be freed');
+    LThread.Free;
+    WRITE_DEBUG('Thread freed');
+  end;
+  WRITE_DEBUG('thread func exiting');
+end;
+
+{ TThread }
+constructor TThread.Create(CreateSuspended: Boolean);
+begin
+  // lets just hope that the user doesn't create a thread
+  // via BeginThread and creates the first TThread Object in there!
+  InitThreads;
+  inherited Create;
+  FSem := SemaphoreInit;
+  FSuspended :=CreateSuspended;
+  FSuspendedExternal := false;
+  FInitialSuspended := CreateSuspended;
+  FFatalException := nil;
+  WRITE_DEBUG('creating thread, self = ',longint(self));
+  FHandle:= BeginThread(@ThreadFunc, Pointer(Self), FThreadID);
+  WRITE_DEBUG('TThread.Create done');
+end;
+
+
+destructor TThread.Destroy;
+begin
+  if FThreadID = GetCurrentThreadID then begin
+    raise EThreadDestroyCalled.Create('A thread cannot destroy itself except by setting FreeOnTerminate and leaving!');
+  end;
+  // if someone calls .Free on a thread with
+  // FreeOnTerminate, then don't crash!
+  FFreeOnTerminate := false;
+  if not FFinished and not FSuspended then begin
+    Terminate;
+    WaitFor;
+  end;
+  if (FInitialSuspended) then begin
+    // thread was created suspended but never woken up.
+    SemaphorePost(FSem);
+    WaitFor;
+  end;
+  FFatalException.Free;
+  FFatalException := nil;
+  SemaphoreDestroy(FSem);
+  inherited Destroy;
+end;
+
+procedure TThread.SetSuspended(Value: Boolean);
+begin
+  if Value <> FSuspended then
+    if Value then
+      Suspend
+    else
+      Resume;
+end;
+
+procedure TThread.Suspend;
+begin
+  if not FSuspended then begin
+    if FThreadID = GetCurrentThreadID then begin
+      FSuspended := true;
+      SemaphoreWait(FSem);
+    end else begin
+      FSuspendedExternal := true;
+{$IFDEF LINUX}
+      // naughty hack if the user doesn't have Linux with NPTL...
+      // in that case, the PID of threads will not be identical
+      // to the other threads, which means that our thread is a normal
+      // process that we can suspend via SIGSTOP...
+      // this violates POSIX, but is the way it works on the
+      // LinuxThreads pthread implementation. Not with NPTL, but in that case
+      // getpid(2) also behaves properly and returns the same PID for
+      // all threads. Thats actually (FINALLY!) native thread support :-)
+      if FPid <> GMainPID then begin
+        FSuspended := true;
+        fpkill(FPid, SIGSTOP);
+      end;
+{$ELSE}
+      SuspendThread(FHandle);
+{$ENDIF}
+    end;
+  end;
+end;
+
+
+procedure TThread.Resume;
+begin
+  if (not FSuspendedExternal) then begin
+    if FSuspended then begin
+      SemaphorePost(FSem);
+      FInitialSuspended := false;
+      FSuspended := False;
+    end;
+  end else begin
+{$IFDEF LINUX}
+    // see .Suspend
+    if FPid <> GMainPID then begin
+      fpkill(FPid, SIGCONT);
+      FSuspended := False;
+    end;
+{$ELSE}
+    ResumeThread(FHandle);
+{$ENDIF}
+    FSuspendedExternal := false;
+  end;
+end;
+
+
+procedure TThread.Terminate;
+begin
+  FTerminated := True;
+end;
+
+function TThread.WaitFor: Integer;
+begin
+  WRITE_DEBUG('waiting for thread ',FHandle);
+  WaitFor := WaitForThreadTerminate(FHandle, 0);
+  WRITE_DEBUG('thread terminated');
+end;
+
+procedure TThread.CallOnTerminate;
+begin
+  // no need to check if FOnTerminate <> nil, because
+  // thats already done in DoTerminate
+  FOnTerminate(self);
+end;
+
+procedure TThread.DoTerminate;
+begin
+  if Assigned(FOnTerminate) then
+    Synchronize(@CallOnTerminate);
+end;
+
+function TThread.GetPriority: TThreadPriority;
+var
+  P: Integer;
+  I: TThreadPriority;
+begin
+  P := ThreadGetPriority(FHandle);
+  Result := tpNormal;
+  for I := Low(TThreadPriority) to High(TThreadPriority) do
+    if Priorities[I] = P then
+      Result := I;
+end;
+
+procedure TThread.Synchronize(Method: TThreadMethod);
+begin
+end;
+
+procedure TThread.SetPriority(Value: TThreadPriority);
+begin
+  ThreadSetPriority(FHandle, Priorities[Value]);
+end;
+
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}

+ 48 - 0
rtl/netwlibc/varutils.pp

@@ -0,0 +1,48 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2004 by the Free Pascal development team
+
+    Interface and OS-dependent part of variant support
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+{$MODE ObjFPC}
+
+Unit varutils;
+
+Interface
+
+Uses sysutils;
+
+// Read definitions.
+
+{$i varutilh.inc}
+
+Implementation
+
+// Code common to all platforms.
+
+{$i cvarutil.inc}
+
+// Code common to non-win32 platforms.
+
+{$i varutils.inc}
+
+end.
+
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+
+}
+

+ 11 - 0
rtl/netwlibc/winsock.pp

@@ -0,0 +1,11 @@
+{winsock is the same for clib and libc on netware}
+{$define netware}
+{$i ../netware/winsock.pp}
+
+{
+  $Log$
+  Revision 1.1  2004-09-05 20:58:47  armin
+  * first rtl version for netwlibc
+
+}
+  

+ 345 - 0
rtl/netwlibc/ws2_32.imp

@@ -0,0 +1,345 @@
+ WS2_32_bind,
+ WS2_32_closesocket,
+ WS2_32_getpeername,
+ WS2_32_getsockname,
+ WS2_32_getsockopt,
+ WS2_32_htonl,
+ WS2_32_htons,
+ WS2_32_ioctlsocket,
+ WS2_32_listen,
+ WS2_32_ntohl,
+ WS2_32_ntohs,
+ WS2_32_recv,
+ WS2_32_recvfrom,
+ WS2_32_select,
+ WS2_32_send,
+ WS2_32_sendto,
+ WS2_32_setsockopt,
+ WS2_32_shutdown,
+ WS2_32_socket,
+ WSAAccept,
+ WSACancelBlockingCall,
+ WSACleanup,
+ WSACloseEvent,
+ WSAConnect,
+ WSACreateEvent,
+ WSCEnableNSProvider,
+ WSAEnumNetworkEvents,
+ WSAEnumProtocolsA,
+ WSAEnumProtocolsW,
+ WSAEventSelect,
+ WSAGetLastError,
+ WSAGetOverlappedResult,
+ WSAGetQOSByName,
+ WSAHtonl,
+ WSAHtons,
+ WSAIoctl,
+ WSAJoinLeaf,
+ WSANtohl,
+ WSANtohs,
+ WSARecv,
+ WSARecvDisconnect,
+ WSARecvFrom,
+ WSAResetEvent,
+ WSASend,
+ WSASendDisconnect,
+ WSASendTo,
+ WSASetEvent,
+ WSASetLastError,
+ WSASocketA,
+ WSASocketW,
+ WSAStartup,
+ WSAWaitForMultipleEvents,
+ WSAAddressToStringA,
+ WSAAddressToStringW,
+ WSAEnumNameSpaceProvidersA,
+ WSAEnumNameSpaceProvidersW,
+ WSAGetServiceClassInfoA,
+ WSAGetServiceClassInfoW,
+ WSAGetServiceClassNameByClassIdA,
+ WSAGetServiceClassNameByClassIdW,
+ WSAInstallServiceClassA,
+ WSAInstallServiceClassW,
+ WSALookupServiceBeginA,
+ WSALookupServiceBeginW,
+ WSALookupServiceEnd,
+ WSALookupServiceNextA,
+ WSALookupServiceNextW,
+ WSARemoveServiceClass,
+ WSASetServiceA,
+ WSASetServiceW,
+ WSAStringToAddressA,
+ WSAStringToAddressW,
+ WSCUnInstallNameSpace,
+ WSCInstallNameSpace,
+ WS2_32_gethostbyaddr,
+ WS2_32_gethostbyname,
+ WS2_32_gethostname,
+ WS2_32_getprotobyname,
+ WS2_32_getprotobynumber,
+ WS2_32_getservbyname,
+ WS2_32_getservbyport,
+ WS2_32_inet_addr,
+ WS2_32_inet_ntoa,
+ __WSAFDIsSet,
+ NiosCancelAESEvent,
+ NiosFindNode,
+ NiosDFindNode,
+ NiosDLinkFirst,
+ NiosDLinkLast,
+ NiosDprintf,
+ NiosDUnlinkFirst,
+ NiosDUnlinkLast,
+ NiosDUnlinkNode,
+ NiosFree,
+ NiosGetTickCount,
+ NiosLinkFirst,
+ NiosLinkLast,
+ NiosLongTermAlloc,
+ NiosMemSet,
+ NiosPoll,
+ NiosPrintf,
+ NiosScheduleAESEvent,
+ NiosScheduleForegroundEvent,
+ NiosShortTermAlloc,
+ NiosUnlinkFirst,
+ NiosUnlinkNode,
+ NiosMemCpy,
+ WSDebMsg,
+ WSAssertFail,
+ WSdebugLevel,
+ WSdebugModule,
+ WSDebChar,
+ WSDebugAllocCheck,
+ WSDebugFreeCheck,
+ WSDebugAlloc,
+ WSDebugString,
+ kYieldThreadStub,
+ FreeObjectStub,
+ AllocateObjectStub,
+ DestroyObjectCacheStub,
+ CreateObjectCacheStub,
+ kRWWriteUnlockStub,
+ kRWWriteLockStub,
+ kRWReadUnlockStub,
+ kRWReadLockStub,
+ kRWLockFreeStub,
+ kRWLockAllocStub,
+ kCurrentThreadStub,
+ WaitForSingleObject,
+ CreateEvent,
+ CloseHandle,
+ WPUSetEvent,
+ bufFree,
+ WSCreateAndLinkObjectCache,
+ WSDestroyObjectCacheList,
+ WSGarbageCollectObjectCache,
+ NetWareOSMajorVersion,
+ WVT,
+ ecbFreePlatformBuffer,
+ ecbImportMsgByRef,
+ ecbImportMsgByCopy,
+ msgCreate,
+ msgReset,
+ msgIncRef,
+ msgDecRef,
+ msgForEach,
+ msgDestroy,
+ msgCopyBufAtFront,
+ msgCopyBufAtEnd,
+ msgCopyToBuf,
+ msgRefBufAtFront,
+ msgRefBufAtEnd,
+ msgCopyMsgAtFront,
+ msgRefMsgAtFront,
+ msgCopyMsgAtEnd,
+ msgImportECBByCopy,
+ msgImportECBByRef,
+ msgRefMsgAtEnd,
+ msgRemoveDataAtFront,
+ msgRemoveDataAtEnd,
+ msgSetCurrentOffset,
+ msgModifyCurrentOffset,
+ msgPushWS,
+ msgPopWS,
+ msgPeekWS,
+ msgLaunchCallback,
+ msgPushAttrib,
+ msgPopAttrib,
+ msgScanMsgForAttrib,
+ mapClose,
+ mapCreate,
+ createProto,
+ termProto,
+ new_termProto,
+ addProtoToLlpList,
+ removeProtoFromLlpList,
+ incProtoRefCount,
+ incSessnRefCount,
+ decProtoRefCount,
+ decSessnRefCount,
+ createSocket,
+ destroySocket,
+ GetDown,
+ setProtoVtbl,
+ setSessnVtbl,
+ ctlPushWS,
+ ctlPopWS,
+ ctlPeekWS,
+ ctlLaunchCallback,
+ wsSocket,
+ wsGetAcceptData,
+ wsAccept,
+ wsBind,
+ wsConnect,
+ wsListen,
+ wsRecv,
+ wsRecvDisconnect,
+ wsSend,
+ wsSendDisconnect,
+ wsCloseSocket,
+ wsEventCallBack,
+ wsRecvCallBack,
+ wsREAD_EventCallBack,
+ wsWRITE_EventCallBack,
+ wsACCEPT_EventCallBack,
+ wsFASTACCEPT_EventCallBack,
+ wsCONNECT_EventCallBack,
+ wsCLOSE_EventCallBack,
+ wsCLOSE_DONE_EventCallBack,
+ wsEventSelect,
+ wsEventPoll,
+ wsControl,
+ wsGetSockName,
+ wsGetPeerName,
+ wsGetSockOpt,
+ wsSetSockOpt,
+ wsJoinLeaf,
+ wsGetQOSByName,
+ getProtoByModuleType,
+ mergeProtoCallTable,
+ estimateTypedData,
+ addTypedDataBegin,
+ addTypedDataNext,
+ addTypedDataEnd,
+ getTypedDataPtr,
+ registerProtocolInfo,
+ deregisterProtocolInfo,
+ getModuleTypeByProtocolInfo,
+ getModuleTypeByCatalogId,
+ kSetThreadWinSockDataStub,
+ kGetThreadWinSockDataStub,
+ kScheduleWorkToDoStub,
+ kCancelWorkToDoStub,
+ kCreateExSetStub,
+ kDestroyExSetStub,
+ kGetExSetHandleStub,
+ kEnterExSetStub,
+ kExitExSetStub,
+ kEnterNetWareStub,
+ kExitNetWareStub,
+ kBindExSetStub,
+ CfwAtomicInc,
+ CfwAtomicDec,
+ destroyProto,
+ kUnbindExSetStub,
+ kCurrentExSetBindingStub,
+ kMutexAllocStub,
+ kMutexFreeStub,
+ kMutexLockStub,
+ kMutexTryLockStub,
+ kMutexTimedWaitStub,
+ kMutexUnlockStub,
+ kMutexWaitCountStub,
+ kSemaphoreAllocStub,
+ kSemaphoreFreeStub,
+ kSemaphoreWaitStub,
+ kSemaphoreTryStub,
+ kSemaphoreTimedWaitStub,
+ kSemaphoreSignalStub,
+ kSemaphoreExamineCountStub,
+ kSemaphoreWaitCountStub,
+ kRWReadTryLockStub,
+ kRWWriteTryLockStub,
+ kRWWriterToReaderStub,
+ kRWReaderToWriterStub,
+ kSpinLockInitStub,
+ kSpinLockStub,
+ kSpinTryLockStub,
+ kSpinUnlockStub,
+ kSpinLockDisableStub,
+ kSpinTryLockDisableStub,
+ kSpinUnlockRestoreStub,
+ kAllocQueStub,
+ kAllocQueNoSleepStub,
+ kFreeQueStub,
+ kQueCountStub,
+ kEnQueStub,
+ kEnQueOrderedStub,
+ kDeQueStub,
+ kDeQueWaitStub,
+ kPushQueStub,
+ kPushQueOrderedStub,
+ kDeQueByQLinkStub,
+ kDeQueAllStub,
+ kEnQueNoLockStub,
+ kEnQueOrderedNoLockStub,
+ kPushQueNoLockStub,
+ kPushQueOrderedNoLockStub,
+ kDeQueNoLockStub,
+ kDeQueByQLinkNoLockStub,
+ kDeQueWaitNoLockStub,
+ kDeQueAllNoLockStub,
+ kFirstQLINKNoLockStub,
+ atomic_incStub,
+ atomic_decStub,
+ atomic_addStub,
+ atomic_subStub,
+ kConditionAllocStub,
+ kConditionDestroyStub,
+ kConditionWaitStub,
+ kConditionTimedWaitStub,
+ kConditionSignalStub,
+ kConditionBroadcastStub,
+ gwspProto,
+ getPackedMsg,
+ putPackedMsg,
+ WS2_32_DNSQuery,
+ FreeDNSReply,
+ HostsTable,
+ HostsEntries,
+ UsedHostsEntries,
+ HostsRWLock,
+ ResizeTable,
+ WS2DNSAllocRTag,
+ WSLocalToUnicode,
+ WSUnicodeToLocal,
+ WS2getservbyname,
+ WS2getservbyport,
+ WS2gethostbyaddr,
+ WS2gethostbyname,
+ WS2_32_GetGeneralStatistics,
+ WS2_32_GetSocketStatistics,
+ WS2_32_GetDebugState,
+ WS2_32_SetDebugState,
+ GetTimerMinorTicksPerSecondStub,
+ WSStartupNLMQ,
+ WSStartupNLMQSpinLock,
+ WSPCloseSocket,
+ wsSktDiag,
+ NiosVidMessageBox,
+ NiosThreadSignalId,
+ NiosThreadBlockOnId,
+ NiosThreadArmId,
+ NiosStrLen,
+ NiosStrCmp,
+ NiosStrCat,
+ NiosGetHighResIntervalMarker,
+ NiosGetDateTime,
+ NiosMemCmp,
+ wsNewWindow,
+ INWNSPInstallServiceClass,
+ INWNSPGetServiceClassInfo,
+ INWNSPRemoveServiceClass,
+ mapReCreateTable
+

+ 89 - 0
rtl/netwlibc/ws2nlm.imp

@@ -0,0 +1,89 @@
+ WS2_32_bind,
+ WS2_32_closesocket,
+ WS2_32_getpeername,
+ WS2_32_getsockname,
+ WS2_32_getsockopt,
+ WS2_32_htonl,
+ WS2_32_htons,
+ WS2_32_ioctlsocket,
+ WS2_32_listen,
+ WS2_32_ntohl,
+ WS2_32_ntohs,
+ WS2_32_recv,
+ WS2_32_recvfrom,
+ WS2_32_select,
+ WS2_32_send,
+ WS2_32_sendto,
+ WS2_32_setsockopt,
+ WS2_32_shutdown,
+ WS2_32_socket,
+ WSAAccept,
+ WSACancelBlockingCall,
+ WSACleanup,
+ WSACloseEvent,
+ WSAConnect,
+ WSACreateEvent,
+ WSCEnableNSProvider,
+ WSAEnumNetworkEvents,
+ WSAEnumProtocolsA,
+ WSAEnumProtocolsW,
+ WSAEventSelect,
+ WSAGetLastError,
+ WSAGetOverlappedResult,
+ WSAGetQOSByName,
+ WSAHtonl,
+ WSAHtons,
+ WSAIoctl,
+ WSAJoinLeaf,
+ WSANtohl,
+ WSANtohs,
+ WSARecv,
+ WSARecvDisconnect,
+ WSARecvFrom,
+ WSAResetEvent,
+ WSASend,
+ WSASendDisconnect,
+ WSASendTo,
+ WSASetEvent,
+ WSASetLastError,
+ WSASocketA,	
+ WSASocketW,
+ WSAStartup,
+ WSAWaitForMultipleEvents,
+ WSAAddressToStringA,
+ WSAAddressToStringW,
+ WSAEnumNameSpaceProvidersA,
+ WSAEnumNameSpaceProvidersW,
+ WSAGetServiceClassInfoA,
+ WSAGetServiceClassInfoW,
+ WSAGetServiceClassNameByClassIdA,
+ WSAGetServiceClassNameByClassIdW,
+ WSAInstallServiceClassA,
+ WSAInstallServiceClassW,
+ WSALookupServiceBeginA,
+ WSALookupServiceBeginW,
+ WSALookupServiceEnd,
+ WSALookupServiceNextA,
+ WSALookupServiceNextW,
+ WSARemoveServiceClass,
+ WSASetServiceA,
+ WSASetServiceW,
+ WSAStringToAddressA,
+ WSAStringToAddressW,
+ WSCUnInstallNameSpace,
+ WSCInstallNameSpace,
+ WS2_32_gethostbyaddr,
+ WS2_32_gethostbyname,
+ WS2_32_gethostname,
+ WS2_32_getprotobyname,
+ WS2_32_getprotobynumber,
+ WS2_32_getservbyname,
+ WS2_32_getservbyport,
+ WS2_32_inet_addr,
+ WS2_32_inet_ntoa,
+ __WSAFDIsSet,
+ WS2_32_AcceptEx,
+ WS2_32_CreateIoCompletionPort,
+ WS2_32_GetQueuedCompletionStatus,
+ WS2_32_PostQueuedCompletionStatus,
+ WS2_32_DestroyIoCompletionPort