diff options
| author | ivost <ivost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2009-11-01 00:48:11 +0000 |
|---|---|---|
| committer | ivost <ivost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2009-11-01 00:48:11 +0000 |
| commit | 5b23604234919281293cfbedde11d086ac0fdb03 (patch) | |
| tree | 8ed2f194da1b15bf98946f5b0df6b66b783836a9 /packages/zorba | |
| parent | 6bbb6f0a5a2dd651ab2b323efe15f91cb2d3bea0 (diff) | |
| download | fpc-5b23604234919281293cfbedde11d086ac0fdb03.tar.gz | |
* added zorba header files (www.zorba-xquery.com)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13992 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/zorba')
| -rw-r--r-- | packages/zorba/Makefile | 2354 | ||||
| -rw-r--r-- | packages/zorba/Makefile.fpc | 29 | ||||
| -rw-r--r-- | packages/zorba/Package.fpc | 6 | ||||
| -rw-r--r-- | packages/zorba/fpmake.pp | 48 | ||||
| -rw-r--r-- | packages/zorba/src/zorba.inc | 2116 | ||||
| -rw-r--r-- | packages/zorba/src/zorba.pas | 6 | ||||
| -rw-r--r-- | packages/zorba/src/zorba_error.inc | 911 | ||||
| -rw-r--r-- | packages/zorba/src/zorba_options.inc | 142 | ||||
| -rw-r--r-- | packages/zorba/src/zorba_static_context_consts.inc | 60 | ||||
| -rw-r--r-- | packages/zorba/src/zorbadyn.pas | 7 |
10 files changed, 5679 insertions, 0 deletions
diff --git a/packages/zorba/Makefile b/packages/zorba/Makefile new file mode 100644 index 0000000000..380112b857 --- /dev/null +++ b/packages/zorba/Makefile @@ -0,0 +1,2354 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/11/01] +# +default: all +MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +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 COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +ifndef RUNBATCH +RUNBATCH=$(COMSPEC) /C +endif +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 DEFAULT_FPCDIR=../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +else +ifeq ($(strip $(wildcard $(FPC))),) +FPC:=$(firstword $(FPCPROG)) +endif +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +FOUNDFPC:=$(strip $(wildcard $(FPC))) +ifeq ($(FOUNDFPC),) +FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) +ifeq ($(FOUNDFPC),) +$(error Compiler $(FPC) not found) +endif +endif +ifndef FPC_COMPILERINFO +FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) +endif +ifndef FPC_VERSION +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) +ifeq ($(CPU_TARGET),armeb) +ARCH=arm +override FPCOPT+=-Cb +else +ifeq ($(CPU_TARGET),armel) +ARCH=arm +override FPCOPT+=-CaEABI +else +ARCH=$(CPU_TARGET) +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +TARGETSUFFIX=$(FULL_TARGET) +SOURCESUFFIX=$(FULL_SOURCE) +endif +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +ifeq ($(findstring makefile,$(MAKECMDGOALS)),) +ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_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 ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX 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 CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifeq ($(OS_TARGET),darwin) +ifeq ($(OS_SOURCE),darwin) +DARWIN2DARWIN=1 +endif +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +ifndef DARWIN2DARWIN +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +override PACKAGE_NAME=zorba +override PACKAGE_VERSION=0.9.9 +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-haiku) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-darwin) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),avr-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),armeb-linux) +override TARGET_UNITS+=zorba zorbadyn +endif +ifeq ($(FULL_TARGET),armeb-embedded) +override TARGET_UNITS+=zorba zorbadyn +endif +override INSTALL_FPCPACKAGE=y +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-win32) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-os2) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-beos) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-haiku) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-solaris) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-qnx) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-netware) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-darwin) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-emx) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-watcom) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-wince) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-symbian) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-atari) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),sparc-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-palmos) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-darwin) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-wince) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-gba) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-nds) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),arm-symbian) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),avr-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),armeb-linux) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),armeb-embedded) +override COMPILER_INCLUDEDIR+=src +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-win32) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-os2) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-beos) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-haiku) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-solaris) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-qnx) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-netware) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-darwin) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-emx) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-watcom) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-wince) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),i386-symbian) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-atari) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),sparc-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-palmos) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-darwin) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-wince) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-gba) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-nds) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),arm-symbian) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),avr-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),armeb-linux) +override COMPILER_SOURCEDIR+=src tests examples +endif +ifeq ($(FULL_TARGET),armeb-embedded) +override COMPILER_SOURCEDIR+=src tests examples +endif +override SHARED_BUILD=n +override SHARED_BUILD=n +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 COMPILER_UNITTARGETDIR +ifdef PACKAGEDIR_MAIN +COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) +else +COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) +endif +endif +ifndef COMPILER_TARGETDIR +COMPILER_TARGETDIR=. +endif +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 +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +ifdef CROSSCOMPILE +ifdef CROSSINSTALL +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +endif +endif +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +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 +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/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 +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),haiku) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=hai +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +IMPORTLIBPREFIX=imp +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +IMPORTLIBPREFIX=imp +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +IMPORTLIBPREFIX=imp +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +IMPORTLIBPREFIX= +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nw +IMPORTLIBPREFIX=imp +endif +ifeq ($(OS_TARGET),netwlibc) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nwl +IMPORTLIBPREFIX=imp +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +IMPORTLIBPREFIX=imp +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +FPCMADE=fpcmade.$(SHORTSUFFIX) +ZIPSUFFIX=$(SHORTSUFFIX) +ZIPCROSSPREFIX= +ZIPSOURCESUFFIX=src +ZIPEXAMPLESUFFIX=exm +else +FPCMADE=fpcmade.$(TARGETSUFFIX) +ZIPSOURCESUFFIX=.source +ZIPEXAMPLESUFFIX=.examples +ifdef CROSSCOMPILE +ZIPSUFFIX=.$(SOURCESUFFIX) +ZIPCROSSPREFIX=$(TARGETSUFFIX)- +else +ZIPSUFFIX=.$(TARGETSUFFIX) +ZIPCROSSPREFIX= +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_ECHO +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_DATE +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_GINSTALL +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_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= __missing_command_MVPROG +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef MKDIRPROG +MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG= __missing_command_MKDIRPROG +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +endif +export MKDIRPROG +ifndef ECHOREDIR +ifndef inUnix +ECHOREDIR=echo +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +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_PPUMOVE +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +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=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-haiku) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-darwin) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),avr-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),armeb-linux) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(FULL_TARGET),armeb-embedded) +REQUIRE_PACKAGES_RTL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_RTL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(ARCH) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(ARCH) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +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 +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +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 +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +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 AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_units +ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),) +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: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(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 +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(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 %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.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))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +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$(CPU_TARGET)-$(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_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/../fpc-pack +else +PACKDIR=/tmp/fpc-pack +endif +endif +ifndef ZIPNAME +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(PACKAGE_NAME) +endif +endif +ifndef FULLZIPNAME +FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX) +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install +endif +endif +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif +ifndef inUnix +USEZIPWRAPPER=1 +endif +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif +fpc_zipinstall: + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 + $(MKDIR) $(DIST_DESTDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) +else + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else +ifdef RUNBATCH + $(RUNBATCH) $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX) +fpc_zipexampleinstall: +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX) +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall +.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))) $(addprefix $(IMPORTLIBPREFIX),$(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_cleanall: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef COMPILER_UNITTARGETDIR +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +endif + -$(DELTREE) units + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) +ifneq ($(PPUEXT),.ppu) + -$(DEL) *.o *.ppu *.a +endif + -$(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 +fpc_distclean: cleanall +.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) SourceSuffix. $(SOURCESUFFIX) + @$(ECHO) TargetSuffix. $(TARGETSUFFIX) + @$(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) ZipName.............. $(ZIPNAME) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) FullZipName.......... $(FULLZIPNAME) + @$(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 +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_makefiles +.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif +.NOTPARALLEL: diff --git a/packages/zorba/Makefile.fpc b/packages/zorba/Makefile.fpc new file mode 100644 index 0000000000..837ff75cb5 --- /dev/null +++ b/packages/zorba/Makefile.fpc @@ -0,0 +1,29 @@ +# +# Makefile.fpc for sqlite implementation +# + +[package] +name=zorba +version=0.9.9 + +[target] +units=zorba zorbadyn + +[require] + +[install] +fpcpackage=y + +[default] +fpcdir=../.. + +[compiler] +includedir=src +sourcedir=src tests examples + +[shared] +build=n + +[rules] +.NOTPARALLEL: + diff --git a/packages/zorba/Package.fpc b/packages/zorba/Package.fpc new file mode 100644 index 0000000000..7c7e588731 --- /dev/null +++ b/packages/zorba/Package.fpc @@ -0,0 +1,6 @@ +[package] +name=zorba +version=0.9.9 +[require] +packages=rtl +packages_linux_x86_64= diff --git a/packages/zorba/fpmake.pp b/packages/zorba/fpmake.pp new file mode 100644 index 0000000000..b5acd158ce --- /dev/null +++ b/packages/zorba/fpmake.pp @@ -0,0 +1,48 @@ +{$ifndef ALLPACKAGES} +{$mode objfpc}{$H+} +program fpmake; + +uses fpmkunit; + +Var + P : TPackage; + T : TTarget; +begin + With Installer do + begin +{$endif ALLPACKAGES} + + P:=AddPackage('zorba'); +{$ifdef ALLPACKAGES} + P.Directory:='zorba'; +{$endif ALLPACKAGES} + P.Version:='0.9.9'; + P.SourcePath.Add('src'); + P.IncludePath.Add('src'); + + T:=P.Targets.AddUnit('zorbadyn.pas'); + with T.Dependencies do + begin + AddInclude('zorba.inc'); + AddInclude('zorba_error.inc'); + AddInclude('zorba_options.inc'); + AddInclude('zorba_static_context_consts.inc'); + end; + T:=P.Targets.AddUnit('zorba.pas'); + with T.Dependencies do + begin + AddInclude('zorba.inc'); + AddInclude('zorba_error.inc'); + AddInclude('zorba_options.inc'); + AddInclude('zorba_static_context_consts.inc'); + end; + +// P.ExamplePath.Add('tests/'); +// P.Targets.AddExampleProgram('testapiv3x.pp'); +// P.Targets.AddExampleProgram('test.pas'); + +{$ifndef ALLPACKAGES} + Run; + end; +end. +{$endif ALLPACKAGES} diff --git a/packages/zorba/src/zorba.inc b/packages/zorba/src/zorba.inc new file mode 100644 index 0000000000..72a59470ca --- /dev/null +++ b/packages/zorba/src/zorba.inc @@ -0,0 +1,2116 @@ +{$mode objfpc}{$H+} +{$PACKRECORDS C} +{$MACRO ON} + +interface + +uses + ctypes, dynlibs; + +{$IFDEF UNIX} + {$DEFINE extdecl:=cdecl} + const + zorbalib = 'libzorba_simplestore.'+sharedsuffix; + zorbavlib = zorbalib+'.0.9.9'; +{$ENDIF} +{$IFDEF WINDOWS} + {$DEFINE extdecl:=stdcall} + const + zorbalib = 'zorba_simplestore.dll'; + zorbavlib = zorbalib; +{$ENDIF} + +{$IFDEF LOAD_DYNAMICALLY} + {$DEFINE D} +{$ELSE} + {$DEFINE S} +{$ENDIF} + + +(* + * Copyright 2006-2008 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +{.$i zorba_config.inc} +{$i zorba_error.inc} +{$i zorba_static_context_consts.inc} +{$i zorba_options.inc} + +type + pfile = pointer; + + XQC_Implementation = ^XQC_Implementation_s; + XQC_Implementation_Ref = ^XQC_Implementation; + + XQC_Query = ^XQC_Query_s; + XQC_Query_Ref = ^XQC_Query; + + XQC_StaticContext = ^XQC_StaticContext_s; + XQC_StaticContext_Ref = ^XQC_StaticContext; + + XQC_DynamicContext = ^XQC_DynamicContext_s; + XQC_DynamicContext_Ref = ^XQC_DynamicContext; + + XQC_Sequence = ^XQC_Sequence_s; + XQC_Sequence_Ref = ^XQC_Sequence; + + XQC_Item = ^XQC_Item_s; + XQC_Item_Ref = ^XQC_Item; + + XQC_ItemFactory = ^XQC_ItemFactory_s; + XQC_ItemFactory_Ref = ^XQC_ItemFactory; + + XQC_Collection = ^XQC_Collection_s; + XQC_Collection_Ref = ^XQC_Collection; + + XQC_DataManager = ^XQC_DataManager_s; + XQC_DataManager_Ref = ^XQC_DataManager; + + XQC_OutputStream = ^XQC_OutputStream_s; + XQC_InputStream = ^XQC_InputStream_s; + XQC_ErrorHandler = ^XQC_ErrorHandler_s; + + +// external functions + external_function_init = procedure(user_data: PPointer; global_user_data: Pointer); extdecl; + + external_function_next = function(args: XQC_Sequence; argc: cint; result: XQC_Item_Ref; + user_data: Pointer; global_user_data: Pointer): XQUERY_ERROR; extdecl; + + external_function_release = procedure(user_data: Pointer; global_user_data: Pointer); extdecl; + + +(** + * The ::XQC_Implementation struct provides factory functions for parsing queries. + * An XQC_Implementation object is thread-safe and can be used by multiple threads + * of execution at the same time. + * + * Creating an XQC_Implementation object can be done using the zorba_implementation function. + * Once created, the user is responsible for freeing the object by calling + * the free() function. + * The XQC_Implementation object should not be freed before all objects created using it's + * functions have been freed - doing so causes undefined behaviour. + *) + XQC_Implementation_s = record + (** + * Creates a static context suitable for use in the parse() and parse_file() + * functions. The user is responsible for freeing the ::XQC_StaticContext object returned by calling + * XQC_StaticContext::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of + * \param[out] context The newly created XQC_StaticContext object. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + create_context: function(impl: XQC_Implementation; out context: XQC_StaticContext): XQUERY_ERROR; extdecl; + + (** + * Prepares a query from a string, returning an ::XQC_Query object. + * The user is responsible for freeing the ::XQC_Query object + * returned by calling XQC_Query::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of. + * \param string The query to prepare as a string. + * \param context The initial static context for this query, or null to use the default + * static context. + * \param handler An optional error handler whose <code>error</code> function is called + * if preparing the query fails. + * \param[out] expression The resulting prepared expression. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval An XQuery static or type error (e.g. XPST*, XPTY* ) + *) + prepare: function(impl: XQC_Implementation; query_string: pcchar; context: XQC_StaticContext; + handler: XQC_ErrorHandler; out query: XQC_Query): XQUERY_ERROR; extdecl; + + (** + * Prepares a query from a FILE pointer, returning an ::XQC_Query object. + * The user remains responsible for closing the file after parsing. + * The user is responsible for freeing the ::XQC_Query object returned by + * calling XQC_Query::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of. + * \param file The file containing the query to prepare. + * \param context The initial static context for this query, or null to use the default + * static context. + * \param handler An optional error handler whose <code>error</code> function is called + * if preparing the query fails. + * \param[out] expression The resulting prepared expression. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval An XQuery static or type error (e.g. XPST*, XPTY* ) + *) + prepare_file: function(impl: XQC_Implementation; query_file: pfile; context: XQC_StaticContext; + handler: XQC_ErrorHandler; out query: XQC_Query): XQUERY_ERROR; extdecl; + + (** + * Prepares a query from a ::XQC_InputStream, returning an ::XQC_Query object. + * The user is responsible for freeing the ::XQC_Query object returned by + * calling XQC_Query::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of. + * \param stream The input stream returning the query to prepare. + * free will be called on the XQC_InputStream after the query has been read. + * \param context The initial static context for this query, or null to use the default + * static context. + * \param handler An optional error handler whose <code>error</code> function is called + * if preparing the query fails. + * \param[out] expression The resulting prepared expression. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval An XQuery static or type error (e.g. XPST*, XPTY* ) + *) + prepare_stream: function(impl: XQC_Implementation; stream: XQC_InputStream; context: XQC_StaticContext; + handler: XQC_ErrorHandler; out query: XQC_Query): XQUERY_ERROR; extdecl; + + + (** + * Creates an item wrapper suitable for use in the ::XQC_Sequence::next function or + * the ::XQC_ItemFactory::create functions. + * The user is responsible for freeing the XQC_Item object returned by calling + * XQC_Item::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of + * \param[out] item The newly created XQC_Item wrapper object. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + create_item: function(impl: XQC_Implementation; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a XQC_ItemFactory that can be used for creating items, i.e. instances of the + * XQuery data model (XDM). + * The user is responsible for freeing the XQC_ItemFactory object returned by calling + * XQC_ItemFactory::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of + * \param[out] factory The newly created XQC_ItemFactory object. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + item_factory: function(impl: XQC_Implementation; out factory: XQC_ItemFactory): XQUERY_ERROR; extdecl; + + + (** + * Creates a XQC_DataManager that can be used for managing collections and documents. + * The user is responsible for freeing the XQC_DataManager object returned by calling + * XQC_DataManager::free(). + * + * \param implementation The XQC_Implementation that this function pointer is a member of + * \param[out] data_manager The newly created XQC_DataManager object. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + data_manager: function(impl: XQC_Implementation; out data_manager: XQC_DataManager): XQUERY_ERROR; extdecl; + + + (** + * Called to free the resources associated with the XQC_Implementation. + * + * \param implementation The XQC_Implementation that this function pointer is a member of + *) + free: procedure(impl: XQC_Implementation); extdecl; + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * The ::XQC_Expression struct represents a pre-parsed query, and allows the user to execute + * that query any number of times. An ::XQC_Expression object is thread-safe and + * can be used by multiple threads of execution at the same time. + * + * ::XQC_Expression objects are created by calling the XQC_Implementation::prepare() or + * XQC_Implementation::prepare_file() functions. + * Once created, the user is responsible for freeing the object by calling the free() function. + * The ::XQC_Expression object should be freed before the ::XQC_Implementation object + * that created it. + *) + XQC_Query_s = record + (** + * This function returns the dynamic context that belongs to this query and + * is used during query execution. + * The context can be used, for example, to set values of external variables, + * the default collation, or the current datetime. + * It is only available if the query has been compiled, otherwise + * an error is reported. Moreover, the context must not be modified during the + * execution of a query (i.e. if a ResultIterator is opened). + * The user is responsible for freeing the ::XQC_DynamicContext object returned by calling + * XQC_DynamicContext::free(). + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + get_dynamic_context: function(query: XQC_Query; out context: XQC_DynamicContext): XQUERY_ERROR; extdecl; + + + (** + * This function returns the static context that belongs to this query. + * The static context is only available if the query has been compiled, otherwise + * an error is reported. + * The context has all the components and values that have been set by the either + * the static context that was passed when creating the query and and those that + * were set in the prolog of the query. + * Note that after compilation of the query the static context is a read only structure. + * The user is responsible for freeing the ::XQC_StaticContext object returned by calling + * XQC_StaticContext::free(). + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + get_static_context: function(query: XQC_Query; out context: XQC_StaticContext): XQUERY_ERROR; extdecl; + + + (** + * Executes the query represented by the XQC_Query object and prints the serialized XML + * output to the given FILE pointer. The user remains responsible for closing + * the file. + * + * \param query The XQC_Query that this function pointer is a member of. + * \param file The FILE pointer to print the serialized result to. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY + * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY* ) + *) + execute: function(query: XQC_Query; fileptr: pfile): XQUERY_ERROR; extdecl; + + + (** + * Executes the query represented by the XQC_Query object and prints the serialized + * output to the given FILE pointer. The target format of the serialization is + * specified by the passed serializer options. + * + * \param query The XQC_Query that this function pointer is a member of. + * \param options The Zorba_SerializerOptions_t that specifies serializer options. + * \param file The FILE pointer to print the serialized result to. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY + * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY* ) + *) + serialize_file: function(query: XQC_Query; options: pZorba_SerializerOptions_t; fileptr: pfile): XQUERY_ERROR; extdecl; + + + (** + * Executes the query represented by the XQC_Query object and writes the serialized + * output to the given ::XQC_OutputStream. The target format of the serialization is + * specified by the passed serializer options. + * + * \param query The XQC_Query that this function pointer is a member of. + * \param options The Zorba_SerializerOptions_t that specifies serializer options. + * \param file The XQC_OutputStream to print the serialized result to. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY + * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) + serialize_stream: function(query: XQC_Query; options: pZorba_SerializerOptions_t; stream: XQC_OutputStream): XQUERY_ERROR; extdecl; + + + (** + * Checks if the query is an updating query. + * + * \param query The XQC_Query that this function pionter is a member of. + * + * \retval 1 if query is updating query, else 0 + *) + is_update_query: function(query: XQC_Query): cint; extdecl; + + + (** + * Applies the updates declared in the query represented by the XQC_Query object. + * + * \param query The XQC_Query that this function pointer is a member of. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY + * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) + apply_updates: function(query: XQC_Query): XQUERY_ERROR; extdecl; + + + (** + * Executes the query represented by the XQC_Query object. + * An ::XQC_Sequence object is returned which can be used to examine the results + * of the query execution. The user is responsible for freeing the + * ::XQC_Sequence object returned by calling XQC_Sequence::free(). + * + * \param query The XQC_Query that this function pointer is a member of. + * \param[out] sequence The newly created XQC_Sequence object. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0024_CANNOT_ITERATE_OVER_UPDATE_QUERY + * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY* ) + *) + sequence: function(query: XQC_Query; out sequence: XQC_Sequence): XQUERY_ERROR; extdecl; + + + (** + * Sets the error handler whose <code>error</code> function is called + * if an error occurs when executing the query. + * The user keeps the ownership of this object and is required to freeing + * the aquired resources. + *) + set_error_handler: procedure(query: XQC_Query; handler: XQC_ErrorHandler); extdecl; + + + (** + * Called to free the resources associated with the XQC_Query. + * + * \param query The XQC_Query that this function pointer is a member of. + *) + free: procedure(query: XQC_Query); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * The ::XQC_StaticContext struct provides a way to specify values for the static context of + * the query to be prepared. An ::XQC_StaticContext object is not thread-safe - threads should + * each use their own instance of a ::XQC_StaticContext object (see create_child_context). + * + * ::XQC_StaticContext objects are created by calling the XQC_Implementation::create_context() + * function. Once created, the user is responsible for freeing the object by calling + * the free() function. + * The ::XQC_StaticContext object should be freed before the ::XQC_Implementation object that + * created it. + *) + XQC_StaticContext_s = record + (** + * Creates a child context of the given static context. + * A child context contains the same information as it's parent context but + * it allows the user to override and add information. + * The user is responsible for freeing the ::XQC_StaticContext object returned by calling + * XQC_StaticContext::free(). + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] child_context The newly created XQC_StaticContext object which is + * a child of the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + create_child_context: function(context: XQC_StaticContext; out child_context: XQC_StaticContext): XQUERY_ERROR; extdecl; + + + (** + * Adds a (prefix, uri) pair to the set of statically known namespaces of + * the given context. + * + * \param context The XQC_StaticContext that this function pointer is a member of. + * \param prefix The prefix of the namespace to add to the given XQC_StaticContext. + * \param uri The uri of the namespace to add to the given XQC_StaticContext. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + declare_ns: function(context: XQC_StaticContext; const prefix: pcchar; const uri: ppchar): XQUERY_ERROR; extdecl; + + + (** + * Returns the namespace uri that belongs to the given prefix. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param prefix The prefix of the namespace to add to the given XQC_StaticContext. + * \param[out] result_ns The namespace uri of the namespace registered with the given prefix. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_ns_by_prefix: function(context: XQC_StaticContext; const prefix: pcchar; out result_ns: ppchar): XQUERY_ERROR; extdecl; + + + (** + * Sets the value of the default namespace for elements and types. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param uri The uri of the default element and type namespace to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_default_element_and_type_ns: function(context: XQC_StaticContext; const uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Returns the default namespace for elements and types. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] uri The uri of the default element and type namespace that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_default_element_and_type_ns: function(context: XQC_StaticContext; out uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Sets the default namespace for functions. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param uri The uri of the default function namespace to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_default_function_ns: function(context: XQC_StaticContext; const uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Returns the default namespace for functions set in this static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] uri The uri of the default function namespace that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_default_function_ns: function(context: XQC_StaticContext; out uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Add a collation URI. + * The URI specifies the locale and collation strength of the collation that is added. + * A valid collation URI must begin with http://www.flworfound.org/collations/. + * This prefix is followed by a collation strength (i.e. PRIMARY, SECONDARY, TERTIARY, + * QUATTERNARY, or IDENTICAL) followed by a '/'. + * After the strength a lower-case two- or three-letter ISO-639 language code must follow. + * The URI may end with an upper-case two-letter ISO-3166. + * For example, http://www.flworfound.org/collations/PRIMARY/en/US + * specifies an english language with US begin the country.. + * + * Internally, ICU is used for comparing strings. For detailed description see + * http://www.icu-project.org/apiref/icu4c/classCollator.html + * and http://www.icu-project.org/apiref/icu4c/classLocale.html + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param uri The URI of the collation to add. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQST0038 + * \retval ::XQC_INTERNAL_ERROR + *) + add_collation: function(context: XQC_StaticContext; const uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Set the URI of the default collation. + * (see http://www.w3.org/TR/xquery/#static_context) + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param uri The URI of the default collation to set + * + * \retval ::XQC_NO_ERROR + * \retval ::XQST0038 + * \retval ::XQC_INTERNAL_ERROR + *) + set_default_collation: function(context: XQC_StaticContext; const uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Get the URI of the default collation. The uri returned is valid + * as long as the corresponding XQC_StaticContext object is valid. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] uri The URI of the default collation that is currently set in the given context. + *) + get_default_collation: function(context: XQC_StaticContext; out uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Sets the XQuery processor's version to either xquery_version_1_0 or xquery_version_1_1. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param mode The xquery_version_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_xquery_version: function(context: XQC_StaticContext; mode: xquery_version_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the XQuery processor's version that is set in the given static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] mode The xquery_version_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_xquery_version: function(context: XQC_StaticContext; out mode: xquery_version_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the XPath 1.0 compatibility mode to either xpath1_0 or xpath2_0. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param mode The xpath1_0compatib_mode_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_xpath1_0_mode: function(context: XQC_StaticContext; mode: xpath1_0compatib_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the XPath 1.0 compatibility that is set in the given static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] mode The xpath1_0compatib_mode_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_xpath1_0_mode: function(context: XQC_StaticContext; out mode: xpath1_0compatib_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the construction mode to either preserve_cons or strip_cons. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param mode The construction_mode_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_construction_mode: function(context: XQC_StaticContext; mode: construction_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the construction mode that is set in the given static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] mode The construction_mode_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_construction_mode: function(context: XQC_StaticContext; out mode: construction_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the ordering mode to either order or unordered. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param mode The ordering_mode_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_ordering_mode: function(context: XQC_StaticContext; mode: ordering_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the ordering mode that is set in the given static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] mode The ordering_mode_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_ordering_mode: function(context: XQC_StaticContext; out mode: ordering_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the default order mode for empty sequences to either empty_least or + * empty_greatest + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param mode The order_empty_mode_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_default_order_empty_sequences: function(context: XQC_StaticContext; mode: order_empty_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the default order mode for empty sequences that is set in the given + * static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] mode The order_empty_mode_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_default_order_empty_sequences: function(context: XQC_StaticContext; out mode: order_empty_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the boundary space policy to either preserve_space or strip_space. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param mode The boundary_space_mode_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_boundary_space_policy: function(context: XQC_StaticContext; mode: boundary_space_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the boundary space policy that is set in the given static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] mode The boundary_space_mode_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_boundary_space_policy: function(context: XQC_StaticContext; out mode: boundary_space_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the copy namespace mode which consists of the preserve and the inherit mode. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param preserve The preserve_mode_t to set in the given context. + * \param inherit The inherit_mode_t to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_copy_ns_mode: function(context: XQC_StaticContext; mode: preserve_mode_t; inherit: inherit_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Returns the copy namespace mode as a pair consisting of the preserve and the inherit + * mode. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] preserve The preserve_mode_t that is set in the given context. + * \param[out] inherit The inherit_mode_t that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_copy_ns_mode: function(context: XQC_StaticContext; out mode: preserve_mode_t; out inherit: inherit_mode_t): XQUERY_ERROR; extdecl; + + + (** + * Sets the base uri in the given static context. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param base_uri The base uri to set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_base_uri: function(context: XQC_StaticContext; const base_uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Returns the base uri that is set in the given static context. + * The returned base uri is only valid as long as the corresponding static context + * is valid. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param[out] base_uri The base uri that is set in the given context. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_base_uri: function(context: XQC_StaticContext; out base_uri: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Register an external function that can be called within a query. + * One external function consists of three function parameters, i.e. init, next, and release. + * + * \param context The XQC_StaticContext that this function pointer is a member of + * \param uri The URI of the external function to add. + * \param localname The localname of the function to add. + * \param init A callback function pointer that is called once when the external function + * is initialized. The init function gets the global_user_data pointer + * as parameter. + * \param next A callback function pointer that is called each time the corresponding + * XQuery function is executed. + * \param release A callback function pointer that is called once when the external function + * is deinitialized. + * \param global_user_data User specific data that is passed to the init function as a parameter. + * + * \retval ::XQC_NO_ERROR + * \retval ::API0019_FUNCTION_ALREADY_REGISTERED, + * \retval ::XQC_INTERNAL_ERROR + *) + register_external_function: function(context: XQC_StaticContext; const uri, localname: pcchar; init: external_function_init; + next: external_function_next; release: external_function_release; global_user_data: pointer): XQUERY_ERROR; extdecl; + + + (** + * Called to free the resources associated with the XQC_StaticContext. + * + * \param context The XQC_StaticContext that this function pointer is a member of + *) + free: procedure(context: XQC_StaticContext); extdecl; + + + (** + * for internal use only + *) + data: Pointer; + end; + + +(** + * An object of the type ::XQC_DynamicContext contains the information that is available at the + * time the query is executed. It contains the information that is defined in the %XQuery + * specification (see http://www.w3.org/TR/xquery/#eval_context). + * An instance of this struct can be retrieved by calling the <code>get_dynamic_context</code> function + * of an ::XQC_Query object. + *) + XQC_DynamicContext_s = record + (** + * Sets the context item to the given ::XQC_Item. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param value The XQC_Item for the context item. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_context_item: function(context: XQC_DynamicContext; value: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Sets the context item to the document given by the FILE pointer. + * The provided document is accessible by the provided doc_uri. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param doc_uri The URI referencing the given document + * \param document The document to which the context item should be set as a FILE pointer. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0016_LOADER_IO_ERROR, + * \retval ::XQP0017_LOADER_PARSING_ERROR, + * \retval ::XQC_INTERNAL_ERROR + *) + set_context_document: function(context: XQC_DynamicContext; const doc_uri: pcchar; document: pfile): XQUERY_ERROR; extdecl; + + + (** + * Sets the external variable to the value given. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param qname The qname of the external variable to set + * \param value The XQC_Item value for the variable. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_variable_item: function(context: XQC_DynamicContext; const qname: pcchar; value: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Sets the external variable to the sequence given. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param qname The qname of the external variable to set + * \param value The XQC_Sequence value for the variable. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_variable_sequence: function(context: XQC_DynamicContext; const qname: pcchar; value: XQC_Sequence): XQUERY_ERROR; extdecl; + + + (** + * Sets the external variable to the document given by the FILE pointer. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param var_qname The qname of the external variable to set + * \param doc_uri The URI referencing the given document + * \param document The document to which the context item should be set as a FILE pointer. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0016_LOADER_IO_ERROR, + * \retval ::XQP0017_LOADER_PARSING_ERROR, + * \retval ::XQC_INTERNAL_ERROR + *) + set_variable_document: function(context: XQC_DynamicContext; const var_qname, doc_uri: pcchar; document: pfile): XQUERY_ERROR; extdecl; + + + (** + * Sets the implicit timezone parameter. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param timezone The implicit timezone to set + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_implicit_timezone: function(context: XQC_DynamicContext; timezone: cint): XQUERY_ERROR; extdecl; + + + (** + * Defines the value of the default collection that is used when calling the + * fn:collection function without a parameter. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + * \param collection_uri the URI of the collection used by the fn:collection function. + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + set_default_collection: function(context: XQC_DynamicContext; collection_uri: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Called to free the resources associated with the XQC_DynamicContext. + * + * \param context The XQC_DynamicContext that this function pointer is a member of + *) + free: procedure(context: XQC_DynamicContext); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * This struct is Zorba's representation of an Item as defined in the + * XQuery 1.0 and XPath 2.0 Data Model (XDM); see http://www.w3.org/TR/xpath-datamodel/. + * + * Instances of the XDM are a sequence, i.e. an ordered collection of zero or more items. + * In the Zorba API, a sequence is represented by the XQC_Sequence struct. + * + * The Item class is the union of all XQuery node and atomic types. + * The class provides functions to access the information of an Item. Note that not + * all functions are defined on every Item kind. If a function is called on an Item that + * does not provide the function called, an XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE error + * is raised. + * + * A new atomic Item can be created using the ItemFactory. A new node Item should be created + * by the result of a query. + *) + XQC_Item_s = record + (** + * The string value is the string that is extracted by calling the fn:string function + * on the Item (see http://www.w3.org/TR/xpath-functions/#func-string). + * Note that this function is available for all types of Items. + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] string_value The string-value of the given item. + * This string is valid as long as the given item is valid. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + string_value: function(item: XQC_Item; out string_value: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Get the (optional) value of a QName's prefix. + * Note that this function is only available for Items of type QName. + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] prefix The prefix of the given QName item. + * This string is valid as long as the given item is valid. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + prefix: function(item: XQC_Item; out prefix: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Get the (optional) value of a QName's namespace. + * Note that this function is only available for Items of type QName. + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] namespace The namespace of the given QName item. + * This string is valid as long as the given item is valid. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + ns: function(item: XQC_Item; out ns: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Get the value of a QName's localname. + * Note that this function is only available for Items of type QName. + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] localname The localname of the given QName item. + * This string is valid as long as the given item is valid. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + localname: function(item: XQC_Item; out local_name: pcchar): XQUERY_ERROR; extdecl; + + + (** + * Get the bool value of the boolean Item. + * Note that this function is only available for Items of type boolean. + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] bool_value 1 if the boolean value of the given item is true, 0 otherwise. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + boolean_value: function(item: XQC_Item; out bool_value: cint): XQUERY_ERROR; extdecl; + + + (** + * Check if the value of the Item is not a number (NaN). + * Note that this function is implemented for all item types but may only return + * 1 for a numeric item (e.g. Double or Float). + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] is_nan 1 if the given item is not a number, 0 otherwise. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + nan: function(item: XQC_Item; out is_nan: cint): XQUERY_ERROR; extdecl; + + + (** + Check if the value of the Item is positive or negative infinity. + * Note that this function is only available for numeric items (e.g. Double or Float). + * + * \param item The XQC_Item that this function pointer is a member of + * \param[out] inf 1 if the given item is +/-INF, 0 otherwise. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE + *) + pos_or_neg_inf: function(item: XQC_Item; out pos_or_neg_inf: cint): XQUERY_ERROR; extdecl; + + + (** + * Called to free the resources associated with the XQC_Item. + * + * \param item The XQC_Item that this function pointer is a member of + *) + free: procedure(item: XQC_Item); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * An instance of this class can be obtained by calling <code>item_factory</code> function + * of an ::XQC_Implementation object. + * + * Each <code>create_XXX</code> function of this struct creates an ::XQC_Item of an XML Schema item. + * Each of the functions takes either NULL or a valid XQC_Item wrapper. The latter is created + * by calling <code>XQC_Implementation::create_item</code>. In both cases, the user is responsible + * for freeing the object by calling the XQC_Item::free() function. + *) + XQC_ItemFactory_s = record + (** + * Creates a String Item see [http://www.w3.org/TR/xmlschema-2/#string]. + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param str The string as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_string: function(factory: XQC_ItemFactory; const str: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates an AnyURI Item see [http://www.w3.org/TR/xmlschema-2/#anyURI] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param str The uri as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_anyuri: function(factory: XQC_ItemFactory; const str: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a QName Item see [http://www.w3.org/TR/xmlschema-2/#QName] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param str The uri as a char pointer. + * \param localname The localname as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_qname2: function(factory: XQC_ItemFactory; const uri, localname: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a QName Item see [http://www.w3.org/TR/xmlschema-2/#QName] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param str The uri as a char pointer. + * \param prefix The prefix as a char pointer. + * \param localname The localname as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_qname3: function(factory: XQC_ItemFactory; const uri, prefix, localname: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Boolean Item see [http://www.w3.org/TR/xmlschema-2/#bool] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param boolean 0 for a boolean <code>false</code> boolean item, 1 otherwise. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_boolean: function(factory: XQC_ItemFactory; boolean: cint; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a NCName Item see [http://www.w3.org/TR/xmlschema-2/#NCName] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param ncname The NCName as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_ncname: function(factory: XQC_ItemFactory; const ncname: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Base64Binary Item see [http://www.w3.org/TR/xmlschema-2/#base64Binary] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param binary_data The binary data as a char pointer. + * \param letter The length of the binary data. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_base64binary: function(factory: XQC_ItemFactory; const binary_data: pcchar; length: csize_t; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Decimal Item see [http://www.w3.org/TR/xmlschema-2/#decimal] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The value as a doule + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_decimal: function(factory: XQC_ItemFactory; value: cdouble; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Decimal Item see [http://www.w3.org/TR/xmlschema-2/#decimal] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The value as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_decimal_char: function(factory: XQC_ItemFactory; const value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates an Integer Item see [http://www.w3.org/TR/xmlschema-2/#integer] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param integer_value The value as a long long. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_integer: function(factory: XQC_ItemFactory; const integer_value: clonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates an Integer Item see [http://www.w3.org/TR/xmlschema-2/#integer] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param integer_value The value as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_integer_char: function(factory: XQC_ItemFactory; const integer_value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Long Item see [http://www.w3.org/TR/xmlschema-2/#long] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param long_value The value as a long long. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_long: function(factory: XQC_ItemFactory; const long_value: clonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Int Item see [http://www.w3.org/TR/xmlschema-2/#int] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param int_value The value as an int. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_int: function(factory: XQC_ItemFactory; const int_value: cint; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Short Item see [http://www.w3.org/TR/xmlschema-2/#short] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param short_value The value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_short: function(factory: XQC_ItemFactory; const short_value: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Byte Item see [http://www.w3.org/TR/xmlschema-2/#byte] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param byte_value The byte value as a char. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_byte: function(factory: XQC_ItemFactory; const byte_value: cchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Date Item see [http://www.w3.org/TR/xmlschema-2/#date] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param date_value The date value as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_date_char: function(factory: XQC_ItemFactory; const date_value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Date Item see [http://www.w3.org/TR/xmlschema-2/#date] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param year The year value as a short. + * \param month The month value as a short. + * \param day The day value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_date: function(factory: XQC_ItemFactory; const year, month, day: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a DateTime Item see [http://www.w3.org/TR/xmlschema-2/#dateTime] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param year The year value as a short. + * \param month The month value as a short. + * \param day The day value as a short. + * \param hour The hour value as a short. + * \param minute The minute value as a short. + * \param seconds The seconds value as a short. + * \param timezone_hours The timezone as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_datetime: function(factory: XQC_ItemFactory; const year, month, day, hour, minute: cshort; + seconds: cdouble; timezone_hours: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a DateTime Item see [http://www.w3.org/TR/xmlschema-2/#dateTime] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param datetime_value The string representation of the datetime value as a char pointer + * (for example, 2002-10-10T12:00:00-05:00). + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_datetime_char: function(factory: XQC_ItemFactory; const datetime_value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Double Item see [http://www.w3.org/TR/xmlschema-2/#double] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_double: function(factory: XQC_ItemFactory; const value: cdouble; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Double Item see [http://www.w3.org/TR/xmlschema-2/#double] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The value as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_double_char: function(factory: XQC_ItemFactory; const value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Duration Item see [http://www.w3.org/TR/xmlschema-2/#duration] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param year The year value as a short. + * \param month The month value as a short. + * \param day The day value as a short. + * \param hour The hour value as a short. + * \param minute The minute value as a short. + * \param seconds The seconds value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_duration: function(factory: XQC_ItemFactory; const year, month, day, hour, minute: cshort; + seconds: cdouble; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Float Item see [http://www.w3.org/tr/xmlschema-2/#float] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The float value as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_float: function(factory: XQC_ItemFactory; const value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a gDay Item see [http://www.w3.org/TR/xmlschema-2/#gDay] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param day The day value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_gday: function(factory: XQC_ItemFactory; day: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a gMonth Item see [http://www.w3.org/TR/xmlschema-2/#gMonth] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param month The month value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_gmonth: function(factory: XQC_ItemFactory; month: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a gMonthDay Item see [http://www.w3.org/TR/xmlschema-2/#gMonthDay] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param month The month value as a short. + * \param day The day value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_gmonthday: function(factory: XQC_ItemFactory; month, day: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a gYear Item see [http://www.w3.org/TR/xmlschema-2/#gYear] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param year The year value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_gyear: function(factory: XQC_ItemFactory; year: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a gYearMonth Item see [http://www.w3.org/TR/xmlschema-2/#gYearMonth] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param year The year value as a short. + * \param month The month value as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_gyearmonth: function(factory: XQC_ItemFactory; year, month: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a HexBinary Item see [http://www.w3.org/TR/xmlschema-2/#hexBinary] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param hex_data The hex data as a char pointer. + * \param size The size of the hex data. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_hexbinary: function(factory: XQC_ItemFactory; const hex_data: pcchar; size: csize_t; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a negativeInteger Item see [http://www.w3.org/TR/xmlschema-2/#negativeInteger] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The negative integer as a long long value. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_negativeinteger: function(factory: XQC_ItemFactory; value: clonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a nonNegativeInteger Item see [http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The non-negative integer as an unsigned long long value. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_nonnegativeinteger: function(factory: XQC_ItemFactory; value: culonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a nonPositiveInteger Item see [http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The non-positive integer as a long long value. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_nonpositiveinteger: function(factory: XQC_ItemFactory; value: clonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a positiveInteger Item see [http://www.w3.org/TR/xmlschema-2/#positiveInteger] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The positive integer as an unsigned long long value. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_positiveinteger: function(factory: XQC_ItemFactory; value: culonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Time Item see [http://www.w3.org/TR/xmlschema-2/#time] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The time as a char pointer. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_time_char: function(factory: XQC_ItemFactory; const value: pcchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Time Item see [http://www.w3.org/TR/xmlschema-2/#time] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param hour The hour as a short. + * \param minute The minute as a short. + * \param second The second as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_time: function(factory: XQC_ItemFactory; hour, minute: cshort; second: cdouble; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a Time Item see [http://www.w3.org/TR/xmlschema-2/#time] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param hour The hour as a short. + * \param minute The minute as a short. + * \param second The second as a double. + * \param timezone_hours The timezone hours as a short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_time_timezone: function(factory: XQC_ItemFactory; hour, minute: cshort; second: cdouble; + timezone_hours: cshort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates an Unsigned Byte Item see [http://www.w3.org/TR/xmlschema-2/#unsignedByte] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The unsigned byte value as an unsigned char. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_unsignedbyte: function(factory: XQC_ItemFactory; value: cuchar; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates an unsigned int Item see [http://www.w3.org/TR/xmlschema-2/#unsignedInt] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The unsigned int value as an unsigned int. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_unsignedint: function(factory: XQC_ItemFactory; value: cuint; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates an unsignedLong Item see [http://www.w3.org/TR/xmlschema-2/#unsignedLong] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The unsigned long value as an unsigned long long. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_unsignedlong: function(factory: XQC_ItemFactory; value: culonglong; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Creates a unsignedShort Item see [http://www.w3.org/TR/xmlschema-2/#unsignedShort] + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param value The unsigned short value as an unsigned short. + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::XQP0025_COULD_NOT_CREATE_ITEM + *) + create_unsignedshort: function(factory: XQC_ItemFactory; value: cushort; out item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Called to free the resources associated with the XQC_ItemFactory. + * + * \param factory The XQC_ItemFactory that this function pointer is a member of + * \param[out] item The item to create. This can either be a wrapper created using + * ::XQC_ItemFactory::create_item or a pointer initialized to 0. + *) + free: procedure(factory: XQC_ItemFactory); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * This struct represents an instance of the XQuery 1.0 and XPath 2.0 Data Model (XDM). + * + * See http://www.w3.org/TR/xpath-datamodel/. + *) + XQC_Sequence_s = record + (** + * Get the next item of the sequence. + * + * \param sequence The XQC_Sequence_s that this function pointer is a member of + * \param[out] item The item wrapper that should contain the next item if XQ_NO_ERROR is returned + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval any XQuery type or dynamic error + *) + next: function(sequence: XQC_Sequence; item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * called to free the resources associated with the xqc_itemfactory. + * + * \param sequence the XQC_Sequence that this function pointer is a member of + *) + free: procedure(sequence: XQC_Sequence); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * A Collection is a sequence of Node Items. + * + * Each Collection is created by the XmlDataManager and referenced by a URI. + * The URI can be accessed in a query's fn:collection function. + *) + XQC_Collection_s = record + (** + * Get the URI of a collection as an anyURI Item. + * + * \param collection the XQC_Collection_s that this function pointer is a member of + * \param[out] uri_item The uri item of the given collection. The user is responsible + * for freeing the object by calling the XQC_Item::free() function. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) + get_name: function(collection: XQC_Collection; out name_item: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Adds a Node Item to the Collection + * + * \param collection the XQC_Collection_s that this function pointer is a member of + * \param node The node item to add to the given collection. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0007_COLLECTION_ITEM_MUST_BE_A_NODE + *) + add_node: function(collection: XQC_Collection; node: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Deletes a Node Item from the given Collection + * + * \param collection the XQC_Collection_s that this function pointer is a member of + * \param node The node item to delete from the given collection. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0007_COLLECTION_ITEM_MUST_BE_A_NODE + *) + delete_node: function(collection: XQC_Collection; node: XQC_Item): XQUERY_ERROR; extdecl; + + + (** + * Adds a sequence of Node Items to the Collection + * + * \param collection the XQC_Collection_s that this function pointer is a member of + * \param sequence The sequence of node items to add to the given collection. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + * \retval ::API0007_COLLECTION_ITEM_MUST_BE_A_NODE + *) + add_sequence: function(collection: XQC_Collection; sequence: XQC_Sequence): XQUERY_ERROR; extdecl; + + + (** + * Adds a document given by the FILE pointer to this collection. + * + * \param collection the XQC_Collection_s that this function pointer is a member of + * \param doc The document to add as a FILE pointer. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0016_LOADER_IO_ERROR, + * \retval ::XQP0017_LOADER_PARSING_ERROR, + * \retval ::XQC_INTERNAL_ERROR + *) + add_document: function(collection: XQC_Collection; doc: pfile): XQUERY_ERROR; extdecl; + + + (** + * Adds a document given by the char pointer to this collection. + * + * \param collection the XQC_Collection_s that this function pointer is a member of + * \param doc The document to add as a char pointer. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0016_LOADER_IO_ERROR, + * \retval ::XQP0017_LOADER_PARSING_ERROR, + * \retval ::XQC_INTERNAL_ERROR + *) + add_document_char: function(collection: XQC_Collection; const doc: pchar): XQUERY_ERROR; extdecl; + + + (** + * called to free the resources associated with the xqc_itemfactory. + * + * \param collection the XQC_Collection that this function pointer is a member of + *) + free: procedure(collection: XQC_Collection); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * Using the XmlDataManager one can manage documents and collections. + * + * The XmlDataManager is a singelton instance. The instance can be accessed by calling + * XQC_Implementation::data_manager. The XmlDataManager is thread-safe. + *) + XQC_DataManager_s = record + (** + * This function loads a document from the given FILE pointer. The document + * is identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param doc_uri The URI of the document to load. + * \param document The document to load as a FILE pointer. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0016_LOADER_IO_ERROR, + * \retval ::XQP0017_LOADER_PARSING_ERROR, + * \retval ::XQC_INTERNAL_ERROR + *) + load_document: function(data_manager: XQC_DataManager; const doc_uri: pchar; document: pfile): XQUERY_ERROR; extdecl; + + + (** + * This function loads a document that is retrieved from the given URI location. The document + * is identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param location The URI of the document to load. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0016_LOADER_IO_ERROR, + * \retval ::XQP0017_LOADER_PARSING_ERROR, + * \retval ::XQC_INTERNAL_ERROR + *) + load_document_uri: function(data_manager: XQC_DataManager; const location: pchar): XQUERY_ERROR; extdecl; + + + (** + * Get the document identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param document_uri The URI of the document to retrieve. + * \param[out] doc The Item of the document to get. The user is responsible + * for freeing the object by calling the XQC_Item::free() function. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_document: function(data_manager: XQC_DataManager; const document_uri: pchar; out doc: XQC_Item): XQUERY_ERROR; extdecl; + + + (* + * Delete the document identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param document_uri The URI of the document to delete. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + delete_document: function(data_manager: XQC_DataManager; const document_uri: pchar): XQUERY_ERROR; extdecl; + + + (** + * Create a new collection that is identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param document_uri The URI of the collection to create. + * \param[out] col The collection to create. The user is responsible + * for freeing the object by calling the XQC_Item::free() function. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + create_collection: function(data_manager: XQC_DataManager; const collection_uri: pchar; out col: XQC_Collection): XQUERY_ERROR; extdecl; + + + (** + * Get the collection that is identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param document_uri The URI of the collection to retrieve. + * \param[out] col The collection to retrieve. The user is responsible + * for freeing the object by calling the XQC_Item::free() function. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + get_collection: function(data_manager: XQC_DataManager; const collection_uri: pchar; out col: XQC_Collection): XQUERY_ERROR; extdecl; + + + (** + * Delete the collection that is identified by the given URI. + * + * \param data_manager The XQC_DataManager that this function pointer is a member of + * \param document_uri The URI of the collection to delete. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQC_INTERNAL_ERROR + *) + delete_collection: function(data_manager: XQC_DataManager; const collection_uri: pchar): XQUERY_ERROR; extdecl; + + (** + * Called to free the resources associated with the XQC_DataManager. + * + * \param context The XQC_DataManager that this function pointer is a member of + *) + free: procedure(data_manager: XQC_DataManager); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * The ::XQC_OutputStream struct is designed to be passed to an XQC implementation in order + * to return streaming data (i.e. the result of a query). + *) + XQC_OutputStream_s = record + (** + * The function is called to provide the streaming result of a query + * in the buffer provided. + * + * \param stream The XQC_OutputStream that this function pointer is a member of + * \param buf The buffer that contains the data + * \param length The length of the contents in the buffer + *) + write: procedure(stream: XQC_OutputStream; const buf: pchar; length: cuint); extdecl; + + + (** + * Called to free the resources associated with the XQC_OutputStream. + * Free is called by the implementation if it finished writing to the stream. + * + * \param stream The XQC_OutputStream that this function pointer is a member of + * + *) + free: procedure(stream: XQC_OutputStream); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * The ::XQC_InputStream struct is designed to be populated by users for the purpose + * of streaming data into an XQC implementation. + *) + XQC_InputStream_s = record + (** + * The function called to read more of the input (e.g. the query). The function should read + * the next chunk of input into the buffer provided, returning the length of the + * data read. + * + * \param stream The XQC_InputStream that this function pointer is a member of + * \param[out] buffer The buffer to read the data into + * \param length The length of the buffer + * + * \return The number of bytes read - this will be less than length if the end of the input is reached + * or -1 if an error occured + * + *) + read: function(stream: XQC_InputStream; const buf: pchar; length: cuint): cint; extdecl; + + + (** + * Called to free the resources associated with the XQC_InputStream. + * The free function is called by the implementation if it finished reading from the stream. + * This allows for lazy evaluation without the user needing to know when reading from the + * stream has finished. + * + * \param stream The XQC_InputStream that this function pointer is a member of + * + *) + free: procedure(stream: XQC_InputStream); extdecl; + + + (** + * for internal use only + *) + data: pointer; + end; + + +(** + * The ::XQC_ErrorHandler struct is designed to be populated by users for the purpose + * of collecting more detailed error messages from an XQC implementation. An XQC_ErrorHandler + * can be set for a query using the XQC_Query::set_error_handler() function. + * + * The XQC_ErrorHandler struct has no free() function pointer because the user remains + * responsible for freeing the resources associated with this struct. + *) + XQC_ErrorHandler_s = record + (** + * The function is called when an error occurs. The function receives the components of the + * error as arguments. When this function returns, the implementation will exit query parsing or + * execution with the error enumeration value passed as an argument. + * + * \param handler The XQC_ErrorHandler that this function pointer is a member of + * \param error The error as a value of the XQUERY_ERROR enum. + * \param local_name The local name of the error or an empty string if no local_name is given + * (e.g. for errors not defined in the spec). + * \param description A detailed description of the error or an empty string if no description is available. + * \param query_uri The uri of the query causing the error or an empty string if no uri is available for the query. + * \param line The line number of the query where the error occured. + * \param components The column number in the line in the query where the error occured. + *) + error: procedure(handler: XQC_ErrorHandler; error: XQUERY_ERROR; const local_name, description, + query_uri: pcchar; line, column: cuint); extdecl; + + + (** + * Can be used for user specific purposes. + *) + user_data: pointer; + end; + + +(** + * The zorba_implementation function creates a new ::XQC_Implementation object. + * Thereby, the Zorba processor is initialized. + * The user is responsible for freeing the object by calling the free() function + * of the XQC_Implementation struct. + * + * \param store A pointer to the store that is being used by the Zorba instance that is created + * by this call. + * \param[out] impl The newly created XQC_Implementation object. + * + * \retval ::XQC_NO_ERROR + * \retval ::XQP0019_INTERNAL_ERROR + *) +{$IFDEF S}function{$ELSE}var{$ENDIF}zorba_implementation{$IFDEF D}: function{$ENDIF}(impl: XQC_Implementation_Ref; store: Pointer): XQUERY_ERROR; extdecl;{$IFDEF S}external zorbalib;{$ENDIF} + + + +{$IFDEF LOAD_DYNAMICALLY} +function InitializeZorba(const LibraryName: String = ''): Integer; +function TryInitializeZorba(const LibraryName: string = ''): Integer; +function ReleaseZorba: Integer; + +var + ZorbaLibrary: TLibHandler; +{$ENDIF LOAD_DYNAMICALLY} + +implementation + +{$IFDEF LOAD_DYNAMICALLY} +const + zorba_symbols: array[0..4] of TLibSymbol = ( + (pvar:@zorba_implementation; name:'zorba_implementation'; weak:false), + (pvar:@Zorba_CompilerHints_default; name:'Zorba_CompilerHints_default'; weak:false), + (pvar:@Zorba_SerializerOptions_default; name:'Zorba_SerializerOptions_default'; weak:false), + (pvar:@Zorba_SerializerOptions_free; name:'Zorba_SerializerOptions_free'; weak:false), + (pvar:@Zorba_SerializerOptions_set; name:'Zorba_SerializerOptions_set'; weak:false) + ); + +function TryInitializeZorba(const LibraryName: string): Integer; +begin + Result := TryInitializeLibrary(ZorbaLibrary, LibraryName); +end; + +function InitializeZorba(const LibraryName: String): Integer; +begin + Result := InitializeLibrary(ZorbaLibrary, LibraryName); +end; + +function ReleaseZorba: Integer; +begin + Result := ReleaseLibrary(ZorbaLibrary); +end; + +initialization + ZorbaLibrary := LibraryHandler('zorba', [zorbalib,zorbavlib], @zorba_symbols, Length(zorba_symbols)); +{$ENDIF} + +end. diff --git a/packages/zorba/src/zorba.pas b/packages/zorba/src/zorba.pas new file mode 100644 index 0000000000..c574de27ef --- /dev/null +++ b/packages/zorba/src/zorba.pas @@ -0,0 +1,6 @@ +unit zorba; + +{$i zorba.inc} + +end. + diff --git a/packages/zorba/src/zorba_error.inc b/packages/zorba/src/zorba_error.inc new file mode 100644 index 0000000000..e815ed3b41 --- /dev/null +++ b/packages/zorba/src/zorba_error.inc @@ -0,0 +1,911 @@ +(* + * Copyright 2006-2008 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + +(** \brief The ErrorCode enum contains all error codes that can be reported by the XQuery + * processor. + * + * Error codes are either the error codes defined by the %XQuery 1.0 or the + * XQuery 1.0 and XPath 2.0 Functions and Operators Specification or error codes + * specifically related to %Zorba. + *) +type + XQUERY_ERROR = ( + + // no error + XQ_NO_ERROR = 0, + + // + // XPath dynamic errors + // + XPDY0002, + // evaluation of an expression relies on some part of the dynamic context + // that has not been assigned a value. + + XPDY0021, + // (Not currently used.) + + XPDY0050, + // the dynamic type of the operand of a treat expression does not match the + // sequence type specified by the treat expression. This error might also + // be raised by a path expression beginning with "/" or "// " if the context + // node is not in a tree that is rooted at a document node. This is because + // a leading "/" or "// " in a path expression is an abbreviation for an + // initial step that includes the clause treat as document-node(). + + // + // XPath static errors + // + + XPST0001, + // analysis of an expression relies on some component of the static context + // that has not been assigned a value. + + XPST0003, + // an expression is not a valid instance of the grammar. + + XPST0005, + // During the analysis phase, it is a static error if the static type + // assigned to an expression other than the expression () or data(()) is + // empty-sequence(). + + XPST0008, + // an expression refers to an element name, attribute name, schema type + // name, namespace prefix, or variable name that is not defined in the + // static context, except for an ElementName in an ElementTest or an + // AttributeName in an AttributeTest. + + XPST0010, + // An implementation must raise a static error if it encounters a reference + // to an axis that it does not support. + + XPST0017, + // the expanded QName and number of arguments in a function call do not + // match the name and arity of a function signature in the static context. + + XPST0051, // = 10, + // a QName that is used as an AtomicType in a SequenceType is not defined + // in the in-scope schema types as an atomic type. + + XPST0080, + // the target type of a cast or castable expression is xs:NOTATION or + // xs:anyAtomicType. + + XPST0081, + // a QName used in a query contains a namespace prefix that cannot be + // expanded into a namespace URI by using the statically known namespaces. + + XPST0083, + // (Not currently used.) + + // + // XPath type errors + // + + XPTY0004, + // during the static analysis phase, an expression is found to have a + // static type that is not appropriate for the context in which the + // expression occurs, or during the dynamic evaluation phase, the dynamic + // type of a value does not match a required type as specified by the + // matching rules in 2.5.4, // SequenceType Matching. + + XPTY0006, + // (Not currently used.) + + XPTY0007, + // (Not currently used.) + + XPTY0018, + // the result of the last step in a path expression contains both nodes + // and atomic values. + + XPTY0019, + // the result of a step (other than the last step) in a path expression + // contains an atomic value. + + XPTY0020, + // in an axis step, the context item is not a node. + + // + // XQuery dynamic errors + // + + XQDY0025, // = 20, + // any attribute of a constructed element does not have a name that is + // distinct from the names of all other attributes of the constructed + // element. + + XQDY0026, + // a constructor or replace expression results in a processing instruction + // node whose content includes the string "?>". + + XQDY0027, + // In a validate expression, it is a dynamic error if the root element + // information item in the PSVI resulting from validation does not have + // the expected validity property: valid if validation mode is strict, + // or either valid or notKnown if validation mode is lax. + + XQDY0029, + // (Not currently used.) + + XQDY0041, + // the value of the name expression in a computed processing instruction + // constructor cannot be cast to the type xs:NCName. + + XQDY0044, + // the node-name property of the node constructed by a computed attribute + // constructor is in the namespace http:// www.w3.org/2000/xmlns/ + // (corresponding to namespace prefix xmlns), or is in no namespace and + // has local name xmlns. + + XQDY0052, + // (Not currently used.) + + XQDY0061, + // the operand of a validate expression is a document node whose children + // do not consist of exactly one element node and zero or more comment and + // processing instruction nodes, in any order. + + XQDY0062, + // (Not currently used.) + + XQDY0064, + // the value of the name expression in a computed processing instruction + // constructor is equal to "XML" (in any combination of upper and lower case). + + XQDY0072, // = 30, + // a constructor or replace expression results in a comment node whose + // content ends with a hyphen or contains two adjacent hyphens. + + XQDY0074, + // the value of the name expression in a computed element or attribute + // constructor or rename expression cannot be converted to an expanded + // QName (for example, because it contains a namespace prefix not found + // in statically known namespaces.) + + XQDY0084, + // the element validated by a validate statement does not have a top-level + // element declaration in the in-scope element declarations, if validation + // mode is strict. + + XQDY0091, + // An implementation MAY raise a dynamic error if an xml:id error, as + // defined in [XML ID], is encountered during construction of an attribute + // named xml:id. + + XQDY0092, + // An implementation MAY raise a dynamic error if a constructed attribute + // named xml:space has a value other than preserve or default. + + // + // XQuery static errors + // + + XQST0009, + // An implementation that does not support the Schema Import Feature must + // raise a static error if a Prolog contains a schema import. + + XQST0012, + // the set of definitions contained in all schemas imported by a Prolog do + // not satisfy the conditions for schema validity specified in Sections 3, + // // and 5, // of [XML Schema] Part 1--i.e., each definition must be + // valid, complete, and unique. + + XQST0013, + // an implementation recognizes a pragma but determines that its content + // is invalid. + + XQST0014, + // (Not currently used.) + + XQST0015, + // (Not currently used.) + + XQST0016, // = 40, + // An implementation that does not support the Module Feature raises a + // static error if it encounters a module declaration or a module import. + + XQST0022, + // the value of a namespace declaration attribute is not a URILiteral. + + XQST0031, + // the version number specified in a version declaration is not supported by + // the implementation. + + XQST0032, + // A static error is raised if a Prolog contains more than one base URI + // declaration. + + XQST0033, + // a module contains multiple bindings for the same namespace prefix. + + XQST0034, + // multiple functions declared or imported by a module have the number of + // arguments and their expanded QNames are equal (as defined by the eq + // operator). + + XQST0035, + // It is a static error to import two schema components that both define + // the same name in the same symbol space and in the same scope. + + XQST0036, + // It is a static error to import a module if the importing module's in-scope + // schema types do not include definitions for the schema type names that + // appear in the declarations of variables and functions (whether in an + // argument type or return type) that are present in the imported module and + // are referenced in the importing module. + + XQST0037, + // (Not currently used.) + + XQST0038, + // a Prolog contains more than one default collation declaration, or the + //value specified by a default collation declaration is not present in + // statically known collations. + + XQST0039, // = 50, + // It is a static error for a function declaration to have more than one + // parameter with the same name. + + XQST0040, + // the attributes specified by a direct element constructor do not have + // distinct expanded QNames. + + XQST0042, + // (Not currently used.) + + XQST0043, + // (Not currently used.) + + XQST0045, + // the function name in a function declaration is in one of the following + // namespaces: + // http://www.w3.org/XML/1998/namespace, + // http://www.w3.org/2001/XMLSchema, + // http:// www.w3.org/2001/XMLSchema-instance, + // http://www.w3.org/2005/xpath-functions. + + XQST0046, + // An implementation MAY raise a static error if the value of a URILiteral + // is of nonzero length and is not in the lexical space of xs:anyURI. + + XQST0047, + // multiple module imports in the same Prolog specify the same target + // namespace. + + XQST0048, + // a function or variable declared in a library module is not in the + // target namespace of the library module. + + XQST0049, + // two or more variables declared or imported by a module have equal + // expanded QNames (as defined by the eq operator.) + + XQST0053, + // (Not currently used.) + + XQST0054, // = 60, + // a variable depends on itself. + + XQST0055, + // a Prolog contains more than one copy-namespaces declaration. + + XQST0056, + // (Not currently used.) + + XQST0057, + // a schema import binds a namespace prefix but does not specify a target + // namespace other than a zero-length string. + + XQST0058, + // multiple schema imports specify the same target namespace. + + XQST0059, + // an implementation is unable to process a schema or module import by + // finding a schema or module with the specified target namespace. + + XQST0060, + // the name of a function in a function declaration is not in a namespace + // (expanded QName has a null namespace URI). + + XQST0063, + // (Not currently used.) + + XQST0065, + // A static error is raised if a Prolog contains more than one ordering + // mode declaration. + + XQST0066, + // A static error is raised if a Prolog contains more than one default + // element/type namespace declaration, or more than one default function + // namespace declaration. + + XQST0067, // = 70, + // A static error is raised if a Prolog contains more than one construction declaration. + + XQST0068, + // A static error is raised if a Prolog contains more than one boundary-space + // declaration. + + XQST0069, + // A static error is raised if a Prolog contains more than one empty order declaration. + + XQST0070, + // A static error is raised if a namespace URI is bound to the predefined + // prefix xmlns, or if a namespace URI other than + // http:// www.w3.org/XML/1998/namespace is bound to the prefix xml, or if + // the prefix xml is bound to a namespace URI other + // than http:// www.w3.org/XML/1998/namespace. + + XQST0071, + // A static error is raised if the namespace declaration attributes of a + // direct element constructor do not have distinct names. + + XQST0073, + // the graph of module imports contains a cycle (that is, if there exists a + // sequence of modules M1, ... Mn such that each Mi imports Mi+1, and Mn + // imports M1), unless all the modules in the cycle share a common namespace. + + XQST0075, + // An implementation that does not support the Validation Feature must raise + // a static error if it encounters a validate expression. + + XQST0076, + // a collation subclause in an order by clause of a FLWOR expression does + // not identify a collation that is present in statically known collations. + + XQST0077, + // (Not currently used.) + + XQST0078, + // (Not currently used.) + + XQST0079, // = 80, + // an extension expression contains neither a pragma that is recognized by + // the implementation nor an expression enclosed in curly braces. + + XQST0082, + // (Not currently used.) + + XQST0085, + // the namespace URI in a namespace declaration attribute is a zero-length + // string, and the implementation does not support [XML Names 1.1]. + + XQST0087, + // the encoding specified in a Version Declaration does not conform to the + // definition of EncName specified in [XML 1.0]. + + XQST0088, + // the literal that specifies the target namespace in a module import or a + // module declaration is of zero length. + + XQST0089, + // a variable bound in a for clause of a FLWOR expression, and its associated + // positional variable, do not have distinct names (expanded QNames). + + XQST0090, + // a character reference does not identify a valid character in the version + // of XML that is in use. + + XQST0093, + // It is a static error to import a module M1, // if there exists a sequence + // of modules M1, ... Mi ... M1, such that each module directly depends on + // the next module in the sequence (informally, if M1, depends on itself + // through some chain of module dependencies.) + + // + // XQuery Type erros + // + + XQTY0023, + // (Not currently used.) + + XQTY0024, + // the content sequence in an element constructor contains an attribute node + // following a node that is not an attribute node. + + XQTY0028, // = 90, + // (Not currently used.) + + XQTY0030, + // the argument of a validate expression does not evaluate to exactly one + // document or element node. + + XQTY0086, + // the typed value of a copied element or attribute node is namespace- + // sensitive when construction mode is preserve and copy-namespaces mode + // is no-preserve. + + // + // XQuery Update Facility + // + + XUST0001, + // It is a static error if an updating expression is used in any position + // other than one of the following: + // 1. The topmost expression in the body of a query. + // 2. The modify clause of a transform expression. + // 3. The return clause of a FLWOR expression. + // 4. The return clauses of a typeswitch expression in which every return + // clause contains an updating expression, an empty expression ( ), or + // a call to the fn:error function. + // 5. The then and else clauses of a conditional statement in which both + // the then and else clauses contain either an updating expression, an + // empty expression ( ), or a call to the fn:error function. + // 6. An operand of a comma expression in which each operand is either an + // updating expression, an empty expression ( ), or a call to the + // fn:error function. + // 7. The content of a parenthesized expression. + // 8. The body of a function declaration in which the keyword updating + // is specified. + + XUST0002, + // It is a static error if an non-updating expression other than an + // empty expression ( ) or a call to the fn:error function is used in + // one of the following positions: + // 1. The modify clause of a transform expression. + // 2. The top-level expression in the body of a function declaration in + // which the keyword updating is specified. + + XUST0003, + // It is a static error if a Prolog contains more than one revalidation + // declaration. + + XUTY0004, + // It is a type error if the insertion sequence of an insert expression + // contains an attribute node following a node that is not an attribute node. + + XUTY0005, + // In an insert expression where into, as first into, or as last into + // is specified, it is a type error if the target expression returns a + // non-empty result that does not consist of a single element or document + // node. + + XUTY0006, + // In an insert expression where before or after is specified, it is a + // type error if the target expression returns a non-empty result that + // does not consist of a single element, text, comment, or processing + // instruction node. + + XUTY0007, + // It is a type error if the target expression of a delete expression + // does not return a sequence of zero or more nodes. + + XUTY0008, // = 100, + // In a replace expression, it is a type error if the target expression + // returns a non-empty result that does not consist of a single element, + // attribute, text, comment, or processing instruction node. + + XUDY0009, + // In a replace expression where value of is not specified, it is a + // dynamic error if the node returned by the target expression does not + // have a parent. + + XUTY0010, + // In a replace expression where value of is not specified and the + // target is an element, text, comment, or processing instruction node, + // it is a type error if the replacement sequence does not consist of + // zero or more element, text, comment, or processing instruction nodes. + + XUTY0011, + // In a replace expression where value of is not specified and the target + // is an attribute node, it is a type error if the replacement sequence + // does not consist of zero or more attribute nodes. + + XUTY0012, + // In a rename expression, it is a type error if the target expression + // returns a non-empty result that does not consist of a single element, + // attribute, or processing instruction node. + + XUTY0013, + // In a transform expression, it is a type error if a source expression + // in the copy clause does not return a single node. + + XUDY0014, + // In a transform expression, it is a dynamic error if the modify clause + // modifies any node that was not created by the copy clause. + + XUDY0015, + // It is a dynamic error if any node is the target of more than one + // rename expression within the same query. + + XUDY0016, + // It is a dynamic error if any node is the target of more than one + // replace expression (without value of being specified) within the + // same query. + + XUDY0017, + // It is a dynamic error if any node is the target of more than one + // replace value of expression within the same query. + + XUDY0018, // = 110, + // It is a dynamic error if a function that was declared to be external + // but not updating returns a non-empty pending update list. + + XUDY0019, + // It is a dynamic error if a function that was declared to be both + // external and updating returns a non-empty data model instance. + + XUDY0020, + // An implementation may (but is not required to) raise a dynamic error + // if a node is deleted that had no parent before execution of the query + // began. + + XUDY0021, + // It is a dynamic error if the XDM instance that would result from + // applying all the updates in a query violates any constraint specified + // in [XQuery/XPath Data Model (XDM)]. In this case, none of the updates + // in the query are made effective. + + XUTY0022, + // It is a type error if an insert expression specifies the insertion + // of an attribute node into a document node. + + XUDY0023, + // It is a dynamic error if an insert, replace, or rename expression + // affects an element node by introducing a new namespace binding that + // conflicts with one of its existing namespace bindings. + + XUDY0024, + // It is a dynamic error if the effect of a set of updating expressions + // is to introduce conflicting namespace bindings into an element node. + + XUDY0025, + // It is a dynamic error if the target of a rename expression is a + // processing instruction node, and the new name expression returns a + // QName with a non-empty namespace prefix. + + XUST0026, + // It is a static error if a revalidation declaration in a Prolog + // specifies a revalidation mode that is not supported by the current + // implementation. + + XUDY0027, + // It is a dynamic error if the target expression of an insert, replace, + // or rename expression evaluates to an empty sequence. + + XUST0028, // = 120, + // It is a static error if a function declaration specifies both updating + // and a return type. + + XUDY0029, + // In an insert expression where before or after is specified, it is a + // dynamic error if node returned by the target expression does not have + // a parent. + + XUDY0030, + // It is a dynamic error if an insert expression specifies the insertion + // of an attribute node before or after a child of a document node. + + XUDY0031, + // It is a dynamic error if multiple calls to fn:put in the same snapshot + // specify the same URI (after resolution of relative URIs). + + // + // XQuery 1.0 and XPath 2.0 Functions and Operators + // + + FOER0000, //Unidentified error. + + FOAR0001, //Division by zero. This error is raised whenever an attempt is made to divide by zero. + + FOAR0002, //Numeric operation overflow/underflow. This error is raised whenever numeric operations result in an overflow or underflow. + + FOCA0001, //Input value too large for decimal. + + FOCA0002, //Invalid lexical value. + + FOCA0003, //Input value too large for integer. + + FOCA0005, //NaN supplied as float/double value. + + FOCA0006, //String to be cast to decimal has too many digits of precision. + + FOCH0001, //Code point not valid. + + FOCH0002, //Unsupported collation. + + FOCH0003, //Unsupported normalization form. + + FOCH0004, //Collation does not support collation units. + + FODC0001, //No context document. + + FODC0002, //Error retrieving resource. + + FODC0003, //Function stability not defined. + + FODC0004, //Invalid argument to fn:collection. + + FODC0005, //Invalid argument to fn:doc or fn:doc-available. + + FODT0001, // = 140, //Overflow/underflow in date/time operation. + + FODT0002, //Overflow/underflow in duration operation. + + FODT0003, //Invalid timezone value. + + FONS0004, //No namespace found for prefix. + + FONS0005, //Base-uri not defined in the static context. + + FORG0001, //Invalid value for cast/constructor. + + FORG0002, //Invalid argument to fn:resolve-uri(). + + FORG0003, //fn:zero-or-one called with a sequence containing more than one item. + + FORG0004, //fn:one-or-more called with a sequence containing no items. + + FORG0005, //fn:exactly-one called with a sequence containing zero or more than one item. + + FORG0006, //Invalid argument type. + + FORG0008, //Both arguments to fn:dateTime have a specified timezone. + + FORG0009, //Error in resolving a relative URI against a base URI in fn:resolve-uri. + + FORX0001, //Invalid regular expression. flags + + FORX0002, //Invalid regular expression. + + FORX0003, //Regular expression matches zero-length string. + + FORX0004, //Invalid replacement string. + + FOTY0012, //Argument node does not have a typed value. + + FOUP0001, + // It is a dynamic error if the first operand of fn:put is not a node of + // a supported kind. + + FOUP0002, + // It is a dynamic error if the second operand of fn:put is not a valid + // lexical representation of the xs:anyURI type. + + // + // Serialization errors + // + SENR0001, // = 160, + // It is an error if an item in S6 in sequence normalization is an attribute node or a namespace node. + + SERE0003, + // It is an error if the serializer is unable to satisfy the rules for + // either a well-formed XML document entity or a well-formed XML external + // general parsed entity, or both, except for content modified by the + // character expansion phase of serialization. + + SEPM0004, + // It is an error to specify the doctype-system parameter, or to specify + // the standalone parameter with a value other than omit, if the instance + // of the data model contains text nodes or multiple element nodes as + // children of the root node. + + SERE0005, + // It is an error if the serialized result would contain an NCName Names + // that contains a character that is not permitted by the version of + // Namespaces in XML specified by the version parameter. + + SERE0006, + // It is an error if the serialized result would contain a character + // that is not permitted by the version of XML specified by the version + // parameter. + + SESU0007, + // It is an error if an output encoding other than UTF-8 or UTF-16 is requested and the serializer + // does not support that encoding. + + SERE0008, + // It is an error if a character that cannot be represented in the encoding that the serializer is using + // for output appears in a context where character references are not allowed (for example if the character + // occurs in the name of an element). + + SEPM0009, + // It is an error if the omit-xml-declaration parameter has the value yes, and the standalone attribute + // has a value other than omit; or the version parameter has a value other than 1.0 and the doctype-system + // parameter is specified. + + SEPM0010, + // It is an error if the output method is xml, the value of the undeclare-prefixes parameter is yes, and + // the value of the version parameter is 1.0. + + SESU0011, + // It is an error if the value of the normalization-form parameter specifies a normalization form that + // is not supported by the serializer. + + SERE0012, // = 170, + // It is an error if the value of the normalization-form parameter is fully-normalized and any relevant + // construct of the result begins with a combining character. + + SESU0013, + // It is an error if the serializer does not support the version of XML or HTML specified by the version parameter. + + SERE0014, + // It is an error to use the HTML output method when characters which are legal in XML but not in HTML, + // specifically the control characters #x7F-#x9F, appear in the instance of the data model. + + SERE0015, + // It is an error to use the HTML output method when > appears within a processing instruction in the data model + // instance being serialized. + + SEPM0016, + // It is a an error if a parameter value is invalid for the defined domain. + + XTDE1310, + // It is a non-recoverable dynamic error if the picture string does not satisfy the format-number function rules. + + XTDE1340, + // It is a non-recoverable dynamic error if the syntax of the picture is incorrect. + + XTDE1350, + // It is a non-recoverable dynamic error if a component specifier within the picture refers to components that are not available in the given type of $value. + + // + // ZORBA errors + // + XQP0000_DYNAMIC_RUNTIME_ERROR, + XQP0001_DYNAMIC_ITERATOR_OVERRUN, + XQP0002_DYNAMIC_ILLEGAL_NODE_CHILD, // = 180, + XQP0003_DYNAMIC_TARGET_NAMESPACE_NOT_FOUND, + XQP0004_SYSTEM_NOT_SUPPORTED, + XQP0005_SYSTEM_ASSERT_FAILED, + XQP0006_SYSTEM_HASH_ERROR_KEYLEN_EXCEEDS_MAXKEYLEN, + XQP0007_SYSTEM_VECTOR_OUT_OF_RANGE, + XQP0008_SYSTEM_READ_LOCK_FAILED, + XQP0009_SYSTEM_WRITE_LOCK_FAILED, + XQP0010_SYSTEM_POP_FROM_EMPTY_LIST, + XQP0011_SYSTEM_FILE_ERROR_IN_FUNCTION, + XQP0012_SYSTEM_FXCHARHEAP_IOEXCEPTION, // = 190, + XQP0013_SYSTEM_MMFILE_IOEXCEPTION, + XQP0015_SYSTEM_NOT_YET_IMPLEMENTED, + XQP0019_INTERNAL_ERROR, + XQP0020_INVALID_URI, + XQP0021_USER_ERROR, + XQP0022_GET_RESULTS_AS_DOM_FAILED, + XQP0023_GET_RESULTS_AS_SAX_FAILED, + XQP0025_COULD_NOT_CREATE_ITEM, + XQP0026_COULD_NOT_CREATE_THREAD, + XQP0026_CANNOT_INIT_STORE, // = 200, + XQP0027_MS_DOM_ERROR, + XQP0028_FUNCTION_IMPL_NOT_FOUND, + XQP0030_DEADLOCK, + + XQP0031_MALFORMED_XQUERYX_INPUT, + XQP0032_ERROR_TRANSFORMING_XQUERYX_TO_XQUERY, + + XQP0033_INDEX_DOES_NOT_EXIST, + XQP0034_INDEX_ALREADY_EXISTS, + XQP0035_MULTI_VALUED_INDEX_KEY, + XQP0036_NON_ATOMIC_INDEX_KEY, + XQP0037_INDEX_IS_NOT_DECLARED, + XQP0038_INDEX_IS_ALREADY_DECLARED, + XQP0039_INDEX_IN_NON_DATA_MODULE, + XQP0040_INDEX_HAS_FREE_VARS, + XQP0041_INDEX_HAS_INVALID_DATA_SOURCE, + XQP0042_INDEX_NOT_DETERMINISTIC, + + // + // Zorba API errors + // + API0001_XQUERY_STRING_IS_EMPTY, + API0002_COMPILE_FAILED, + API0003_XQUERY_NOT_COMPILED, // = 210, + API0004_XQUERY_ALREADY_COMPILED, + API0005_COLLECTION_ALREADY_EXISTS, + API0006_COLLECTION_NOT_FOUND, + API0007_COLLECTION_ITEM_MUST_BE_A_NODE, + API0009_THREAD_NOT_INITIALIZED, + API0010_XQUERY_EXECUTION_NOT_STARTED, + API0011_INVALID_VARIABLE_QNAME, + API0012_INVALID_INDEX, + API0013_INAPPROPRIATE_VARIABLE_VALUE, + API0014_INVALID_ARGUMENT, // = 220, + API0015_CANNOT_OPEN_FILE, + API0016_CANNOT_CREATE_COLLECTION, + API0017_CANNOT_LOAD_DOCUMENT, + API0018_CANNOT_ACCESS_FILE, + API0019_FUNCTION_ALREADY_REGISTERED, + API0020_DOCUMENT_ALREADY_EXISTS, + API0021_ITEM_TO_LOAD_IS_NOT_NODE, + API0022_QUERY_ALREADY_CLOSED, + API0023_CANNOT_SERIALIZE_UPDATE_QUERY, + API0024_CANNOT_ITERATE_OVER_UPDATE_QUERY, // = 230, + API0025_END_OF_SEQUENCE, + API0026_CANNOT_CLOSE_QUERY_WITH_ITERATORS, + API0027_CANNOT_UPDATE_DCTX_WITH_ITERATORS, + API0028_INVALID_NODE_URI, + API0029_NODE_DOES_NOT_BELONG_TO_COLLECTION, + API0030_NO_NODE_AT_GIVEN_POSITION, + API0031_NODE_ALREADY_IN_COLLECTION, + API0032_NON_ROOT_NODE_IN_COLLECTION, + API0032_QUERY_NOT_COMPILED_IN_DEBUG_MODE, + API0033_FILE_OR_FOLDER_DOES_NOT_EXIST, + API0034_FILE_OR_FOLDER_CANNOT_BE_OPENED, + API0035_COLLECTION_CANNOT_BE_SERIALIZED, + API0036_TIDY_ERROR, + API0037_TIDY_ERROR_SET_OPTION, + {$IFDEF ZORBA_WITH_EMAIL} + API0038_SMTP_SEVER_ERROR_SET_OPTION, + API0039_RECIPIENT_SET_OPTION, + API0040_MAIL_NOT_SENT, + {$ENDIF} (* ZORBA_WITH_EMAIL *) + API0050_REST_ERROR_HEADER, + API0051_REST_ERROR_PAYLOAD, + API0060_CONV_JSON_PARSE, + API0061_CONV_JSON_SERIALIZE, + API0062_CONV_JSON_PARAM, + API0063_CONV_JSON_ML_PARSE, + API0064_CONV_JSON_ML_SERIALIZE, + API0065_CONV_JSON_ML_PARAM, + API0066_JSON_SEQUENCE_CANNOT_BE_SERIALIZED, + + // + // Store Errors + // + STR0001_INDEX_ALREADY_EXISTS, + STR0002_INDEX_DOES_NOT_EXIST, + STR0003_INDEX_PARTIAL_KEY_INSERT, + STR0004_INDEX_PARTIAL_KEY_REMOVE, // = 250, + STR0005_INDEX_PARTIAL_KEY_PROBE, + STR0006_INDEX_INVALID_BOX_PROBE, + STR0007_INDEX_UNSUPPORTED_PROBE_CONDITION, + STR0020_LOADER_IO_ERROR, + STR0021_LOADER_PARSING_ERROR, + STR0030_NODEID_ERROR, + STR0040_TYPE_ERROR, // = 257, + STR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE, + + //Class Serialization errors + SRL0001_INEXISTENT_INPUT_FIELD, + SRL0002_INCOMPATIBLE_INPUT_FIELD, + SRL0003_UNRECOGNIZED_CLASS_FIELD, + SRL0004_UNRESOLVED_FIELD_REFERENCE, + SRL0005_CLASS_VERSION_IS_TOO_NEW, + SRL0006_CLASS_VERSION_IS_TOO_OLD, + SRL0007_INPUT_ARCHIVE_USED_FOR_OUT_SERIALIZATION, + SRL0008_OUTPUT_ARCHIVE_USED_FOR_IN_SERIALIZATION, + SRL0009_CLASS_NOT_SERIALIZABLE, + SRL0010_ITEM_TYPE_NOT_SERIALIZABLE, + SRL0011_INPUT_ARCHIVE_NOT_ZORBA_ARCHIVE, + SRL0012_INCOMPATIBLE_ARCHIVE_VERSION, + SRL0013_UNABLE_TO_LOAD_QUERY, + + // + // XQuery Data Definition Facility:w + // + XDST0001, + XDST0002, + XDST0007, + XDST0008, + XDST0010, + + XDDY0003, + XDDY0004, + XDDY0005, + XDDY0006, + XDDY0009, + XDDY0011, + XDDY0012, + XDDY0013, + XDDY0014, + + MAX_ZORBA_ERROR_CODE + ); + +(* + * Local variables: + * mode: c++ + * End: + *) diff --git a/packages/zorba/src/zorba_options.inc b/packages/zorba/src/zorba_options.inc new file mode 100644 index 0000000000..1aabc41f56 --- /dev/null +++ b/packages/zorba/src/zorba_options.inc @@ -0,0 +1,142 @@ +(* + * Copyright 2006-2008 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + + +(** \brief The optimization level used for optimizing the query. *) + Zorba_opt_level_t = ( + ZORBA_OPT_LEVEL_O0, (**< Don't use any optimization. *) + ZORBA_OPT_LEVEL_O1 (**< Use basic optimizations + (e.g.\ removing sorting, removing duplicate elimination, + or constant folding). *) + ); + +(** \brief Set of hints that can be passed to the query compiler. + * + * An instance of this class can be passed to the compileQuery function + * of the Zorba class or the compile function of this class. + * The members of this class represent hints that are passed to the + * query compiler. For example, whether optimization of the query + * should be done (O1) or not (O0). + * + * example_6 in file \link simple.cpp \endlink shows an example + * how CompilerHints can be used. + *) + pZorba_CompilerHints_t = ^Zorba_CompilerHints_t; + Zorba_CompilerHints_t = record + (** \brief The optimization level that is used *) + opt_level: Zorba_opt_level_t; + (** \brief Treat the query as a library module *) + lib_module: cbool; + end; + + Zorba_serialization_method_t = ( + ZORBA_SERIALIZATION_METHOD_XML, + ZORBA_SERIALIZATION_METHOD_HTML, + ZORBA_SERIALIZATION_METHOD_XHTML, + ZORBA_SERIALIZATION_METHOD_TEXT, + ZORBA_SERIALIZATION_METHOD_JSON, + ZORBA_SERIALIZATION_METHOD_JSONML + ); + + Zorba_byte_order_mark_t = ( + ZORBA_BYTE_ORDER_MARK_YES, + ZORBA_BYTE_ORDER_MARK_NO + ); + + Zorba_escape_uri_attributes_t = ( + ZORBA_ESCAPE_URI_ATTRIBUTES_YES, + ZORBA_ESCAPE_URI_ATTRIBUTES_NO + ); + + Zorba_include_content_type_t = ( + ZORBA_INCLUDE_CONTENT_TYPE_YES, + ZORBA_INCLUDE_CONTENT_TYPE_NO + ); + + Zorba_indent_t = ( + ZORBA_INDENT_YES, + ZORBA_INDENT_NO + ); + + Zorba_normalization_form_t = ( + ZORBA_NORMALIZATION_FORM_NFC, + ZORBA_NORMALIZATION_FORM_NFD, + ZORBA_NORMALIZATION_FORM_NFKC, + ZORBA_NORMALIZATION_FORM_NFKD, + ZORBA_NORMALIZATION_FORM_FULLY_normalized, + ZORBA_NORMALIZATION_FORM_NONE + ); + + Zorba_omit_xml_declaration_t = ( + ZORBA_OMIT_XML_DECLARATION_YES, + ZORBA_OMIT_XML_DECLARATION_NO + ); + + Zorba_standalone_t = ( + ZORBA_STANDALONE_YES, + ZORBA_STANDALONE_NO, + ZORBA_STANDALONE_OMIT + ); + + Zorba_undeclare_prefixes_t = ( + ZORBA_UNDECLARE_PREFIXES_YES, + ZORBA_UNDECLARE_PREFIXES_NO + ); + + Zorba_binary_plan_format_t = ( + ZORBA_USE_BINARY_ARCHIVE, + ZORBA_USE_XML_ARCHIVE + ); + + pZorba_SerializerOptions_t = ^Zorba_SerializerOptions_t; + Zorba_SerializerOptions_t = record end; + + +(** \brief Helper function for C to set default values ComplilerHints struct. + * + * \retval Zorba_CompilerHints_t with default member values + *) +{$IFDEF S}procedure{$ELSE}var{$ENDIF}Zorba_CompilerHints_default{$IFDEF D}: procedure{$ENDIF} + (p: pZorba_CompilerHints_t); extdecl;{$IFDEF S}external zorbalib;{$ENDIF} + + +(** \brief Helper function to create a Zorba_SerializerOptions_t struct because + * of missing default constructor. C++ code can delete the + * returned Zorba_SerializerOptions_t* struct, while C code + * must call Zorba_SerializerOptions_free(). + * + * \retval Zorba_CompilerHints_t with default member values + *) +{$IFDEF S}function{$ELSE}var{$ENDIF}Zorba_SerializerOptions_default{$IFDEF D}: function{$ENDIF}: + pZorba_SerializerOptions_t; extdecl;{$IFDEF S}external zorbalib;{$ENDIF} + + +(** \brief Helper function to delete a Zorba_SerializerOptions_t struct + * + * \retval Zorba_CompilerHints_t with default member values + *) +{$IFDEF S}procedure{$ELSE}var{$ENDIF}Zorba_SerializerOptions_free{$IFDEF D}: procedure{$ENDIF} + (serializerOptions: pZorba_SerializerOptions_t); extdecl;{$IFDEF S}external zorbalib;{$ENDIF} + + +(** \brief Helper function to set an option in a Zorba_SerializerOptions_t structure + * + * \param parameter the serializer parameter to be configured + * \param value the value to which the parameter should be set + * \retval Zorba_CompilerHints_t with default member values + *) +{$IFDEF S}procedure{$ELSE}var{$ENDIF}Zorba_SerializerOptions_set{$IFDEF D}: procedure{$ENDIF} + (serializerOptions: pZorba_SerializerOptions_t; const parameter: pcchar; const value: pcchar); extdecl;{$IFDEF S}external zorbalib;{$ENDIF} diff --git a/packages/zorba/src/zorba_static_context_consts.inc b/packages/zorba/src/zorba_static_context_consts.inc new file mode 100644 index 0000000000..b66dfc290d --- /dev/null +++ b/packages/zorba/src/zorba_static_context_consts.inc @@ -0,0 +1,60 @@ +(* + * Copyright 2006-2008 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *) + + +type + +(** \brief XPath 1.0 compatibility mode as defined in + * http://www.w3.org/TR/xquery/#static_context + *) + xpath1_0compatib_mode_t = (xpath2_0, xpath1_0); + +(** \brief Ordering mode as defined in http://www.w3.org/TR/xquery/#static_context. + *) + ordering_mode_t = (ordered, unordered); + +(** \brief Default order for empty sequences as defined in + * http://www.w3.org/TR/xquery/#static_context. + *) + order_empty_mode_t = (empty_greatest, empty_least); + +(** \brief Inherit part of the Copy-namespace mode as defined in + * http://www.w3.org/TR/xquery/#static_context. + *) + inherit_mode_t = (inherit_ns, no_inherit_ns); + +(** \brief Preserve part of the Copy-namespace mode as defined in + * http://www.w3.org/TR/xquery/#static_context. + *) + preserve_mode_t = (preserve_ns, no_preserve_ns); + +(** \brief Boundary-space policy as defined in http://www.w3.org/TR/xquery/#static_context. + *) + boundary_space_mode_t = (preserve_space, strip_space); + +(** \brief Construction mode as defined in http://www.w3.org/TR/xquery/#static_context. + *) + construction_mode_t = (preserve_cons, strip_cons); + +(** \brief The XQuery version, taken from the version declaration, an XQuery 1.1 feature. + *) + xquery_version_t = (xquery_version_1_0 = 100, xquery_version_1_1 = 110); + +(** \brief Revalidation mode as defined in + * http://www.w3.org/TR/xquery-update-10/#id-revalidation-declaration + *) + validation_mode_t = (validate_skip, validate_lax, validate_strict); + diff --git a/packages/zorba/src/zorbadyn.pas b/packages/zorba/src/zorbadyn.pas new file mode 100644 index 0000000000..62a0a97671 --- /dev/null +++ b/packages/zorba/src/zorbadyn.pas @@ -0,0 +1,7 @@ +unit zorbadyn; + +{$DEFINE LOAD_DYNAMICALLY} +{$i zorba.inc} + +end. + |
