diff options
author | marcus <marcus@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2014-08-31 06:39:28 +0000 |
---|---|---|
committer | marcus <marcus@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2014-08-31 06:39:28 +0000 |
commit | 008567d27405451c00155842cd905c07077c81aa (patch) | |
tree | 3312d481d0b3eef23b958f3c041130ba2fe5b395 /packages | |
parent | 51ef88633017631139a7e3231093c11b0a05270f (diff) | |
download | fpc-008567d27405451c00155842cd905c07077c81aa.tar.gz |
AROS: arosunits for aros system library units
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@28547 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages')
25 files changed, 15741 insertions, 1 deletions
diff --git a/packages/Makefile b/packages/Makefile index 6462627e64..ee1544171a 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -1,5 +1,5 @@ # -# Don't edit, this file is generated by FPCMake Version 2.0.0 [2014-08-17 rev 28432] +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2014/08/24] # 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 i386-nativent i386-iphonesim i386-android i386-aros 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 powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd 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 arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android jvm-java jvm-android i8086-msdos diff --git a/packages/Makefile.fpc.fpcmake b/packages/Makefile.fpc.fpcmake index 9a74638d2e..56d8e07260 100644 --- a/packages/Makefile.fpc.fpcmake +++ b/packages/Makefile.fpc.fpcmake @@ -64,6 +64,7 @@ dirs_palmos=palmunits dirs_go32v2=rtl-console fv graph unzip gdbint dirs_amiga=amunits dirs_morphos=morphunits rtl-console fv opengl sdl +dirs_aros=arosunits dirs_wii=libogcfpc dirs_arm_nds=libndsfpc diff --git a/packages/arosunits/Makefile b/packages/arosunits/Makefile new file mode 100644 index 0000000000..51d868acee --- /dev/null +++ b/packages/arosunits/Makefile @@ -0,0 +1,2387 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2014/08/24] +# +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 i386-nativent i386-iphonesim i386-android i386-aros 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 powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd 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 arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android jvm-java jvm-android i8086-msdos +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx haiku aix +LIMIT83fs = go32v2 os2 emx watcom msdos +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 +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 +ifeq ($(FULL_TARGET),arm-embedded) +ifeq ($(SUBARCH),) +$(error When compiling for arm-embedded, a sub-architecture (e.g. SUBARCH=armv4t or SUBARCH=armv7m) must be defined) +endif +override FPCOPT+=-Cp$(SUBARCH) +endif +ifeq ($(FULL_TARGET),mipsel-embedded) +ifeq ($(SUBARCH),) +$(error When compiling for mipsel-embedded, a sub-architecture (e.g. SUBARCH=pic32mx) must be defined) +endif +override FPCOPT+=-Cp$(SUBARCH) +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +else +TARGETSUFFIX=$(FULL_TARGET) +endif +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 +ifndef CROSSCOMPILE +BUILDFULLNATIVE=1 +export BUILDFULLNATIVE +endif +ifdef BUILDFULLNATIVE +BUILDNATIVE=1 +export BUILDNATIVE +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 +ifneq ($(findstring $(OS_TARGET),darwin iphonesim),) +ifeq ($(OS_SOURCE),darwin) +DARWIN2DARWIN=1 +endif +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +ifneq ($(OS_TARGET),msdos) +ifndef DARWIN2DARWIN +ifneq ($(CPU_TARGET),jvm) +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +ifeq ($(OS_TARGET),android) +ifeq ($(CPU_TARGET),arm) +BINUTILSPREFIX=arm-linux-androideabi- +else +ifeq ($(CPU_TARGET),i386) +BINUTILSPREFIX=i686-linux-android- +else +ifeq ($(CPU_TARGET),mipsel) +BINUTILSPREFIX=mipsel-linux-android- +endif +endif +endif +endif +endif +endif +else +BINUTILSPREFIX=$(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) +ifndef FPCFPMAKE +ifdef CROSSCOMPILE +ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),) +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPCFPMAKE:=$(shell $(FPCPROG) -PB) +ifeq ($(strip $(wildcard $(FPCFPMAKE))),) +FPCFPMAKE:=$(firstword $(FPCPROG)) +endif +else +override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))) +FPMAKE_SKIP_CONFIG=-n +export FPCFPMAKE +export FPMAKE_SKIP_CONFIG +endif +else +FPMAKE_SKIP_CONFIG=-n +FPCFPMAKE=$(FPC) +endif +endif +override PACKAGE_NAME=arosunits +override PACKAGE_VERSION=2.7.1 +FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT)) +ifdef OS_TARGET +FPC_TARGETOPT+=--os=$(OS_TARGET) +endif +ifdef CPU_TARGET +FPC_TARGETOPT+=--cpu=$(CPU_TARGET) +endif +LOCALFPMAKE=./fpmake$(SRCEXEEXT) +override INSTALL_FPCPACKAGE=y +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 +EXEDBGEXT=.dbg +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 +ifneq ($(CPU_TARGET),jvm) +ifeq ($(OS_TARGET),android) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +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),aros) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=aros +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 +ifneq ($(findstring $(OS_TARGET),darwin iphonesim),) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +EXEDBGEXT=.dSYM +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +ifeq ($(OS_TARGET),NativeNT) +SHAREDLIBEXT=.dll +SHORTSUFFIX=nativent +endif +ifeq ($(OS_TARGET),wii) +EXEEXT=.dol +SHAREDLIBEXT=.so +SHORTSUFFIX=wii +endif +ifeq ($(OS_TARGET),aix) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=aix +endif +ifeq ($(OS_TARGET),java) +OEXT=.class +ASMEXT=.j +SHAREDLIBEXT=.jar +SHORTSUFFIX=java +endif +ifeq ($(CPU_TARGET),jvm) +ifeq ($(OS_TARGET),android) +OEXT=.class +ASMEXT=.j +SHAREDLIBEXT=.jar +SHORTSUFFIX=android +endif +endif +ifeq ($(OS_TARGET),msdos) +STATICLIBPREFIX= +STATICLIBEXT=.a +SHORTSUFFIX=d16 +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 +NASMNAME=$(BINUTILSPREFIX)nasm +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 +ifndef NASMPROG +ifdef CROSSBINDIR +NASMPROG=$(CROSSBINDIR)/$(NASMNAME)$(SRCEXEEXT) +else +NASMPROG=$(NASMNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +NASM=$(NASMPROG) +ifdef inUnix +PPAS=./ppas$(SRCBATCHEXT) +else +PPAS=ppas$(SRCBATCHEXT) +endif +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl fpmkunit +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-haiku) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-nativent) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-iphonesim) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-android) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i386-aros) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-wii) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc-aix) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),arm-android) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-aix) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),avr-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),armeb-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),armeb-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),mips-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),mipsel-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),mipsel-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),mipsel-android) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),jvm-java) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),jvm-android) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=1 +endif +ifeq ($(FULL_TARGET),i8086-msdos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL-PROCESS=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_LIBTAR=1 +REQUIRE_PACKAGES_FPMKUNIT=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 +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX) +else +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX) +else +UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL) +endif +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(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 +ifdef UNITDIR_FPMAKE_RTL +override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(SOURCESUFFIX) +else +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units_bs/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)/units_bs/$(SOURCESUFFIX) +else +UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASZLIB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +ifdef UNITDIR_FPMAKE_PASZLIB +override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_FCL-PROCESS +PACKAGEDIR_FCL-PROCESS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-process/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_FCL-PROCESS),) +ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units/$(TARGETSUFFIX)),) +UNITDIR_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units/$(TARGETSUFFIX) +else +UNITDIR_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS) +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units/$(SOURCESUFFIX) +else +ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units_bs/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units_bs/$(SOURCESUFFIX) +else +UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS) +endif +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FCL-PROCESS)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FCL-PROCESS) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-PROCESS)/$(FPCMADE) +endif +else +PACKAGEDIR_FCL-PROCESS= +UNITDIR_FCL-PROCESS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-process/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL-PROCESS),) +UNITDIR_FCL-PROCESS:=$(firstword $(UNITDIR_FCL-PROCESS)) +else +UNITDIR_FCL-PROCESS= +endif +endif +ifdef UNITDIR_FCL-PROCESS +override COMPILER_UNITDIR+=$(UNITDIR_FCL-PROCESS) +endif +ifdef UNITDIR_FPMAKE_FCL-PROCESS +override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-PROCESS) +endif +endif +ifdef REQUIRE_PACKAGES_HASH +PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_HASH),) +ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),) +UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX) +else +UNITDIR_HASH=$(PACKAGEDIR_HASH) +endif +ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)/units/$(SOURCESUFFIX) +else +ifneq ($(wildcard $(PACKAGEDIR_HASH)/units_bs/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)/units_bs/$(SOURCESUFFIX) +else +UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH) +endif +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_HASH)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE) +endif +else +PACKAGEDIR_HASH= +UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_HASH),) +UNITDIR_HASH:=$(firstword $(UNITDIR_HASH)) +else +UNITDIR_HASH= +endif +endif +ifdef UNITDIR_HASH +override COMPILER_UNITDIR+=$(UNITDIR_HASH) +endif +ifdef UNITDIR_FPMAKE_HASH +override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_HASH) +endif +endif +ifdef REQUIRE_PACKAGES_LIBTAR +PACKAGEDIR_LIBTAR:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libtar/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_LIBTAR),) +ifneq ($(wildcard $(PACKAGEDIR_LIBTAR)/units/$(TARGETSUFFIX)),) +UNITDIR_LIBTAR=$(PACKAGEDIR_LIBTAR)/units/$(TARGETSUFFIX) +else +UNITDIR_LIBTAR=$(PACKAGEDIR_LIBTAR) +endif +ifneq ($(wildcard $(PACKAGEDIR_LIBTAR)/units/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_LIBTAR=$(PACKAGEDIR_LIBTAR)/units/$(SOURCESUFFIX) +else +ifneq ($(wildcard $(PACKAGEDIR_LIBTAR)/units_bs/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_LIBTAR=$(PACKAGEDIR_LIBTAR)/units_bs/$(SOURCESUFFIX) +else +UNITDIR_FPMAKE_LIBTAR=$(PACKAGEDIR_LIBTAR) +endif +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_LIBTAR)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_LIBTAR) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBTAR)/$(FPCMADE) +endif +else +PACKAGEDIR_LIBTAR= +UNITDIR_LIBTAR:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libtar/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_LIBTAR),) +UNITDIR_LIBTAR:=$(firstword $(UNITDIR_LIBTAR)) +else +UNITDIR_LIBTAR= +endif +endif +ifdef UNITDIR_LIBTAR +override COMPILER_UNITDIR+=$(UNITDIR_LIBTAR) +endif +ifdef UNITDIR_FPMAKE_LIBTAR +override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_LIBTAR) +endif +endif +ifdef REQUIRE_PACKAGES_FPMKUNIT +PACKAGEDIR_FPMKUNIT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_FPMKUNIT),) +ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units/$(TARGETSUFFIX)),) +UNITDIR_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units/$(TARGETSUFFIX) +else +UNITDIR_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT) +endif +ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units/$(SOURCESUFFIX) +else +ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)),) +UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX) +else +UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT) +endif +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FPMKUNIT) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE) +endif +else +PACKAGEDIR_FPMKUNIT= +UNITDIR_FPMKUNIT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPMKUNIT),) +UNITDIR_FPMKUNIT:=$(firstword $(UNITDIR_FPMKUNIT)) +else +UNITDIR_FPMKUNIT= +endif +endif +ifdef UNITDIR_FPMKUNIT +override COMPILER_UNITDIR+=$(UNITDIR_FPMKUNIT) +endif +ifdef UNITDIR_FPMAKE_FPMKUNIT +override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FPMKUNIT) +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) +override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifndef CROSSCOMPILE +ifneq ($(BINUTILSPREFIX),) +override FPCMAKEOPT+=-XP$(BINUTILSPREFIX) +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 +endif +ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +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:=$(strip $(FPC) $(FPCOPT)) +ifneq (,$(findstring -sh ,$(COMPILER))) +UseEXECPPAS=1 +endif +ifneq (,$(findstring -s ,$(COMPILER))) +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +UseEXECPPAS=1 +endif +endif +ifneq ($(UseEXECPPAS),1) +EXECPPAS= +else +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +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) + $(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) c$(TAROPT)f $(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)) +override CLEANEXEDBGFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEDBGFILES)) +endif +ifdef CLEAN_PROGRAMS +override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS))) +override CLEANEXEDBGFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEDBGEXT), $(CLEAN_PROGRAMS))) +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 CLEANEXEDBGFILES + -$(DELTREE) $(CLEANEXEDBGFILES) +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 +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +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) FPC fpmake... $(FPCFPMAKE) + @$(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) 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 +units: +examples: +shared: +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +info: fpc_info +makefiles: fpc_makefiles +.PHONY: units examples shared sourceinstall exampleinstall zipsourceinstall zipexampleinstall zipdistinstall info makefiles +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif +override FPCOPT:=$(filter-out -FU%,$(FPCOPT)) +override FPCOPT:=$(filter-out -FE%,$(FPCOPT)) +ifdef FPMAKEOPT +FPMAKE_OPT+=$(FPMAKEOPT) +endif +FPMAKE_OPT+=--localunitdir=../.. +FPMAKE_OPT+=--globalunitdir=.. +FPMAKE_OPT+=$(FPC_TARGETOPT) +FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT)) +FPMAKE_OPT+=--compiler=$(FPC) +FPMAKE_OPT+=-bu +.NOTPARALLEL: +fpmake: fpmake.pp + $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT) +all: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) +smart: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX +release: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE +debug: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG +ifeq ($(FPMAKE_BIN_CLEAN),) +clean: +else +clean: + $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT) +endif +ifeq ($(FPMAKE_BIN_CLEAN),) +distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall +else +distclean: +ifdef inUnix + { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi; } +else + $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT) +endif + -$(DEL) $(LOCALFPMAKE) +endif +cleanall: distclean +install: fpmake +ifdef UNIXHier + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) +else + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) +endif +distinstall: fpmake +ifdef UNIXHier + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie +else + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie +endif +zipinstall: fpmake + $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) diff --git a/packages/arosunits/Makefile.fpc b/packages/arosunits/Makefile.fpc new file mode 100644 index 0000000000..869cec85c3 --- /dev/null +++ b/packages/arosunits/Makefile.fpc @@ -0,0 +1,91 @@ +# +# Makefile.fpc for running fpmake +# + +[package] +name=arosunits +version=2.7.1 + +[require] +packages=rtl fpmkunit + +[install] +fpcpackage=y + +[default] +fpcdir=../.. + +[prerules] +FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT)) +ifdef OS_TARGET +FPC_TARGETOPT+=--os=$(OS_TARGET) +endif +ifdef CPU_TARGET +FPC_TARGETOPT+=--cpu=$(CPU_TARGET) +endif +LOCALFPMAKE=./fpmake$(SRCEXEEXT) + +[rules] +# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own. +override FPCOPT:=$(filter-out -FU%,$(FPCOPT)) +override FPCOPT:=$(filter-out -FE%,$(FPCOPT)) +# Compose general fpmake-parameters +ifdef FPMAKEOPT +FPMAKE_OPT+=$(FPMAKEOPT) +endif +FPMAKE_OPT+=--localunitdir=../.. +FPMAKE_OPT+=--globalunitdir=.. +FPMAKE_OPT+=$(FPC_TARGETOPT) +FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT)) +FPMAKE_OPT+=--compiler=$(FPC) +FPMAKE_OPT+=-bu +.NOTPARALLEL: + +fpmake: fpmake.pp + $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT) +all: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) +smart: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX +release: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE +debug: fpmake + $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG +# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will +# most often fail because the dependencies are cleared. +# In case of a clean, simply do nothing +ifeq ($(FPMAKE_BIN_CLEAN),) +clean: +else +clean: + $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT) +endif +# In case of a distclean, perform an 'old'-style distclean. This to avoid problems +# when the package is compiled using fpcmake prior to running this clean using fpmake +ifeq ($(FPMAKE_BIN_CLEAN),) +distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall +else +distclean: +ifdef inUnix + { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi; } +else + $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT) +endif + -$(DEL) $(LOCALFPMAKE) +endif +cleanall: distclean +install: fpmake +ifdef UNIXHier + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) +else + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) +endif +# distinstall also installs the example-sources +distinstall: fpmake +ifdef UNIXHier + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie +else + $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie +endif +zipinstall: fpmake + $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) diff --git a/packages/arosunits/Makefile.fpc.fpcmake b/packages/arosunits/Makefile.fpc.fpcmake new file mode 100644 index 0000000000..e38965d46e --- /dev/null +++ b/packages/arosunits/Makefile.fpc.fpcmake @@ -0,0 +1,25 @@ +# +# Makefile.fpc for Free Pascal AROS units Bindings +# + +[package] +name=arosunits +version=2.7.1 + +[target] +units= agraphics amigados exec hardware inputevent intuition keymap layers \ + longarray tagsarray timer utility diskfont iffparse clipboard \ + workbench icon + +[compiler] +includedir=src +sourcedir=src + +[install] +fpcpackage=y + +[default] +fpcdir=../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/arosunits/fpmake.pp b/packages/arosunits/fpmake.pp new file mode 100644 index 0000000000..f813ef08ff --- /dev/null +++ b/packages/arosunits/fpmake.pp @@ -0,0 +1,56 @@ +{$ifndef ALLPACKAGES} +{$mode objfpc}{$H+} +program fpmake; + +uses fpmkunit; + +Var + P : TPackage; + T : TTarget; +begin + With Installer do + begin +{$endif ALLPACKAGES} + + P:=AddPackage('arosunits'); +{$ifdef ALLPACKAGES} + P.Directory:=ADirectory; +{$endif ALLPACKAGES} + P.Version:='2.7.1'; + + P.Author := 'Marcus Sackrow'; + P.License := 'LGPL with modification'; + P.HomepageURL := 'www.freepascal.org'; + P.Email := ''; + P.Description := 'A set of units for AROS. Currently i386 only'; + P.NeedLibC:= false; + + P.CPUs:=[i386]; + P.OSes:=[aros]; + + P.SourcePath.Add('src'); + P.IncludePath.Add('src'); + + T:=P.Targets.AddUnit('agraphics.pas'); + T:=P.Targets.AddUnit('amigados.pas'); + T:=P.Targets.AddUnit('exec.pas'); + T:=P.Targets.AddUnit('hardware.pas'); + T:=P.Targets.AddUnit('inputevent.pas'); + T:=P.Targets.AddUnit('intuition.pas'); + T:=P.Targets.AddUnit('keymap.pas'); + T:=P.Targets.AddUnit('layers.pas'); + T:=P.Targets.AddUnit('longarray.pas'); + T:=P.Targets.AddUnit('tagsarray.pas'); + T:=P.Targets.AddUnit('timer.pas'); + T:=P.Targets.AddUnit('utility.pas'); + T:=P.Targets.AddUnit('diskfont.pas'); + T:=P.Targets.AddUnit('iffparse.pas'); + T:=P.Targets.AddUnit('clipboard.pas'); + T:=P.Targets.AddUnit('workbench.pas'); + T:=P.Targets.AddUnit('icon.pas'); + +{$ifndef ALLPACKAGES} + Run; + end; +end. +{$endif ALLPACKAGES} diff --git a/packages/arosunits/src/agraphics.pas b/packages/arosunits/src/agraphics.pas new file mode 100644 index 0000000000..4fb20eb0b7 --- /dev/null +++ b/packages/arosunits/src/agraphics.pas @@ -0,0 +1,2484 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + graphics.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit agraphics; + +{$mode delphi}{$H+} + +Interface + +uses + Exec, Hardware, Utility; + +{$PACKRECORDS C} +const + BITSET = $8000; + BITCLR = 0; + +type + TPlanePtr = PByte; + + PPoint = ^TPoint; + TPoint = record + x, y: SmallInt; + end; + + PBitMap = ^TBitMap; + TBitMap = record + BytesPerRow: Word; + Rows: Word; + Flags: Byte; + Depth: Byte; + Pad: Word; + Planes: array[0..7] of TPlanePtr; + end; + + PRectangle = ^TRectangle; + TRectangle = record + MinX, + MinY: SmallInt; + MaxX, + MaxY: SmallInt; + end; + + PRect32 = ^TRect32; + TRect32 = record + MinX, + MinY: Longint; + MaxX, + MaxY: Longint; + end; + +type +// a structure to contain the 16 collision procedure addresses } + PCollTable = ^TCollTable; + TCollTable = array[0..15] of Pointer; + +// flags for AllocBitMap, etc. +const + BMB_CLEAR = 0; + BMB_DISPLAYABLE = 1; + BMB_INTERLEAVED = 2; + BMB_STANDARD = 3; + BMB_MINPLANES = 4; + BMB_SPECIALFMT = 7; // CyberGfx Flag + + BMF_CLEAR = 1 shl BMB_CLEAR; + BMF_DISPLAYABLE = 1 shl BMB_DISPLAYABLE; + BMF_INTERLEAVED = 1 shl BMB_INTERLEAVED; + BMF_STANDARD = 1 shl BMB_STANDARD; + BMF_MINPLANES = 1 shl BMB_MINPLANES; + BMF_SPECIALFMT = 1 shl BMB_SPECIALFMT; + + BMB_PIXFMT_SHIFTUP = 24; + + BMF_REQUESTVMEM = BMF_DISPLAYABLE or BMF_MINPLANES; +// AmigaOS v4 flags + BMB_HIJACKED = 7; + BMF_HIJACKED = 1 shl 7; + BMB_RTGTAGS = 8; + BMF_RTGTAGS = 1 shl 8; + BMB_RTGCHECK = 9; + BMF_RTGCHECK = 1 shl 9; + BMB_FRIENDISTAG = 10; + BMF_FRIENDISTAG = 1 shl 10; + BMB_INVALID = 11; + BMF_INVALID = 1 shl 11; + + BMF_CHECKVALUE = BMF_RTGTAGS or BMF_RTGCHECK or BMF_FRIENDISTAG; + BMF_CHECKMASK = BMF_HIJACKED or BMF_CHECKVALUE or BMF_INVALID; + +// tags for AllocBitMap */ + BMATags_Friend = TAG_USER + 0; + BMATags_Depth = TAG_USER + 1; + BMATags_RGBFormat = TAG_USER + 2; + BMATags_Clear = TAG_USER + 3; + BMATags_Displayable = TAG_USER + 4; + BMATags_Private1 = TAG_USER + 5; + BMATags_NoMemory = TAG_USER + 6; + BMATags_NoSprite = TAG_USER + 7; + BMATags_Private2 = TAG_USER + 8; + BMATags_Private3 = TAG_USER + 9; + BMATags_ModeWidth = TAG_USER + 10; + BMATags_ModeHeight = TAG_USER + 11; + BMATags_RenderFunc = TAG_USER + 12; + BMATags_SaveFunc = TAG_USER + 13; + BMATags_UserData = TAG_USER + 14; + BMATags_Alignment = TAG_USER + 15; + BMATags_ConstantBytesPerRow = TAG_USER + 16; + BMATags_UserPrivate = TAG_USER + 17; + BMATags_Private4 = TAG_USER + 18; + BMATags_Private5 = TAG_USER + 19; + BMATags_Private6 = TAG_USER + 20; + BMATags_Private7 = TAG_USER + 21; + BMATags_BitmapColors = TAG_USER + $29; + BMATags_DisplayID = TAG_USER + $32; + BMATags_BitmapInvisible = TAG_USER + $37; + BMATags_BitmapColors32 = TAG_USER + $43; +// the following IDs are for GetBitMapAttr() *} + BMA_HEIGHT = 0; + BMA_DEPTH = 4; + BMA_WIDTH = 8; + BMA_FLAGS = 12; + +type + PRegionRectangle = ^TRegionRectangle; + TRegionRectangle = record + Next, Prev: PRegionRectangle; + Bounds: TRectangle; + end; + + PRegion = ^TRegion; + TRegion = record + Bounds: TRectangle; + RegionRectangle: PRegionRectangle; + end; + +const + +// internal TClipRect flags + CR_NEEDS_NO_CONCEALED_RASTERS = 1; + CR_NEEDS_NO_LAYERBLIT_DAMAGE = 2; + +// defines for code values for getcode + ISLESSX = 1 shl 0; + ISLESSY = 1 shl 1; + ISGRTRX = 1 shl 2; + ISGRTRY = 1 shl 3; + +type +// TextAttr node, matches text attributes in RastPort + PTextAttr = ^TTextAttr; + TTextAttr = record + ta_Name: STRPTR; // name of the font + ta_YSize: Word; // height of the font + ta_Style: Byte; // intrinsic font style + ta_Flags: Byte; // font preferences and flags + end; +// like TextAttr + Tags + PTTextAttr = ^TTTextAttr; + TTTextAttr = record + tta_Name: STRPTR; // name of the font + tta_YSize: Word; // height of the font + tta_Style: Byte; // intrinsic font style + tta_Flags: Byte; // font preferences and flags + tta_Tags: pTagItem; // TTextAttr specific extension -> extended attributes + end; + +const +// ta_Style/tta_Style + FS_NORMAL = 0; // normal text (no style bits set) + FSB_UNDERLINED = 0; // underlined (under baseline) + FSF_UNDERLINED = 1 shl 0; + FSB_BOLD = 1; // bold face text (ORed w/ shifted) + FSF_BOLD = 1 shl 1; + FSB_ITALIC = 2; // italic (slanted 1:2 right) + FSF_ITALIC = 1 shl 2; + FSB_EXTENDED = 3; // extended face (wider than normal) + FSF_EXTENDED = 1 shl 3; + FSB_COLORFONT = 6; // this uses ColorTextFont structure + FSF_COLORFONT = 1 shl 6; + FSB_TAGGED = 7; // the TextAttr is really an TTextAttr + FSF_TAGGED = 1 shl 7; +// ta_Flags/tta_Flags + FPB_ROMFONT = 0; // font is in rom + FPF_ROMFONT = 1 shl 0; + FPB_DISKFONT = 1; // font is from diskfont.library + FPF_DISKFONT = 1 shl 1; + FPB_REVPATH = 2; // designed path is reversed (e.g. left) + FPF_REVPATH = 1 shl 2; + FPB_TALLDOT = 3; // designed for hires non-interlaced + FPF_TALLDOT = 1 shl 3; + FPB_WIDEDOT = 4; // designed for lores interlaced + FPF_WIDEDOT = 1 shl 4; + FPB_PROPORTIONAL = 5; //character sizes can vary from nominal + FPF_PROPORTIONAL = 1 shl 5; + FPB_DESIGNED = 6; // size is "designed", not constructed + FPF_DESIGNED = 1 shl 6; + FPB_REMOVED = 7; // the font has been removed + FPF_REMOVED = 1 shl 7; +// tta_Tags + TA_DeviceDPI = TAG_USER + 1; // Tag value is Point union: Hi Longint XDPI, Lo Longint YDPI + + MAXFONTMATCHWEIGHT = 32767; { perfect match from WeighTAMatch } + +type + PTextFont = ^TTextFont; + TTextFont = record + tf_Message: TMessage; // reply message for font removal + // font name in LN \ used in this + tf_YSize: Word; // font height | order to best + tf_Style: Byte; // font style | match a font + tf_Flags: Byte; // preferences and flags / request. + tf_XSize: Word; // nominal font width + tf_Baseline: Word; // distance from the top of char to baseline + tf_BoldSmear: Word; // smear to affect a bold enhancement + tf_Accessors: Word; // access count + tf_LoChar: Byte; // the first character described here + tf_HiChar: Byte; // the last character described here + tf_CharData: APTR; // the bit character data + tf_Modulo: Word; // the row modulo for the strike font data + tf_CharLoc: APTR; // ptr to location data for the strike font 2 words: bit offset then size + tf_CharSpace: APTR; // ptr to words of proportional spacing data + tf_CharKern: APTR; // ptr to words of kerning data + //property tf_extension: PMsgPort read tf_Message.mn_ReplyPort write tf_Message.mn_ReplyPort; + end; + + PTextFontExtension = ^TTextFontExtension; + TTextFontExtension = record // this structure is read-only + tfe_MatchWord: Word; // a magic cookie for the extension + tfe_Flags0: Byte; // (system private flags) + tfe_Flags1: Byte; // (system private flags) + + tfe_BackPtr: PTextFont; // validation of compilation + tfe_OrigReplyPort: PMsgPort; // original value in tf_Extension + tfe_Tags: PTagItem; // Text Tags for the font + + tfe_OFontPatchS, // (system private use) + tfe_OFontPatchK: PWord; // (system private use) + // this space is reserved for future expansion + end; + + PColorFontColors = ^TColorFontColors; + TColorFontColors = record + cfc_Reserved, // *must* be zero + cfc_Count: Word; // number of entries in cfc_ColorTable + cfc_ColorTable: PWord; // 4 bit per component color map packed xRGB + end; + + PColorTextFont = ^TColorTextFont; + TColorTextFont = record + ctf_TF: TTextFont; + + ctf_Flags: Word; // extended flags + ctf_Depth, // number of bit planes + ctf_FgColor, // color that is remapped to FgPen + ctf_Low, // lowest color represented here } + ctf_High, // highest color represented here } + ctf_PlanePick, // PlanePick ala Images } + ctf_PlaneOnOff: Byte; // PlaneOnOff ala Images + + ctf_ColorFontColors: PColorFontColors; // colors for font + + ctf_CharData: array[0..7] of APTR; // pointers to bit planes ala tf_CharData + end; + + PTextExtent = ^TTextExtent; + TTextExtent = record + te_Width, // same as TextLength + te_Height: Word; // same as tf_YSize + te_Extent: TRectangle; // relative to CP + end; + +const +// TColorTextFont.ctf_Flags + CTB_MAPCOLOR = 0; // map ctf_FgColor to the rp_FgPen IF it's + CTF_MAPCOLOR = 1 shl 0; // is a valid color within ctf_Low..ctf_High + CT_COLORFONT = 1 shl 0; // color map contains designer's colors + CT_GREYFONT = 1 shl 1; // color map describes even-stepped brightnesses from low to high + CT_ANTIALIAS = 1 shl 2; // zero background thru fully saturated char + CT_COLORMASK = $000F; // mask to get to following color styles + +// VSprite flags + // user-set VSprite flags: + VSPRITE = $0001; // set if VSprite, clear if Bob + SAVEBACK = $0002; // set if background is to be saved/restored + OVERLAY = $0004; // set to mask image of Bob onto background + MUSTDRAW = $0008; // set if VSprite absolutely must be drawn + SUSERFLAGS = $00FF; // mask of all user-settable VSprite-flags + // system-set VSprite flags: + BACKSAVED = $0100; // this Bob's background has been saved + BOBUPDATE = $0200; // temporary flag, useless to outside world + GELGONE = $0400; // set if gel is completely clipped (offscreen) + VSOVERFLOW = $0800; // VSprite overflow (if MUSTDRAW set we draw!) +// Bob flags + // these are the user flag bits + SAVEBOB = $0001; // set to not erase Bob + BOBISCOMP = $0002; // set to identify Bob as AnimComp + BUSERFLAGS = $00FF; // mask of all user-settable Bob-flags + // these are the system flag bits + BWAITING = $0100; // set while Bob is waiting on 'after' + BDRAWN = $0200; // set when Bob is drawn this DrawG pass + BOBSAWAY = $0400; // set to initiate removal of Bob + BOBNIX = $0800; // set when Bob is completely removed + SAVEPRESERVE = $1000; // for back-restore during double-buffer + OUTSTEP = $2000; // for double-clearing if double-buffer +// defines for the animation procedures + ANFRACSIZE = 6; + RINGTRIGGER = $0001; + ANIMHALF = $0020; + +type +{ UserStuff definitions + the user can define these to be a single variable or a sub-structure + if undefined by the user, the system turns these into innocuous variables + see the manual for a thorough definition of the UserStuff definitions } + TVUserStuff = SmallInt; // Sprite user stuff + TBUserStuff = SmallInt; // Bob user stuff + TAUserStuff = SmallInt; // AnimOb user stuff + + PBob = ^TBob; + PAnimOb = ^TAnimOb; + PAnimComp = ^TAnimComp; + +{ GEL draw list constructed in the order the Bobs are actually drawn, then + list is copied to clear list + must be here in VSprite for system boundary detection + the VSprite positions are defined in (y,x) order to make sorting + sorting easier, since (y,x) as a long Longint} + PVSprite = ^TVSprite; + TVSprite = record + // SYSTEM VARIABLES + NextVSprite: PVSprite; // GEL linked list forward/backward pointers sorted by y,x value + PrevVSprite: PVSprite; + DrawPath: PVSprite; // pointer of overlay drawing + ClearPath: PVSprite; // pointer for overlay clearing + OldY, OldX: SmallInt; // previous position + // COMMON VARIABLES + Flags: SmallInt; // VSprite flags + // COMMON VARIABLES + Y, X: SmallInt; // screen position + Height: SmallInt; + Width: SmallInt; // number of words per row of image data + Depth: SmallInt; // number of planes of data + MeMask: SmallInt; // which types can collide with this VSprite + HitMask: SmallInt; // which types this VSprite can collide with + ImageData: PSmallInt; // pointer to VSprite image + BorderLine: PSmallInt; // logical OR of all VSprite bits borderLine is the one-dimensional logical OR of all + // the VSprite bits, used for fast collision detection of edge + CollMask: PSmallInt; // similar to above except this is a matrix + //pointer to this VSprite's color definitions (not used by Bobs) + SprColors: PSmallInt; + VSBob: PBob; // points home if this VSprite is part of a Bob + PlanePick: Shortint; { planePick flag: set bit selects a plane from image, clear bit selects + use of shadow mask for that plane + OnOff flag: if using shadow mask to fill plane, this bit (corresponding + to bit in planePick) describes whether to fill with 0's or 1's + There are two uses for these flags: + - if this is the VSprite of a Bob, these flags describe how the Bob + is to be drawn into memory + - if this is a simple VSprite and the user intends on setting the + MUSTDRAW flag of the VSprite, these flags must be set too to describe + which color registers the user wants for the image} + PlaneOnOff: ShortInt; + VUserExt: TVUserStuff; // user definable: see note above + end; + +// dBufPacket defines the values needed to be saved across buffer to buffer when in double-buffer mode + PDBufPacket = ^TDBufPacket; + TDBufPacket = record + BufY, + BufX: SmallInt; // save other buffers screen coordinates + BufPath: PVSprite; // carry the draw path over the gap + BufBuffer: PSmallInt; // this pointer must be filled in by the user pointer to other buffer's background save buffer + end; + +// blitter-objects + TBob = record + // SYSTEM VARIABLES + // COMMON VARIABLES + Flags: SmallInt; // general purpose flags (see definitions below) + // USER VARIABLES + SaveBuffer: PSmallInt; // pointer to the buffer for background save + ImageShadow: PSmallInt; // used by Bobs for "cookie-cutting" and multi-plane masking + Before: PBob; // draw this Bob before Bob pointed to by before , for correct overlay + After: PBob; // draw this Bob after Bob pointed to by after, for correct overlay + BobVSprite: PVSprite; // this Bob's VSprite definition + BobComp: PAnimComp; // pointer to this Bob's AnimComp def + DBuffer: PDBufPacket; // pointer to this Bob's dBuf packet + BUserExt: TBUserStuff; // Bob user extension + end; + + + TAnimComp = record + // SYSTEM VARIABLES + // COMMON VARIABLES + Flags: SmallInt; // AnimComp flags for system & user + Timer: SmallInt; // timer defines how long to keep this component active: + // if set non-zero, timer decrements to zero then switches to nextSeq + // if set to zero, AnimComp never switches + // USER VARIABLES + TimeSet: SmallInt; // initial value for timer when the AnimComp is activated by the system + NextComp: PAnimComp; // pointer to next and previous components of animation object + PrevComp: PAnimComp; + NextSeq: PAnimComp; // pointer to component component definition of next image in sequence + PrevSeq: PAnimComp; + AnimCRoutine: Pointer; // Pointer of special animation procedure + YTrans: SmallInt; // initial y translation (if this is a component) } + XTrans: SmallInt; // initial x translation (if this is a component) } + HeadOb: PAnimOb; + AnimBob: PBob; + end; + + TAnimOb = record + // SYSTEM VARIABLES + NextOb, + PrevOb: PAnimOb; + Clock: Longint; // number of calls to Animate this AnimOb has endured + AnOldY, + AnOldX: SmallInt; // old y,x coordinates + // COMMON VARIABLES + AnY, + AnX: SmallInt; // y,x coordinates of the AnimOb + // USER VARIABLES + YVel, + XVel: SmallInt; // velocities of this object + YAccel, + XAccel: SmallInt; // accelerations of this object + RingYTrans, + RingXTrans: SmallInt; // ring translation values + AnimORoutine: Pointer; // Pointer of special animation procedure + HeadComp: PAnimComp; // pointer to first component + AUserExt: TAUserStuff; // AnimOb user extension + end; + PPAnimOb = ^PAnimOb; + +const + B2NORM = 0; + B2SWAP = 1; + B2BOBBER = 2; + + +const + MAXSUPERSAVECLIPRECTS = 20; // Max. number of cliprects that are kept preallocated in the list + +type + // predefinitions, for record referencing: + PRastPort = ^tRastPort; + PLayer_Info = ^TLayer_Info; + PLayer = ^TLayer; + + PClipRect = ^TClipRect; + TClipRect = record + Next: PClipRect; // roms used to find next ClipRect + Prev: PClipRect; // ignored by roms, used by windowlib + Lobs: PLayer; // ignored by roms, used by windowlib + BitMap: PBitMap; + Bounds: TRectangle; // set up by windowlib, used by roms + _p1, + _p2: Pointer; // system reserved + reserved: Longint; // system use + Flags: Longint; // only exists in layer allocation + end; + + +// Layer Structure + TLayer = record + Front, + Back: PLayer; // ignored by roms + ClipRect: PClipRect; // read by roms to find first cliprect + Rp: PRastPort; // Ignored by roms, I hope + Bounds: TRectangle; // ignored by roms + Parent: PLayer; // Private! + Priority: Word; // system use only + Flags: Word; // obscured ?, Virtual BitMap? + SuperBitMap: PBitMap; + SuperClipRect: PClipRect; // super bitmap cliprects if VBitMap != 0 else damage cliprect list for refresh + Window: APTR; // reserved for user interface use + Scroll_X, + Scroll_Y: SmallInt; + cr, + cr2, + crnew: PClipRect; // used by dedice + SuperSaveClipRects: PClipRect; // preallocated cr's + _cliprects: PClipRect; // system use during refresh + LayerInfo: PLayer_Info; // points to head of the list + Lock: TSignalSemaphore; + BackFill: PHook; +{$ifdef aros} + VisibleRegion: PRegion; // Private! +{$else} + Reserved1: ULONG; +{$endif} + ClipRegion: PRegion; + SaveClipRects: PRegion; // used to back out when in trouble + Width, + Height: SmallInt; +{$ifdef aros} + Shape: PRegion; // Private! + ShapeRegion: PRegion; // Private! + VisibleShape: PRegion; // Private! + Nesting: Word; // Private! + SuperSaveClipRectCounter: Byte; // Private! + Visible: Byte; // Private! + Reserved2: array[0..1] of Byte; +{$else} + Reserved2: array[0..17] of Byte; +{$endif} + { this must stay here } + DamageList: PRegion; // list of rectangles to refreshthrough + end; + + TLayer_Info = record + Top_Layer: Player; + check_lp: PLayer; + Obs: PClipRect; + FreeClipRects: PClipRect; + + PrivateReserve1: LongInt; + PrivateReserve2: LongInt; + + Lock: TSignalSemaphore; + gs_Head: TMinList; + + PrivateReserve3: SmallInt; + PrivateReserve4: Pointer; + + Flags: Word; // LIFLG_SUPPORTS_OFFSCREEN_LAYERS + fatten_count: ShortInt; + LockLayersCount: ShortInt; + PrivateReserve5: SmallInt; + BlankHook: Pointer; + LayerInfo_extra: Pointer; + end; + + TChangeLayerShapeMsg = record + NewShape: PRegion; // same as passed to ChangeLayerShape() + ClipRect: PClipRect; + Shape: PRegion; + end; + + TCollectPixelsLayerMsg = record + xSrc: LongInt; + ySrc: LongInt; + Width: LongInt; + Height: LongInt; + xDest: LongInt; + yDest: LongInt; + Bm: PBitmap; + Layer: PLayer; + minterm: ULONG; + end; + +// Msg sent through LA_ShapeHook. + PShapeHookMsg = ^TShapeHookMsg; + TShapeHookMsg = record + Action: LongInt; + Layer: PLayer; + ActualShape: PRegion; + NewBounds: TRectangle; + OldBounds: TRectangle; + end; + // Hook for getting LA_ShapeHook and getting this Msg + TShapeHookProc = function(Hook: PHook; Layer: PLayer; Msg: PShapeHookMsg): PRegion; cdecl; + + PAreaInfo = ^TAreaInfo; + TAreaInfo = record + VctrTbl: PSmallInt; // ptr to start of vector table + VctrPtr: PSmallInt; // ptr to current vertex + FlagTbl: PShortInt; // ptr to start of vector flag table + FlagPtr: PShortInt; // ptrs to areafill flags + Count: SmallInt; // number of vertices in list + MaxCount: SmallInt; // AreaMove/Draw will not allow Count>MaxCount + FirstX, + FirstY: SmallInt; // first point for this polygon + end; + + PTmpRas = ^TTmpRas; + TTmpRas = record + RasPtr: PShortInt; + Size: Longint; + end; + + PGelsInfo = ^TGelsInfo; + TGelsInfo = record + sprRsrvd: Shortint; // flag of which sprites to reserve from vsprite system + Flags: Byte; // system use + gelHead, + gelTail: PVSprite; // dummy vSprites for list management + NextLine: PSmallInt; // pointer to array of 8 WORDS for sprite available lines + LastColor: ^PSmallInt; // pointer to array of 8 pointers for color-last-assigned to vSprites + CollHandler: PCollTable; // Pointeres of collision routines + LeftMost, + RightMost, + TopMost, + BottomMost: Smallint; + FirstBlissObj, + LastBlissObj: APTR; // system use only + end; + + TRastPort = record + Layer: PLayer; // LayerPtr + BitMap: PBitMap; // BitMapPtr + AreaPtrn: PWord; // ptr to areafill pattern + TmpRas: PTmpRas; + AreaInfo: PAreaInfo; + GelsInfo: PGelsInfo; + Mask: Byte; // write mask for this raster + FgPen: ShortInt; // foreground pen for this raster + BgPen: ShortInt; // background pen + AOlPen: ShortInt; // areafill outline pen + DrawMode: ShortInt; // drawing mode for fill, lines, and text + AreaPtSz: ShortInt; // 2^n words for areafill pattern + LinPatCnt: ShortInt; // current line drawing pattern preshift + dummy: ShortInt; + Flags: Word; // miscellaneous control bits + LinePtrn: Word; // 16 bits for textured lines + cp_x, + cp_y: SmallInt; // current pen position + minterms: array[0..7] of Byte; + PenWidth: SmallInt; + PenHeight: SmallInt; + Font: PTextFont; // (TextFontPtr) current font Pointer + AlgoStyle: Byte; // the algorithmically generated style + TxFlags: Byte; // text specific flags + TxHeight: Word; // text height + TxWidth: Word; // text nominal width + TxBaseline: Word; // text baseline + TxSpacing: SmallInt; // text spacing (per character) + RP_User: APTR; + longreserved: array[0..1] of IPTR; + wordreserved: array[0..6] of Word; // used to be a node + reserved: array[0..7] of Byte; // for future use + end; + +const +// these are the flag bits for RastPort flags + FRST_DOT = $01; // draw the first dot of this line ? + ONE_DOT = $02; // use one dot mode for drawing lines + DBUFFER = $04; // flag set when RastPorts are double-buffered +// drawing modes + JAM1 = 0; // jam 1 color into raster + JAM2 = 1; // jam 2 colors into raster + COMPLEMENT = 2; // XOR bits into raster + INVERSVID = 4; // inverse video for drawing modes +// only used for bobs + AREAOUTLINE = $08; // used by areafiller + NOCROSSFILL = $20; // areafills have no crossovers + +// Actions for TShapeHookMsg + SHAPEHOOKACTION_CREATELAYER = 0; + SHAPEHOOKACTION_MOVELAYER = 1; + SHAPEHOOKACTION_SIZELAYER = 2; + SHAPEHOOKACTION_MOVESIZELAYER = 3; + +// Tags for scale layer + LA_SRCX = $4000; + LA_SRCY = $4001; + LA_DESTX = $4002; + LA_DESTY = $4003; + LA_SRCWIDTH = $4004; + LA_SRCHEIGHT = $4005; + LA_DESTWIDTH = $4006; + LA_DESTHEIGHT = $4007; + + ROOTPRIORITY = 0; + BACKDROPPRIORITY = 10; + UPFRONTPRIORITY = 20; + +// Layer constants + NEWLAYERINFO_CALLED = 1; + + LAYERSIMPLE = 1 shl 0; + LAYERSMART = 1 shl 1; + LAYERSUPER = 1 shl 2; + LAYERUPDATING = 1 shl 4; + LAYERBACKDROP = 1 shl 6; + LAYERREFRESH = 1 shl 7; + LAYER_CLIPRECTS_LOST = 1 shl 8; + LAYERIREFRESH = 1 shl 9; + LAYERIREFRESH2 = 1 shl 10; + LAYER_ROOT_LAYER = 1 shl 14; + + LAYERS_BACKFILL: PHook = nil; + LAYERS_NOBACKFILL: PHook = PHook(1); + +// LayerInfo Flag + LIFLG_SUPPORTS_OFFSCREEN_LAYERS = 1 shl 8; // Same flag as AmigaOS hack PowerWindowsNG + +// Tags for CreateLayerTagList + LA_Dummy = TAG_USER + 1234; + LA_Type = LA_Dummy + 1; // LAYERSIMPLE, LAYERSMART (default) -or LAYERSUPER + LA_Priority = LA_Dummy + 2; // -128 .. 127 or LPRI_NORMAL (default) or LPRI_BACKDROP + LA_Behind = LA_Dummy + 3; // LongBool. Default is FALSE + LA_Invisible = LA_Dummy + 4; // LongBool. Default is FALSE + LA_BackFill = LA_Dummy + 5; // PHook. Default is LAYERS_BACKFILL + LA_SuperBitMap = LA_Dummy + 6; // PBitMap. Default is nil (none) + LA_Shape = LA_Dummy + 7; // PRegion. Default is nil (rectangular shape) + + LPRI_NORMAL = 0; + LPRI_BACKDROP = -50; + + +const +// tfe_Flags0 (partial definition) + TE0B_NOREMFONT = 0; // disallow RemFont for this font + TE0F_NOREMFONT = $01; + +Const + CleanUp = $40; + CleanMe = CleanUp; + + BltClearWait = 1; { Waits for blit to finish } + BltClearXY = 2; { Use Row/Bytes per row method } + + { Useful minterms } + + StraightCopy = $C0; { Vanilla copy } + InvertAndCopy = $30; { Invert the source before copy } + InvertDest = $50; { Forget source, invert dest } + +const +// These flags are passed (in combination) to CoerceMode() to determine the type of coercion required. + PRESERVE_COLORS = 1; // Ensure that the mode coerced to can display just as many colours as the ViewPort being coerced. + AVOID_FLICKER = 2; // Ensure that the mode coerced to is not interlaced. + IGNORE_MCOMPAT = 4; // Coercion should ignore monitor compatibility issues. + BIDTAG_COERCE = 1; // Private + +const +{ These bit descriptors are used by the GEL collide routines. + These bits are set in the hitMask and meMask variables of + a GEL to describe whether or not these types of collisions + can affect the GEL. BNDRY_HIT is described further below; + this bit is permanently assigned as the boundary-hit flag. + The other bit GEL_HIT is meant only as a default to cover + any GEL hitting any other; the user may redefine this bit.} + BORDERHIT = 0; +{ These bit descriptors are used by the GEL boundry hit routines. + When the user's boundry-hit routine is called (via the argument + set by a call to SetCollision) the first argument passed to + the user's routine is the Pointer of the GEL involved in the + boundry-hit, and the second argument has the appropriate bit(s) + set to describe which boundry was surpassed} + TOPHIT = 1; + BOTTOMHIT = 2; + LEFTHIT = 4; + RIGHTHIT = 8; + +type + PExtendedNode = ^TExtendedNode; + TExtendedNode = record + xln_Succ, + xln_Pred: PNode; + xln_Type: Byte; // NT_GRAPHICS + xln_Pri: ShortInt; + xln_Name: PChar; + xln_Subsystem: Byte; // see below + xln_Subtype: Byte; // SS_GRAPHICS + xln_Library : Longint; + xln_Init : Pointer; + end; + +const +// for xln_Subtype + SS_GRAPHICS = $02; +// for xln_Subsystem + VIEW_EXTRA_TYPE = 1; + VIEWPORT_EXTRA_TYPE = 2; + SPECIAL_MONITOR_TYPE = 3; + MONITOR_SPEC_TYPE = 4; + +type + PAnalogSignalInterval = ^TAnalogSignalInterval; + TAnalogSignalInterval = record + asi_Start, + asi_Stop: Word; + end; + + PSpecialMonitor = ^TSpecialMonitor; + TSpecialMonitor = record + spm_Node: TExtendedNode; + spm_Flags: Word; // Reserved, set to 0 + do_monitor, // Driver call vector - set up a video mode + reserved1, // Private do not touch + reserved2, + reserved3: Pointer; + hblank, // Signal timings by themselves + vblank, + hsync, + vsync: TAnalogSignalInterval; + end; + + PMonitorSpec = ^TMonitorSpec; + TMonitorSpec = record + ms_Node: TExtendedNode; + ms_Flags: Word; // Flags, see below + ratioh, + ratiov: Longint; + total_rows, // Total number of scanlines per frame + total_colorclocks, // Total number of color clocks per line (in 1/280 ns units) + DeniseMaxDisplayColumn, + BeamCon0, // Value for beamcon0 Amiga(tm) chipset register + min_row: Word; + + ms_Special: PSpecialMonitor; // Synchro signal timings description (optional) + + ms_OpenCount: Word; // Driver open count + ms_transform, + ms_translate, + ms_scale: Pointer; + ms_xoffset, + ms_yoffset: Word; + + ms_LegalView: TRectangle; // Allowed range for view positioning (right-bottom position included) + + ms_maxoscan, // maximum legal overscan + ms_videoscan: Pointer; // video display overscan + DeniseMinDisplayColumn: Word; + DisplayCompatible: ULONG; + + DisplayInfoDataBase: TList; + DisplayInfoDataBaseSemaphore: TSignalSemaphore; + + ms_MrgCop, // Driver call vectors, unused by AROS + ms_LoadView, + ms_KillView: Pointer; + end; + +const +// Flags for TMonitorSpec.ms_Flags + MSB_REQUEST_NTSC = 0; + MSB_REQUEST_PAL = 1; + MSB_REQUEST_SPECIAL = 2; + MSB_REQUEST_A2024 = 3; + MSB_DOUBLE_SPRITES = 4; + MSF_REQUEST_NTSC = 1 shl MSB_REQUEST_NTSC; + MSF_REQUEST_PAL = 1 shl MSB_REQUEST_PAL; + MSF_REQUEST_SPECIAL = 1 shl MSB_REQUEST_SPECIAL; + MSF_REQUEST_A2024 = 1 shl MSB_REQUEST_A2024; + MSF_DOUBLE_SPRITES = 1 shl MSB_DOUBLE_SPRITES; + + TO_MONITOR = 0; + FROM_MONITOR = 1; + + STANDARD_XOFFSET = 9; + STANDARD_YOFFSET = 0; + +{ obsolete, v37 compatible definitions follow } + REQUEST_NTSC = 1; + REQUEST_PAL = 2; + REQUEST_SPECIAL = 4; + REQUEST_A2024 = 8; + + DEFAULT_MONITOR_NAME: PChar = 'default.monitor'; + NTSC_MONITOR_NAME: PChar = 'ntsc.monitor'; + PAL_MONITOR_NAME: PChar = 'pal.monitor'; + VGA_MONITOR_NAME: PChar = 'vga.monitor'; + + STANDARD_MONITOR_MASK = REQUEST_NTSC or REQUEST_PAL; + +// Some standard/default constants for Amiga(tm) chipset + STANDARD_NTSC_ROWS = 262; + MIN_NTSC_ROW = 21; + STANDARD_PAL_ROWS = 312; + MIN_PAL_ROW = 29; + STANDARD_NTSC_BEAMCON = $0000; + STANDARD_PAL_BEAMCON = $0020; + SPECIAL_BEAMCON = VARVBLANK or VARHSYNC or VARVSYNC or VARBEAM or VSYNCTRUE or LOLDIS or CSBLANK; + STANDARD_DENISE_MIN = 93; + STANDARD_DENISE_MAX = 455; + STANDARD_COLORCLOCKS = 226; + STANDARD_VIEW_X = $81; + STANDARD_VIEW_Y = $2C; + STANDARD_HBSTRT = $06; + STANDARD_HSSTRT = $0B; + STANDARD_HSSTOP = $1C; + STANDARD_HBSTOP = $2C; + STANDARD_VBSTRT = $0122; + STANDARD_VSSTRT = $02A6; + STANDARD_VSSTOP = $03AA; + STANDARD_VBSTOP = $1066; + + VGA_COLORCLOCKS = STANDARD_COLORCLOCKS / 2; + VGA_TOTAL_ROWS = STANDARD_NTSC_ROWS * 2; + VGA_DENISE_MIN = 59; + MIN_VGA_ROW = 29; + VGA_HBSTRT = $08; + VGA_HSSTRT = $0E; + VGA_HSSTOP = $1C; + VGA_HBSTOP = $1E; + VGA_VBSTRT = $0000; + VGA_VSSTRT = $0153; + VGA_VSSTOP = $0235; + VGA_VBSTOP = $0CCD; + + BROADCAST_HBSTRT = $01; + BROADCAST_HSSTRT = $06; + BROADCAST_HSSTOP = $17; + BROADCAST_HBSTOP = $27; + BROADCAST_VBSTRT = $0000; + BROADCAST_VSSTRT = $02A6; + BROADCAST_VSSTOP = $054C; + BROADCAST_VBSTOP = $1C40; + BROADCAST_BEAMCON = LOLDIS OR CSBLANK; + + RATIO_FIXEDPART = 4; + RATIO_UNITY = 1 shl 4; + +type + PCopList = ^TCopList; + PViewPort = ^TViewPort; + PColorMap = ^TColorMap; + +// Describes playfield(s) (actually bitmaps) + PRasInfo = ^TRasInfo; + TRasInfo = record // used by callers to and InitDspC() + Next: PRasInfo; // Pointer to a next playfield (if there's more than one) + BitMap: PBitMap; // Actual data to display + RxOffset, // Offset of the playfield relative to ViewPort + RyOffset: SmallInt; // scroll offsets in this BitMap (So that different playfields may be shifted against each other) + end; + +// structure of cprlist that points to list that hardware actually executes + PCprList = ^TCprList; + TCprList = record + Next: PCprList; + Start: PWord; // start of copper list + MaxCount: SmallInt; // number of long instructions + end; + + PUCopList = ^TUCopList; + TUCopList = record + Next: PUCopList; + FirstCopList: PCopList; // head node of this copper list + CopList: PCopList; // node in use + end; + + PCopInit = ^TCopInit; + TCopInit = record + vsync_hblank: array[0..1] of Word; + diagstrt: array[0..11] of Word; + fm0: array[0..1] of Word; + diwstart: array[0..9] of Word; + bplcon2: array[0..1] of Word; + sprfix: array[0..15] of Word; + sprstrtup: array[0..31] of Word; + wait14: array[0..1] of Word; + norm_hblank: array[0..1] of Word; + jump: array[0..1] of Word; + wait_forever: array[0..5] of Word; + sprstop: array[0..7] of Word; + end; + + PView = ^TView; + TView = record + ViewPort: PViewPort; // ViewPortPtr + LOFCprList: PCprList; // used for interlaced and noninterlaced + SHFCprList: PCprList; // only used during interlace + DyOffset, + DxOffset: SmallInt; // for complete View positioning offsets are +- adjustments to standard #s + Modes: Word; // such as INTERLACE, GENLOC + end; + +// Additional data for Amiga(tm) chipset. Not used by other hardware. +// these structures are obtained via GfxNew and disposed by GfxFree + PViewExtra = ^TViewExtra; + TViewExtra = record + n: TExtendedNode; // Common Header + View: PView; // View it relates to + Monitor: PMonitorSpec; // Monitor used for displaying this View + TopLine: Word; + end; + + // Copper structures + PCopIns = ^TCopIns; + TCopIns = record + OpCode : smallint; // 0 = move, 1 = wait + case SmallInt of + 0:( + NxtList: PCopList; + ); + 1:( + VWaitPos: SmallInt; // vertical wait position + DestAddr: SmallInt; // destination Pointer + ); + 2:( + HWaitPos: SmallInt; // horizontal wait position + DestData: SmallInt; // data to send + ); + end; + + TCopList = record + Next: PCopList; // next block for this copper list + _CopList: PCopList; // system use + _ViewPort: PViewPort; // system use + CopIns: PCopIns; // start of this block + CopPtr: PCopIns; // intermediate ptr + CopLStart: PSmallInt; // mrgcop fills this in for Long Frame + CopSStart: PSmallInt; // mrgcop fills this in for Longint Frame + Count: Smallint; // intermediate counter + MaxCount: SmallInt; // max # of copins for this block + DyOffset: SmallInt; // offset this copper list vertical waits + SLRepeat: Word; + Flags: Word; // EXACT_LINE or HALF_LINE + end; + +// Describes a displayed bitmap (or logical screen). Copperlists are relevant only to Amiga(tm) chipset, +// for other hardware they are NULL. + TViewPort = record + Next: PViewPort; + ColorMap: PColorMap; // table of colors for this viewport if this is nil, MakeVPort assumes default values + DspIns: PCopList; // user by MakeView(), Preliminary partial display copperlist + SprIns: PCopList; // used by sprite stuff, Preliminary partial sprite copperlist + ClrIns: PCopList; // used by sprite stuff + UCopIns: PUCopList; // User copper list + DWidth, // Width of currently displayed part in pixels + DHeight: SmallInt; // Height of currently displayed part in pixels + DxOffset, // Displacement from the (0, 0) of the physical screen to (0, 0) of the raster + DyOffset: SmallInt; + Modes: Word; // The same as in View + SpritePriorities: Byte; // used by makevp + reserved: Byte; + RasInfo: PRasInfo; // Playfield specification + end; + +// Holds additional information about the ViewPort it is associated with +// this structure is obtained via GfxNew and disposed by GfxFree + PViewPortExtra = ^TViewPortExtra; + TViewPortExtra = record + n: TExtendedNode; + ViewPort: PViewPort; // ViewPort it relates to (backward link) + DisplayClip: TRectangle; // makevp display clipping information, Total size of displayable part + VecTable: APTR; // Unused in AROS + DriverData: array[0..1] of APTR; // Private storage for display drivers. Do not touch! + Flags: Word; // Flags, see below + Origin: array[0..1] of TPoint; // First visible point relative to the DClip. One for each possible playfield. + cop1ptr, // private + cop2ptr: ULONG; // private + end; + + PPaletteExtra = ^TPaletteExtra; + TPaletteExtra = record // structure may be extended so watch out! + pe_Semaphore: TSignalSemaphore; // shared semaphore for arbitration + pe_FirstFree, // *private* + pe_NFree, // number of free colors + pe_FirstShared, // *private* + pe_NShared: Word; // *private* + pe_RefCnt: PByte; // *private* + pe_AllocList: PByte; // *private* + pe_ViewPort: PViewPort; // back pointer to viewport + pe_SharableColors: Word; // the number of sharable colors. + end; + +{ This structure is the primary storage for palette data. + Color data itself is stored in two tables: ColorTable and LowColorBits. + These fields are actually pointer to arrays of Words. Each Word corresponds + to one color. + Number of Words in these array is equal to Count value in this structure. + ColorTable stores upper nibbles of RGB values, LowColorBits stores low nibbles. + Example: + color number 4, value: $00ABCDEF + ColorTable[4] := $0ACE, + LowColorBits[4] := $0BDF + + SpriteBase fields keep bank number, not a color number. On m68k Amiga colors are divided into + banks, 16 per each. So bank number is color number divided by 16. Base color is a number which + is added to all colors of the sprite in order to look up the actual palette entry. + AROS may run on different hardware where sprites may have base colors that do not divide by 16. + In order to cover this bank numbers have a form: ((c and $0F) shl 8 ) or (c shr 4), where c is actual + color number (i. e. remainder is stored in a high byte of Word).} + TColorMap = record + Flags: Byte; // see below (CMF_*) + Type_: Byte; // Colormap type (reflects version), see below (COLORMAP_*) + Count: Word; // Number of palette entries + ColorTable: PWord; // Table of high nibbles of color values (see description above) + // The following fields are present only if Type_ >= COLORMAP_TYPE_V36 + cm_vpe: PViewPortExtra; // ViewPortExtra, for faster access + + LowColorBits: PWord; // Table of low nibbles of color values (see above) + TransparencyPlane, + SpriteResolution, // see below + SpriteResDefault, + AuxFlags: Byte; + + cm_vp: PViewPort; // Points back to a ViewPort this colormap belongs to + + NormalDisplayInfo, + CoerceDisplayInfo : APTR; + + cm_batch_items: PTagItem; + VPModeID: ULONG; + // The following fields are present only if Type_ >= COLORMAP_TYPE_V39 + PalExtra: PPaletteExtra; // Structure controlling palette sharing + + SpriteBase_Even, // Color bank for even sprites (see above) + SpriteBase_Odd, // The same for odd sprites + Bp_0_base, + Bp_1_base: Word; + end; + +const +// flags for TColorMap.Flags + CMF_CMTRANS = 0; + COLORMAP_TRANSPARENCY = 1 shl 0; + CMF_CPTRANS = 1; + COLORPLANE_TRANSPARENCY = 1 shl 1; + CMF_BRDRBLNK = 2; + BORDER_BLANKING = 1 shl 2; + CMF_BRDNTRAN = 3; + BORDER_NOTRANSPARENCY = 1 shl 3; + VIDEOCONTROL_BATCH = 1 shl 4; + USER_COPPER_CLIP = 1 shl 5; + CMF_BRDRSPRT = 6; + BORDERSPRITES = 1 shl 6; +// Types for TColorMap.Type_ + COLORMAP_TYPE_V1_2 = 0; + COLORMAP_TYPE_V36 = 1; + COLORMAP_TYPE_V39 = 2; +// SpriteResolution + SPRITERESN_ECS = $00; + SPRITERESN_140NS = $01; // ^140ns, except in 35ns viewport, where it is 70ns. + SPRITERESN_70NS = $02; + SPRITERESN_35NS = $03; + SPRITERESN_DEFAULT = $ff; + +// Private Flags for TCopList.Flags + EXACT_LINE = 1; + HALF_LINE = 2; +// Copper commands + COPPER_MOVE = 0; // pseude opcode for move #XXXX,dir + COPPER_WAIT = 1; // pseudo opcode for wait y,x + CPRNXTBUF = 2; // continue processing with next buffer + CPR_NT_SYS = $2000; // copper user instruction only + CPR_NT_SHT = $4000; // copper instruction only for long frames + CPR_NT_LOF = $8000; // copper instruction only for Longint frames + + GENLOCK_VIDEO = 1 shl 1; + LACE = 1 shl 2; + DOUBLESCAN = 1 shl 3; + SUPERHIRES = 1 shl 5; + PFBA = 1 shl 6; + EXTRA_HALFBRITE = 1 shl 7; + GENLOCK_AUDIO = 1 shl 8; + DUALPF = 1 shl 10; + HAM = 1 shl 11; + EXTENDED_MODE = 1 shl 12; + VP_HIDE = 1 shl 13; + SPRITES = 1 shl 14; + HIRES = 1 shl 15; +// ViewPortExtra Flags + VPXB_FREE_ME = 0; // Temporary ViewPortExtra allocated during MakeVPort(). ViewPortExtra with this flag + VPXF_FREE_ME = 1 shl 0; // will be automatically found and disposed during FreeVPortCopLists(). + // Private flag in fact, don't set it by hands + VPXB_LAST = 1; + VPXF_LAST = 1 shl 1; + VPXB_STRADDLES256 = 4; + VPXF_STRADDLES256 = 1 shl 4; + VPXB_STRADDLES512 = 5; + VPXF_STRADDLES512 = 1 shl 5; +// Private + VPB_TENHZ = 4; + VPF_TENHZ = 1 shl 4; + VPB_A2024 = 6; + VPF_A2024 = 1 shl 6; + + EXTEND_VSTRUCT = $1000; // unused bit in Modes field of View + +// AuxFlags + CMAB_FULLPALETTE = 0; + CMAF_FULLPALETTE = 1 shl CMAB_FULLPALETTE; + CMAB_NO_INTERMED_UPDATE = 1; + CMAF_NO_INTERMED_UPDATE = 1 shl CMAB_NO_INTERMED_UPDATE; + CMAB_NO_COLOR_LOAD = 2; + CMAF_NO_COLOR_LOAD = 1 shl CMAB_NO_COLOR_LOAD; + CMAB_DUALPF_DISABLE = 3; + CMAF_DUALPF_DISABLE = 1 shl CMAB_DUALPF_DISABLE; + +const +// flags values for ObtainPen + PENB_EXCLUSIVE = 0; + PENB_NO_SETCOLOR = 1; + PENF_EXCLUSIVE = 1 shl PENB_EXCLUSIVE; + PENF_NO_SETCOLOR = 1 shl PENB_NO_SETCOLOR; +// obsolete names for PENF_xxx flags: + PEN_EXCLUSIVE = PENF_EXCLUSIVE; + PEN_NO_SETCOLOR = PENF_NO_SETCOLOR; +// precision values for ObtainBestPen: + PRECISION_EXACT = -1; + PRECISION_IMAGE = 0; + PRECISION_ICON = 16; + PRECISION_GUI = 32; +// tags for ObtainBestPen: + OBP_Precision = $84000000; + OBP_FailIfBad = $84000001; + +{ MakeVPort() will return an error if there is not enough memory, + or the requested mode cannot be opened with the requested depth with the + given bitmap (for higher bandwidth alignments).} + MVP_OK = 0; // you want to see this one + MVP_NO_MEM = 1; // insufficient memory for intermediate workspace + MVP_NO_VPE = 2; // ViewPort does not have a ViewPortExtra, and insufficient memory to allocate a temporary one. + MVP_NO_DSPINS = 3; // insufficient memory for intermidiate copper instructions. + MVP_NO_DISPLAY = 4; // BitMap data is misaligned for this viewport's mode and depth - see AllocBitMap(). + MVP_OFF_BOTTOM = 5; // PRIVATE - you will never see this. +{ MrgCop() will return an error if there is not enough memory, + or for some reason MrgCop() did not need to make any copper lists.} + MCOP_OK = 0; // you want to see this one + MCOP_NO_MEM = 1; // insufficient memory to allocate the system copper lists. + MCOP_NOP = 2; // MrgCop() did not merge any copper lists (eg, no ViewPorts in the list, or all marked as hidden). + +type + PDBufInfo = ^TDBufInfo; + TDBufInfo = record + dbi_Link1: APTR; + dbi_Count1: ULONG; + dbi_SafeMessage: TMessage; // replied to when safe to write to old bitmap + dbi_UserData1: APTR; // first user data + + dbi_Link2: APTR; + dbi_Count2: ULONG; + dbi_DispMessage: TMessage; // replied to when new bitmap has been displayed at least once + dbi_UserData2: APTR; // second user data + dbi_MatchLong: ULONG; + dbi_CopPtr1, + dbi_CopPtr2, + dbi_CopPtr3: APTR; + dbi_BeamPos1, + dbi_BeamPos2: Word; + end; + +const + INVALID_ID = not 0; + +{ With all the new modes that are available under V38 and V39, it is highly + * recommended that you use either the asl.library screenmode requester, + * and/or the V39 graphics.library function BestModeIDA(). + * + * DO NOT interpret the any of the bits in the ModeID for its meaning. For + * example, do not interpret bit 3 ($4) as meaning the ModeID is interlaced. + * Instead, use GetDisplayInfoData() with DTAG_DISP, and examine the DIPF_... + * flags to determine a ModeID's characteristics. The only exception to + * this rule is that bit 7 ($80) will always mean the ModeID is + * ExtraHalfBright, and bit 11 ($800) will always mean the ModeID is HAM. + } + +// normal identifiers + MONITOR_ID_MASK = $FFFF1000; + + DEFAULT_MONITOR_ID = $00000000; + NTSC_MONITOR_ID = $00011000; + PAL_MONITOR_ID = $00021000; + +{ the following 22 composite keys are for Modes on the default Monitor. + NTSC & PAL "flavors" of these particular keys may be made by or'ing + the NTSC or PAL MONITOR_ID with the desired MODE_KEY... + + For example, to specifically open a PAL HAM interlaced ViewPort + (or intuition screen), you would use the modeid of + (PAL_MONITOR_ID or HAMLACE_KEY)} + LORES_KEY = $00000000; + LORESLACE_KEY = $00000004; + LORESSDBL_KEY = $00000008; + EXTRAHALFBRITE_KEY = $00000080; + EXTRAHALFBRITELACE_KEY = $00000084; + LORESEHBSDBL_KEY = $00000088; + LORESDPF_KEY = $00000400; + LORESLACEDPF_KEY = $00000404; + LORESDPF2_KEY = $00000440; + LORESLACEDPF2_KEY = $00000444; + HAM_KEY = $00000800; + HAMLACE_KEY = $00000804; + LORESHAMSDBL_KEY = $00000808; + HIRES_KEY = $00008000; + HIRESLACE_KEY = $00008004; + SUPER_KEY = $00008020; + SUPERLACE_KEY = $00008024; + HIRESEHB_KEY = $00008080; + HIRESEHBLACE_KEY = $00008084; + SUPEREHB_KEY = $000080a0; + SUPEREHBLACE_KEY = $000080a4; + HIRESDPF_KEY = $00008400; + HIRESLACEDPF_KEY = $00008404; + SUPERDPF_KEY = $00008420; + SUPERLACEDPF_KEY = $00008424; + HIRESDPF2_KEY = $00008440; + HIRESLACEDPF2_KEY = $00008444; + SUPERDPF2_KEY = $00008460; + SUPERLACEDPF2_KEY = $00008464; + HIRESHAM_KEY = $00008800; + HIRESHAMLACE_KEY = $00008804; + HIRESHAMSDBL_KEY = $00008808; + SUPERHAM_KEY = $00008820; + SUPERHAMLACE_KEY = $00008824; + +// VGA identifiers + VGA_MONITOR_ID = $00031000; + + VGAEXTRALORES_KEY = $00031004; + VGALORES_KEY = $00039004; + VGAPRODUCT_KEY = $00039024; + VGAHAM_KEY = $00031804; + VGAEXTRALORESLACE_KEY = $00031005; + VGALORESLACE_KEY = $00039005; + VGAPRODUCTLACE_KEY = $00039025; + VGAHAMLACE_KEY = $00031805; + VGAEXTRALORESDPF_KEY = $00031404; + VGALORESDPF_KEY = $00039404; + VGAPRODUCTDPF_KEY = $00039424; + VGAEXTRALORESLACEDPF_KEY = $00031405; + VGALORESLACEDPF_KEY = $00039405; + VGAPRODUCTLACEDPF_KEY = $00039425; + VGAEXTRALORESDPF2_KEY = $00031444; + VGALORESDPF2_KEY = $00039444; + VGAPRODUCTDPF2_KEY = $00039464; + VGAEXTRALORESLACEDPF2_KEY = $00031445; + VGALORESLACEDPF2_KEY = $00039445; + VGAPRODUCTLACEDPF2_KEY = $00039465; + VGAEXTRAHALFBRITE_KEY = $00031084; + VGAEXTRAHALFBRITELACE_KEY = $00031085; + VGAPRODUCTHAM_KEY = $00039824; + VGALORESHAM_KEY = $00039804; + VGAEXTRALORESHAM_KEY = VGAHAM_KEY; + VGAPRODUCTHAMLACE_KEY = $00039825; + VGALORESHAMLACE_KEY = $00039805; + VGAEXTRALORESHAMLACE_KEY = VGAHAMLACE_KEY; + VGAEXTRALORESEHB_KEY = VGAEXTRAHALFBRITE_KEY; + VGAEXTRALORESEHBLACE_KEY = VGAEXTRAHALFBRITELACE_KEY; + VGALORESEHB_KEY = $00039084; + VGALORESEHBLACE_KEY = $00039085; + VGAEHB_KEY = $000390a4; + VGAEHBLACE_KEY = $000390a5; + VGAEXTRALORESDBL_KEY = $00031000; + VGALORESDBL_KEY = $00039000; + VGAPRODUCTDBL_KEY = $00039020; + VGAEXTRALORESHAMDBL_KEY = $00031800; + VGALORESHAMDBL_KEY = $00039800; + VGAPRODUCTHAMDBL_KEY = $00039820; + VGAEXTRALORESEHBDBL_KEY = $00031080; + VGALORESEHBDBL_KEY = $00039080; + VGAPRODUCTEHBDBL_KEY = $000390a0; +// A2024 identifiers + A2024_MONITOR_ID = $00041000; + A2024TENHERTZ_KEY = $00041000; + A2024FIFTEENHERTZ_KEY = $00049000; +// prototype identifiers (private) + PROTO_MONITOR_ID = $00051000; +// Euro72 defines + EURO72_MONITOR_ID = $00061000; + EURO72EXTRALORES_KEY = $00061004; + EURO72LORES_KEY = $00069004; + EURO72PRODUCT_KEY = $00069024; + EURO72HAM_KEY = $00061804; + EURO72EXTRALORESLACE_KEY = $00061005; + EURO72LORESLACE_KEY = $00069005; + EURO72PRODUCTLACE_KEY = $00069025; + EURO72HAMLACE_KEY = $00061805; + EURO72EXTRALORESDPF_KEY = $00061404; + EURO72LORESDPF_KEY = $00069404; + EURO72PRODUCTDPF_KEY = $00069424; + EURO72EXTRALORESLACEDPF_KEY = $00061405; + EURO72LORESLACEDPF_KEY = $00069405; + EURO72PRODUCTLACEDPF_KEY = $00069425; + EURO72EXTRALORESDPF2_KEY = $00061444; + EURO72LORESDPF2_KEY = $00069444; + EURO72PRODUCTDPF2_KEY = $00069464; + EURO72EXTRALORESLACEDPF2_KEY = $00061445; + EURO72LORESLACEDPF2_KEY = $00069445; + EURO72PRODUCTLACEDPF2_KEY = $00069465; + EURO72EXTRAHALFBRITE_KEY = $00061084; + EURO72EXTRAHALFBRITELACE_KEY = $00061085; + EURO72PRODUCTHAM_KEY = $00069824; + EURO72PRODUCTHAMLACE_KEY = $00069825; + EURO72LORESHAM_KEY = $00069804; + EURO72LORESHAMLACE_KEY = $00069805; + EURO72EXTRALORESHAM_KEY = EURO72HAM_KEY; + EURO72EXTRALORESHAMLACE_KEY = EURO72HAMLACE_KEY ; + EURO72EXTRALORESEHB_KEY = EURO72EXTRAHALFBRITE_KEY; + EURO72EXTRALORESEHBLACE_KEY = EURO72EXTRAHALFBRITELACE_KEY; + EURO72LORESEHB_KEY = $00069084; + EURO72LORESEHBLACE_KEY = $00069085; + EURO72EHB_KEY = $000690a4; + EURO72EHBLACE_KEY = $000690a5; +{ These ModeIDs are the scandoubled equivalents of the above, with the + exception of the DualPlayfield modes, as AA does not allow for scandoubling + dualplayfield.} + EURO72EXTRALORESDBL_KEY = $00061000; + EURO72LORESDBL_KEY = $00069000; + EURO72PRODUCTDBL_KEY = $00069020; + EURO72EXTRALORESHAMDBL_KEY = $00061800; + EURO72LORESHAMDBL_KEY = $00069800; + EURO72PRODUCTHAMDBL_KEY = $00069820; + EURO72EXTRALORESEHBDBL_KEY = $00061080; + EURO72LORESEHBDBL_KEY = $00069080; + EURO72PRODUCTEHBDBL_KEY = $000690a0; +// Euro 36 + EURO36_MONITOR_ID = $00071000; +{ Euro36 modeids can be ORed with the default modeids a la NTSC and PAL. + For example, Euro36 SuperHires is + (EURO36_MONITOR_ID OR SUPER_KEY)} +// Super 72 + SUPER72_MONITOR_ID = $00081000; +{ Super72 modeids can be ORed with the default modeids a la NTSC and PAL. + For example, Super72 SuperHiresLace (80$600) is + (SUPER72_MONITOR_ID OR SUPERLACE_KEY). + The following scandoubled Modes are the exception:} + SUPER72LORESDBL_KEY = $00081008; + SUPER72HIRESDBL_KEY = $00089008; + SUPER72SUPERDBL_KEY = $00089028; + SUPER72LORESHAMDBL_KEY = $00081808; + SUPER72HIRESHAMDBL_KEY = $00089808; + SUPER72SUPERHAMDBL_KEY = $00089828; + SUPER72LORESEHBDBL_KEY = $00081088; + SUPER72HIRESEHBDBL_KEY = $00089088; + SUPER72SUPEREHBDBL_KEY = $000890a8; +// DblNTSC + DBLNTSC_MONITOR_ID = $00091000; + + DBLNTSCLORES_KEY = $00091000; + DBLNTSCLORESFF_KEY = $00091004; + DBLNTSCLORESHAM_KEY = $00091800; + DBLNTSCLORESHAMFF_KEY = $00091804; + DBLNTSCLORESEHB_KEY = $00091080; + DBLNTSCLORESEHBFF_KEY = $00091084; + DBLNTSCLORESLACE_KEY = $00091005; + DBLNTSCLORESHAMLACE_KEY = $00091805; + DBLNTSCLORESEHBLACE_KEY = $00091085; + DBLNTSCLORESDPF_KEY = $00091400; + DBLNTSCLORESDPFFF_KEY = $00091404; + DBLNTSCLORESDPFLACE_KEY = $00091405; + DBLNTSCLORESDPF2_KEY = $00091440; + DBLNTSCLORESDPF2FF_KEY = $00091444; + DBLNTSCLORESDPF2LACE_KEY = $00091445; + DBLNTSCHIRES_KEY = $00099000; + DBLNTSCHIRESFF_KEY = $00099004; + DBLNTSCHIRESHAM_KEY = $00099800; + DBLNTSCHIRESHAMFF_KEY = $00099804; + DBLNTSCHIRESLACE_KEY = $00099005; + DBLNTSCHIRESHAMLACE_KEY = $00099805; + DBLNTSCHIRESEHB_KEY = $00099080; + DBLNTSCHIRESEHBFF_KEY = $00099084; + DBLNTSCHIRESEHBLACE_KEY = $00099085; + DBLNTSCHIRESDPF_KEY = $00099400; + DBLNTSCHIRESDPFFF_KEY = $00099404; + DBLNTSCHIRESDPFLACE_KEY = $00099405; + DBLNTSCHIRESDPF2_KEY = $00099440; + DBLNTSCHIRESDPF2FF_KEY = $00099444; + DBLNTSCHIRESDPF2LACE_KEY = $00099445; + DBLNTSCEXTRALORES_KEY = $00091200; + DBLNTSCEXTRALORESHAM_KEY = $00091a00; + DBLNTSCEXTRALORESEHB_KEY = $00091280; + DBLNTSCEXTRALORESDPF_KEY = $00091600; + DBLNTSCEXTRALORESDPF2_KEY = $00091640; + DBLNTSCEXTRALORESFF_KEY = $00091204; + DBLNTSCEXTRALORESHAMFF_KEY = $00091a04; + DBLNTSCEXTRALORESEHBFF_KEY = $00091284; + DBLNTSCEXTRALORESDPFFF_KEY = $00091604; + DBLNTSCEXTRALORESDPF2FF_KEY = $00091644; + DBLNTSCEXTRALORESLACE_KEY = $00091205; + DBLNTSCEXTRALORESHAMLACE_KEY = $00091a05; + DBLNTSCEXTRALORESEHBLACE_KEY = $00091285; + DBLNTSCEXTRALORESDPFLACE_KEY = $00091605; + DBLNTSCEXTRALORESDPF2LACE_KEY = $00091645; +// DBLPal + DBLPAL_MONITOR_ID = $000a1000; + + DBLPALLORES_KEY = $000a1000; + DBLPALLORESFF_KEY = $000a1004; + DBLPALLORESHAM_KEY = $000a1800; + DBLPALLORESHAMFF_KEY = $000a1804; + DBLPALLORESEHB_KEY = $000a1080; + DBLPALLORESEHBFF_KEY = $000a1084; + DBLPALLORESLACE_KEY = $000a1005; + DBLPALLORESHAMLACE_KEY = $000a1805; + DBLPALLORESEHBLACE_KEY = $000a1085; + DBLPALLORESDPF_KEY = $000a1400; + DBLPALLORESDPFFF_KEY = $000a1404; + DBLPALLORESDPFLACE_KEY = $000a1405; + DBLPALLORESDPF2_KEY = $000a1440; + DBLPALLORESDPF2FF_KEY = $000a1444; + DBLPALLORESDPF2LACE_KEY = $000a1445; + DBLPALHIRES_KEY = $000a9000; + DBLPALHIRESFF_KEY = $000a9004; + DBLPALHIRESHAM_KEY = $000a9800; + DBLPALHIRESHAMFF_KEY = $000a9804; + DBLPALHIRESLACE_KEY = $000a9005; + DBLPALHIRESHAMLACE_KEY = $000a9805; + DBLPALHIRESEHB_KEY = $000a9080; + DBLPALHIRESEHBFF_KEY = $000a9084; + DBLPALHIRESEHBLACE_KEY = $000a9085; + DBLPALHIRESDPF_KEY = $000a9400; + DBLPALHIRESDPFFF_KEY = $000a9404; + DBLPALHIRESDPFLACE_KEY = $000a9405; + DBLPALHIRESDPF2_KEY = $000a9440; + DBLPALHIRESDPF2FF_KEY = $000a9444; + DBLPALHIRESDPF2LACE_KEY = $000a9445; + DBLPALEXTRALORES_KEY = $000a1200; + DBLPALEXTRALORESHAM_KEY = $000a1a00; + DBLPALEXTRALORESEHB_KEY = $000a1280; + DBLPALEXTRALORESDPF_KEY = $000a1600; + DBLPALEXTRALORESDPF2_KEY = $000a1640; + DBLPALEXTRALORESFF_KEY = $000a1204; + DBLPALEXTRALORESHAMFF_KEY = $000a1a04; + DBLPALEXTRALORESEHBFF_KEY = $000a1284; + DBLPALEXTRALORESDPFFF_KEY = $000a1604; + DBLPALEXTRALORESDPF2FF_KEY = $000a1644; + DBLPALEXTRALORESLACE_KEY = $000a1205; + DBLPALEXTRALORESHAMLACE_KEY = $000a1a05; + DBLPALEXTRALORESEHBLACE_KEY = $000a1285; + DBLPALEXTRALORESDPFLACE_KEY = $000a1605; + DBLPALEXTRALORESDPF2LACE_KEY = $000a1645; + +// Tags + BIDTAG_DIPFMustHave = $80000001; // mask of the DIPF_ flags the ModeID must have Default - 0 + BIDTAG_DIPFMustNotHave = $80000002; // mask of the DIPF_ flags the ModeID must not have Default - SPECIAL_FLAGS + BIDTAG_ViewPort = $80000003; // ViewPort for which a ModeID is sought. Default - nil + BIDTAG_NominalWidth = $80000004; // \ together make the aspect ratio and + BIDTAG_NominalHeight = $80000005; // / override the vp^.Width/Height. Default - SourceID NominalDimensionInfo, + // or vp^.DWidth/Height, or (640 * 200), in that preferred order. + BIDTAG_DesiredWidth = $80000006; // \ Nominal Width and Height of the + BIDTAG_DesiredHeight = $80000007; // / returned ModeID. Default - same as Nominal + BIDTAG_Depth = $80000008; // ModeID must support this depth. Default - vp^.RasInfo^.BitMap^.Depth or 1 + BIDTAG_MonitorID = $80000009; // ModeID must use this monitor. Default - use best monitor available + BIDTAG_SourceID = $8000000a; // instead of a ViewPort. Default - VPModeID(vp) if BIDTAG_ViewPort is + // specified, else leave the DIPFMustHave and DIPFMustNotHave values untouched. + BIDTAG_RedBits = $8000000b; // \ + BIDTAG_BlueBits = $8000000c; // > Match up from the database + BIDTAG_GreenBits = $8000000d; // / Default - 4 + BIDTAG_GfxPrivate = $8000000e; // Private + +type +// the "public" handle to a DisplayInfoRecord + DisplayInfoHandle = APTR; + + PQueryHeader = ^TQueryHeader; + TQueryHeader = record + StructID, // datachunk type identifier + DisplayID, // copy of display record key + SkipID, // TAG_SKIP + Length: ULONG; // length of local data in double-longwords + end; + + PDisplayInfo = ^TDisplayInfo; + TDisplayInfo = record + Header: TQueryHeader; + NotAvailable: Word; // If 0 DisplayInfo available, else not available -> see Constants DI_AVAIL_* + PropertyFlags: ULONG; // Properties of this mode (DIPF_*) + Resolution: TPoint; // ticks-per-pixel X/Y + PixelSpeed: Word; // approximation in nanoseconds + NumStdSprites: Word; // number of standard amiga sprites + PaletteRange: Word; // distinguishable shades available + SpriteResolution: TPoint; // std sprite ticks-per-pixel X/Y + pad: array[0..3] of Byte; + RedBits: Byte; + GreenBits: Byte; + BlueBits: Byte; + pad2: array[0..4] of Byte; + Reserved: Array[0..1] of IPTR; // terminator + end; + +const + // availability TDisplayInfo.NotAvailable + DI_AVAIL_NOCHIPS = 1 shl 0; + DI_AVAIL_NOMONITOR = 1 shl 1; + DI_AVAIL_NOTWITHGENLOCK = 1 shl 2; +// Property Flags for TDisplayInfo.PropertyFlags + DIPF_IS_LACE = 1 shl 0; + DIPF_IS_DUALPF = 1 shl 1; + DIPF_IS_PF2PRI = 1 shl 2; + DIPF_IS_HAM = 1 shl 3; + DIPF_IS_ECS = 1 shl 4; // note: ECS modes (SHIRES, VGA, AND PRODUCTIVITY) + // do not support attached sprites. + DIPF_IS_PAL = 1 shl 5; + DIPF_IS_SPRITES = 1 shl 6; + DIPF_IS_GENLOCK = 1 shl 7; + DIPF_IS_WB = 1 shl 8; + DIPF_IS_DRAGGABLE = 1 shl 9; + DIPF_IS_PANELLED = 1 shl 10; + DIPF_IS_BEAMSYNC = 1 shl 11; + DIPF_IS_EXTRAHALFBRITE = 1 shl 12; + DIPF_IS_SPRITES_ATT = 1 shl 13; // supports attached sprites + DIPF_IS_SPRITES_CHNG_RES = 1 shl 14; // supports variable sprite resolution + DIPF_IS_SPRITES_BORDER = 1 shl 15; // sprite can be displayed in the border + DIPF_IS_AA = 1 shl 16; // AA modes - may only be available if machine has correct memory + // type to support required bandwidth - check availability. + DIPF_IS_SCANDBL = 1 shl 17; // scan doubled + DIPF_IS_SPRITES_CHNG_BASE = 1 shl 18; // can change the sprite base colour + DIPF_IS_SPRITES_CHNG_PRI = 1 shl 19; // can change the sprite priority with respect to the playfield(s). + DIPF_IS_DBUFFER = 1 shl 20; // can support double buffering + DIPF_IS_PROGBEAM = 1 shl 21; // is a programmed beam-sync mode + DIPF_IS_FOREIGN = 1 shl 22; // this mode is not native to the Amiga + +// Use these tags for passing to BestModeID() + SPECIAL_FLAGS = DIPF_IS_DUALPF or DIPF_IS_PF2PRI or DIPF_IS_HAM or DIPF_IS_EXTRAHALFBRITE; + +type + PDimensionInfo = ^TDimensionInfo; + TDimensionInfo = record + Header: TQueryHeader; + MaxDepth, // log2(max number of colors) + MinRasterWidth, // minimum width in pixels + MinRasterHeight, // minimum height in pixels + MaxRasterWidth, // maximum width in pixels + MaxRasterHeight: Word; // maximum height in pixels + Nominal, // "standard" dimensions + MaxOScan, // fixed, hardware dependant + VideoOScan, // fixed, hardware dependant + TxtOScan, // editable via preferences + StdOScan: TRectangle; // editable via preferences + Pad: array[0..13] of Byte; + Reserved: array[0..1] of IPTR; // terminator + end; + + PMonitorInfo = ^TMonitorInfo; + TMonitorInfo = record + Header: TQueryHeader; + Mspc: PMonitorSpec; // pointer to monitor specification + ViewPosition, // editable via preferences + ViewResolution: TPoint; // standard monitor ticks-per-pixel + ViewPositionRange: TRectangle; // fixed, hardware dependant + TotalRows, // display height in scanlines + TotalColorClocks, // scanline width in 280 ns units + MinRow: Word; // absolute minimum active scanline + Compatibility: SmallInt; // how this coexists with others (MCOMPAT_*) + Pad: array[0..31] of Byte; + MouseTicks: TPoint; + DefaultViewPosition: TPoint; + PreferredModeID: ULONG; + Reserved: array[0..1] of IPTR; // terminator + end; + +const +// monitor compatibility TMonitorInfo.Compatibility + MCOMPAT_NOBODY = -1; // only one viewport at a time + MCOMPAT_MIXED = 0; // can share display with other MCOMPAT_MIXED + MCOMPAT_SELF = 1; // can share only within same monitor + + DISPLAYNAMELEN = 32; +type + PNameInfo = ^TNameInfo; + TNameInfo = record + Header: TQueryHeader; + Name: array[0..DISPLAYNAMELEN - 1] of Char; + Reserved: array[0..1] of IPTR; // terminator + end; + +const + DTAG_DISP = TAG_USER; + DTAG_DIMS = TAG_USER + $1000; + DTAG_MNTR = TAG_USER + $2000; + DTAG_NAME = TAG_USER + $3000; + DTAG_VEC = TAG_USER + $4000; // internal use only + +type +// The following VecInfo structure is PRIVATE, for our use only Touch these, and burn! + PVecInfo = ^TVecInfo; + TVecInfo = record + Header: TQueryHeader; + Vec: APTR; + Data: APTR; + Type_: Word; // original "Type" in C Includes + pad: array[0..2] of Word; + Reserved: array[0..1] of IPTR; + end; +// AROS-specifics. +{$ifdef aros} +const +// Tags for AddDisplayDriverA() + DDRV_BootMode = TAG_USER + $01; // (LongBool) Boot mode driver which will be + // unloaded when any next driver comes in, default = False + DDRV_MonitorID = TAG_USER + $02; // (ULONG) Monitor ID for this driver, default = next available + DDRV_ReserveIDs = TAG_USER + $03; // (ULONG) How many monitor IDs to reserve, default = 1 + DDRV_KeepBootMode = TAG_USER + $04; // (LongBool) Do not shut down boot mode drivers, default = False + DDRV_ResultID = TAG_USER + $05; // (PLongWord) Obtain assigned monitor ID + DDRV_IDMask = TAG_USER + $06; // (ULONG) Use own mask for monitor ID separation +// Return codes + DD_OK = 0; // No error + DD_NO_MEM = 1; // Out of memory + DD_ID_EXISTS = 2; // Specified MonitorID is already allocated + +type +// This structure is subject to change! Private! + PMonitorHandle = ^TMonitorHandle; + TMonitorHandle = record + Next: PMonitorHandle; + id: ULONG; + mask: ULONG; + gfxhidd: APTR; + end; +{$endif} + +const + VTAG_END_CM = $00000000; + VTAG_CHROMAKEY_CLR = $80000000; + VTAG_CHROMAKEY_SET = $80000001; + VTAG_BITPLANEKEY_CLR = $80000002; + VTAG_BITPLANEKEY_SET = $80000003; + VTAG_BORDERBLANK_CLR = $80000004; + VTAG_BORDERBLANK_SET = $80000005; + VTAG_BORDERNOTRANS_CLR = $80000006; + VTAG_BORDERNOTRANS_SET = $80000007; + VTAG_CHROMA_PEN_CLR = $80000008; + VTAG_CHROMA_PEN_SET = $80000009; + VTAG_CHROMA_PLANE_SET = $8000000A; + VTAG_ATTACH_CM_SET = $8000000B; + VTAG_NEXTBUF_CM = $8000000C; + VTAG_BATCH_CM_CLR = $8000000D; + VTAG_BATCH_CM_SET = $8000000E; + VTAG_NORMAL_DISP_GET = $8000000F; + VTAG_NORMAL_DISP_SET = $80000010; + VTAG_COERCE_DISP_GET = $80000011; + VTAG_COERCE_DISP_SET = $80000012; + VTAG_VIEWPORTEXTRA_GET = $80000013; + VTAG_VIEWPORTEXTRA_SET = $80000014; + VTAG_CHROMAKEY_GET = $80000015; + VTAG_BITPLANEKEY_GET = $80000016; + VTAG_BORDERBLANK_GET = $80000017; + VTAG_BORDERNOTRANS_GET = $80000018; + VTAG_CHROMA_PEN_GET = $80000019; + VTAG_CHROMA_PLANE_GET = $8000001A; + VTAG_ATTACH_CM_GET = $8000001B; + VTAG_BATCH_CM_GET = $8000001C; + VTAG_BATCH_ITEMS_GET = $8000001D; + VTAG_BATCH_ITEMS_SET = $8000001E; + VTAG_BATCH_ITEMS_ADD = $8000001F; + VTAG_VPMODEID_GET = $80000020; + VTAG_VPMODEID_SET = $80000021; + VTAG_VPMODEID_CLR = $80000022; + VTAG_USERCLIP_GET = $80000023; + VTAG_USERCLIP_SET = $80000024; + VTAG_USERCLIP_CLR = $80000025; +// The following tags are V39 specific. They will be ignored (returing error -3) by earlier versions + VTAG_PF1_BASE_GET = $80000026; + VTAG_PF2_BASE_GET = $80000027; + VTAG_SPEVEN_BASE_GET = $80000028; + VTAG_SPODD_BASE_GET = $80000029; + VTAG_PF1_BASE_SET = $8000002a; + VTAG_PF2_BASE_SET = $8000002b; + VTAG_SPEVEN_BASE_SET = $8000002c; + VTAG_SPODD_BASE_SET = $8000002d; + VTAG_BORDERSPRITE_GET = $8000002e; + VTAG_BORDERSPRITE_SET = $8000002f; + VTAG_BORDERSPRITE_CLR = $80000030; + VTAG_SPRITERESN_SET = $80000031; + VTAG_SPRITERESN_GET = $80000032; + VTAG_PF1_TO_SPRITEPRI_SET = $80000033; + VTAG_PF1_TO_SPRITEPRI_GET = $80000034; + VTAG_PF2_TO_SPRITEPRI_SET = $80000035; + VTAG_PF2_TO_SPRITEPRI_GET = $80000036; + VTAG_IMMEDIATE = $80000037; + VTAG_FULLPALETTE_SET = $80000038; + VTAG_FULLPALETTE_GET = $80000039; + VTAG_FULLPALETTE_CLR = $8000003A; + VTAG_DEFSPRITERESN_SET = $8000003B; + VTAG_DEFSPRITERESN_GET = $8000003C; + +{ all the following tags follow the new, rational standard for videocontrol tags: + VC_xxx,state set the state of attribute 'xxx' to value 'state' + VC_xxx_QUERY,&var get the state of attribute 'xxx' and store it into the longword + pointed to by &var. + The following are new for V40:} + VC_IntermediateCLUpdate = $80000080; // default = True. When set graphics will update the intermediate copper + VC_IntermediateCLUpdate_Query = $80000081; // lists on color changes, etc. When false, it won't, and will be faster. + VC_NoColorPaletteLoad = $80000082; // default = False. When set, graphics will only load color 0 + VC_NoColorPaletteLoad_Query = $80000083; // for this ViewPort, and so the ViewPort's colors will come from the previous ViewPort's. + // NB - Using this tag and VTAG_FULLPALETTE_SET together is undefined. + VC_DUALPF_Disable = $80000084; // default = False. When this flag is set, the dual-pf bit + VC_DUALPF_Disable_Query = $80000085; // in Dual-Playfield screens will be turned off. Even bitplanes + // will still come from the first BitMap and odd bitplanes + // from the second BitMap, and both R[xy]Offsets will be + // considered. This can be used (with appropriate palette + // selection) for cross-fades between differently scrolling + // images. + // When this flag is turned on, colors will be loaded for + // the viewport as if it were a single viewport of depth + // depth1+depth2 +const + SPRITE_ATTACHED = $80; + +type + PPSimpleSprite = ^PSimpleSprite; + PSimpleSprite = ^TSimpleSprite; + TSimpleSprite = record + PosCtlData: PWord; + Height: Word; + x, y: Word; // current position + Num: Word; + end; + + PExtSprite = ^TExtSprite; + TExtSprite = record + es_SimpleSprite: TSimpleSprite; { conventional simple sprite structure } + es_WordWidth: Word; { graphics use only, subject to change } + es_Flags: Word; { graphics use only, subject to change } +{$ifdef aros} // New in AROS + es_Bitmap: PBitmap; // Actual image data. +{$endif} + end; + +const +// Tags for AllocSpriteData() + SPRITEA_Width = $81000000; + SPRITEA_XReplication = $81000002; + SPRITEA_YReplication = $81000004; + SPRITEA_OutputHeight = $81000006; + SPRITEA_Attached = $81000008; + SPRITEA_OldDataFormat = $8100000a; // MUST pass in outputheight if using this tag +// Tags for GetExtSprite() + GSTAG_SPRITE_NUM = $82000020; + GSTAG_ATTACHED = $82000022; + GSTAG_SOFTSPRITE = $82000024; +// Tags valid for either GetExtSprite or ChangeExtSprite + GSTAG_SCANDOUBLED = $83000000; // request "NTSC-Like" height if possible. + +type +// BitScaleArgs structure used by BitMapScale() + PBitScaleArgs = ^TBitScaleArgs; + TBitScaleArgs = record + bsa_SrcX, bsa_SrcY, // source origin + bsa_SrcWidth, bsa_SrcHeight, // source size + bsa_XSrcFactor, bsa_YSrcFactor, // scale factor denominators + bsa_DestX, bsa_DestY, // destination origin + bsa_DestWidth, bsa_DestHeight, // destination size result + bsa_XDestFactor, // scale factor numerators + bsa_YDestFactor: Word; + bsa_SrcBitMap, // source BitMap + bsa_DestBitMap: PBitMap; // destination BitMap + bsa_Flags: ULONG; // reserved. Must be zero! + bsa_XDDA, bsa_YDDA: Word; // reserved + bsa_Reserved1, + bsa_Reserved2: Longint; + end; + +const +// tag definitions for GetRPAttr, SetRPAttr + RPTAG_Font = $80000000; // get/set font + RPTAG_APen = $80000002; // get/set apen + RPTAG_BPen = $80000003; // get/set bpen + RPTAG_DrMd = $80000004; // get/set draw mode + RPTAG_OutlinePen = $80000005; // get/set outline pen. corrected case. + RPTAG_WriteMask = $80000006; // get/set WriteMask + RPTAG_MaxPen = $80000007; // get/set maxpen + RPTAG_DrawBounds = $80000008; // get only rastport draw bounds. pass @rect +// Extensions taken over from MorphOS + RPTAG_PenMode = $80000080; + RPTAG_FgColor = $80000081; + RPTAG_BgColor = $80000082; +{$ifdef aros} +// Extensions invented by AROS + RPTAG_PatternOriginX = $800000C0; // SmallInt + RPTAG_PatternOriginY = $800000C1; // SmallInt + RPTAG_ClipRectangle = $800000C2; // PRectangle Clones PRectangle. + RPTAG_ClipRectangleFlags = $800000C3; // LongWord + RPTAG_RemapColorFonts = $800000C4; // LongBool +{$endif} + +// Flags for ClipRectangleFlags + RPCRF_RELRIGHT = $01; // ClipRectangle.MaxX is relative to right of layer/bitmap + RPCRF_RELBOTTOM = $02; // ClipRectangle.MaxY is relative to bottom of layer/bitmap + RPCRF_VALID = $04; // private + +type + PGfxBase = ^tGfxBase; + TGfxBase = record + LibNode: TLibrary; + + ActiView: PView; // ViewPtr + CopInit: PCopInit; // ptr to copper start up list + Cia: PLongInt; // for 8520 resource use + blitter: PLongInt; // for future blitter resource use + LOFlist: PWord; + SHFlist: PWord; + blthd, + blttl: PBltNode; + bsblthd, + bsblttl: PBltNode; + vbsrv, + timsrv, + bltsrv: TInterrupt; + + TextFonts: TList; // Fonts + DefaultFont: PTextFont; + + Modes: Word; // copy of current first bplcon0 + VBlank: Shortint; + Debug: Shortint; + BeamSync: SmallInt; + system_bplcon0: SmallInt; // it is ored into each bplcon0 for display + SpriteReserved: Byte; + bytereserved: Byte; + Flags: Word; + BlitLock: SmallInt; + BlitNest: SmallInt; + + BlitWaitQ: TList; + BlitOwner: PTask; + TOF_WaitQ: tList; + + DisplayFlags: Word; // NTSC PAL GENLOC etc. Display flags are determined at power on + SimpleSprites: PPSimpleSprite; // SimpleSpritePtr ptr + + MaxDisplayRow: Word; // hardware stuff, do not use + MaxDisplayColumn: Word; // hardware stuff, do not use + NormalDisplayRows: Word; + NormalDisplayColumns: Word; + // the following are for standard non interlace, 1/2 wb width + NormalDPMX: Word; // Dots per meter on display + NormalDPMY: Word; // Dots per meter on display + + LastChanceMemory: PSignalSemaphore; + + LCMptr: PWord; + MicrosPerLine: Word; // 256 time usec/line + MinDisplayColumn: Word; + ChipRevBits0: Byte; + MemType: Byte; + crb_reserved: array[0..3] of Byte; + monitor_id: Word; // normally 0 + hedley: array[0..7] of IPTR; + hedley_sprites: array[0..7] of IPTR; // sprite ptrs for intuition mouse + hedley_sprites1: array[0..7] of IPTR; // sprite ptrs for intuition mouse + hedley_count: SmallInt; + hedley_flags: Word; + hedley_tmp: SmallInt; + + hash_table: ^IPTR; // Hashtable used for GfxAssociate() and GfxLookup() (private!) + current_tot_rows: Word; + current_tot_cclks: Word; + hedley_hint: Byte; + hedley_hint2: Byte; + nreserved: array[0..3] of ULONG; + a2024_sync_raster: PLongWord; + control_delta_pal: Word; + control_delta_ntsc: Word; + + Current_Monitor: PMonitorSpec; // MonitorSpec used for current display + MonitorList: TList; // List of all MonitorSpecs in the system + Default_Monitor: PMonitorSpec; // MonitorSpec of "default.monitor" + MonitorListSemaphore: PSignalSemaphore; // Semaphore for MonitorList access + + DisplayInfoDataBase: Pointer; // nil, unused by AROS + TopLine: Word; + ActiViewCprSemaphore: pSignalSemaphore; // Semaphore for active view access + + UtilityBase: PUtilityBase; // for hook AND tag utilities + ExecBase: PExecBase; // to link with rom.lib + + bwshifts: PShortInt; + StrtFetchMasks, + StopFetchMasks, + Overrun: PWord; + RealStops: PSmallInt; + SpriteWidth, // current width (in words) of sprites + SpriteFMode: Word; // current sprite fmode bits + SoftSprites, // bit mask of size change knowledgeable sprites + arraywidth: ShortInt; + DefaultSpriteWidth: Word; // what width intuition wants + SprMoveDisable: ShortInt; + WantChips, + BoardMemType, + Bugs: Byte; + gb_LayersBase: PLongWord; // layers.library base + ColorMask: ULONG; + IVector, + IData: APTR; + SpecialCounter: ULONG; // special for double buffering + DBList: APTR; + MonitorFlags: Word; + ScanDoubledSprites, + BP3Bits: Byte; + + MonitorVBlank: TAnalogSignalInterval; + Natural_Monitor: PMonitorSpec; // Default MonitorSpec for view without explicit MonitorSpec in ViewExtra + + ProgData: APTR; // nil not used in AROS + ExtSprites: Byte; + pad3: Byte; + GfxFlags: Word; + VBCounter: ULONG; + + HashTableSemaphore: PSignalSemaphore; // Semaphore for hash_table access, private in fact + + ChunkyToPlanarPtr: PLongWord; // HWEmul[0]; + HWEmul: array[1..8] of PLongWord; + end; + +type +// for SetDisplayDriverCallback + TDriverNotifyFunc = function (Obj: APTR; Add: LongBool; userdata: APTR): APTR; cdecl; + +const +//DisplayFlags + // Specify some system-wide options for Amiga(tm) chipset + NTSC = 1 shl 0; // Default mode is NTSC + GENLOC = 1 shl 1; // Genlock is in use + PAL = 1 shl 2; // Default mode is PAL + TODA_SAFE = 1 shl 3; + REALLY_PAL = 1 shl 4; + LPEN_SWAP_FRAMES = 1 shl 5; // When light pen is being used on interlaced screens, swap even and odd frames +// bits defs for ChipRevBits + GFXB_BIG_BLITS = 0 ; + GFXB_HR_AGNUS = 0 ; + GFXB_HR_DENISE = 1 ; + GFXB_AA_ALICE = 2 ; + GFXB_AA_LISA = 3 ; + GFXB_AA_MLISA = 4 ; { internal use only. } +// Bit Values for ChipRevBits + GFXF_BIG_BLITS = 1 shl GFXB_BIG_BLITS; + GFXF_HR_AGNUS = 1 shl GFXB_HR_AGNUS; + GFXF_HR_DENISE = 1 shl GFXB_HR_DENISE; + GFXF_AA_ALICE = 1 shl GFXB_AA_ALICE; + GFXF_AA_LISA = 1 shl GFXB_AA_LISA; + GFXF_AA_MLISA = 1 shl GFXB_AA_MLISA; { internal use only } + +//Pass ONE of these to SetChipRev() + SETCHIPREV_A = GFXF_HR_AGNUS; + SETCHIPREV_ECS = GFXF_HR_AGNUS or GFXF_HR_DENISE; + SETCHIPREV_AA = GFXF_AA_ALICE or GFXF_AA_LISA or SETCHIPREV_ECS; + SETCHIPREV_BEST = $ffffffff; + +// memory type + BUS_16 = 0; + BUS_32 = 1; + NML_CAS = 0; + DBL_CAS = 2; + + BANDWIDTH_1X = BUS_16 or NML_CAS; + BANDWIDTH_2XNML = BUS_32; + BANDWIDTH_2XDBL = DBL_CAS; + BANDWIDTH_4X = BUS_32 or DBL_CAS; + + BLITMSG_FAULT = 4; + +{ GfxFlags (private) } + NEW_DATABASE = 1; + + GRAPHICSNAME: PChar = 'graphics.library'; + +var + GfxBase: PGfxBase; + +procedure AddAnimOb(AnOb: PAnimOb; AnKey: PPAnimOb; Rp: PRastPort); syscall GfxBase 26; +procedure AddBob(Bob: PBob; Rp: PRastPort); syscall GfxBase 16; +function AddDisplayDriverA(GfxHidd: APTR; Tags: PTagItem): LongInt; syscall GfxBase 181; +procedure AddFont(TextFont: PTextFont); syscall GfxBase 80; +procedure AddVSprite(VSprite: PVSprite; Rp: PRastPort); syscall GfxBase 17; +function AllocBitMap(Sizex, Sizey, Depth, Flags: LongWord; Friend_Bitmap: PBitMap): PBitMap; syscall GfxBase 153; +function AllocDBufInfo(Vp: PViewPort): PDBufInfo; syscall GfxBase 161; +function AllocRaster(Width, Height: LongWord): TPlanePtr; syscall GfxBase 82; +function AllocSpriteDataA(Bitmap: PBitMap; TagList: PTagItem): PExtSprite; syscall GfxBase 170; +function AndRectRect(Rect1: PRectangle; Rect2: PRectangle; Intersect: PRectangle): LongBool; syscall GfxBase 193; +procedure AndRectRegion(Reg: PRegion; Rect :PRectangle); syscall GfxBase 84; +procedure AndRectRegionND(Reg: PRegion; Rect: PRectangle); syscall GfxBase 107; +function AndRegionRegion(SrcRegion: PRegion; DestRegion: PRegion): LongBool; syscall GfxBase 104; +function AndRegionRegionND(R1: PRegion; R2: PRegion): PRegion; syscall GfxBase 108; +procedure Animate(AnKey: PPAnimOb; Rp: PRastPort); syscall GfxBase 27; +function AreaDraw(Rp: PRastPort; x, y: SmallInt): LongWord; syscall GfxBase 43; +function AreaEllipse(Rp: PRastPort; xCenter, yCenter, a, b: SmallInt): LongWord; syscall GfxBase 31; +function AreaEnd(Rp: PRastPort): LongInt; syscall GfxBase 44; +function AreaMove(Rp: PRastPort; x, y: SmallInt): LongWord; syscall GfxBase 42; +function AreRegionsEqual(R1: PRegion; R2: PRegion): LongBool; syscall GfxBase 189; +procedure AskFont(Rp: PRastPort; TextAttr: PTextAttr); syscall GfxBase 79; +function AskSoftStyle(Rp: PRastPort): LongWord; syscall GfxBase 14; +function AttachPalExtra(Cm: PColorMap; Vp: PViewPort): LongInt; syscall GfxBase 139; +function AttemptLockLayerRom(l: PLayer): LongBool; syscall GfxBase 109; +function BestModeIDA(Tags: PTagItem): LongWord; syscall GfxBase 175; +procedure BitMapScale(BitScaleArgs: PBitScaleArgs); syscall GfxBase 113; +function BltBitMap(const SrcBitMap: PBitMap; xSrc, ySrc: LongInt; DestBitMap: PBitMap; xDest, yDest, xSize, ySize: LongInt; MinTerm : LongWord; Mask: LongWord; TempA: TPlanePtr): LongInt; syscall GfxBase 5; +procedure BltBitMapRastPort(const SrcBitMap: PBitMap; xSrc, ySrc: LongInt; DestRP: PRastPort; xDest, yDest, xSize, ySize: LongInt; MinTerm: LongWord); syscall GfxBase 101; +procedure BltClear(MemBlock: Pointer; ByteCount: LongWord; Flags: LongWord); syscall GfxBase 50; deprecated; +procedure BltMaskBitMapRastPort(SrcBitMap: PBitMap; xSrc, ySrc: LongInt; DestRP: PRastPort; xDest, yDest, xSize, ySize: LongInt; MinTerm: LongWord; bltMask: TPlanePtr); syscall GfxBase 106; +procedure BltPattern(Rp: PRastPort; mask: TPlanePtr; xMin, yMin, xMax, yMax: LongInt; ByteCnt: LongWord); syscall GfxBase 52; +procedure BltRastPortBitMap(SrcRastPort: PRastPort; xSrc, ySrc: LongInt; DestBitMap: PBitMap; xDest, yDest, xSize, ySize, MinTerm: LongWord); syscall GfxBase 196; +procedure BltTemplate(const Source: TPlanePtr; xSrc, srcMod: LongInt; DestRP: PRastPort; xDest, yDest, xSize, ySize: LongInt); syscall GfxBase 6; +function CalcIVG(View: PView; ViewPort: PViewPort): Word; syscall GfxBase 138; unimplemented; +procedure CBump(CopList: PUCopList); syscall GfxBase 61; +function ChangeExtSpriteA(Vp: PViewPort; Oldsprite: PExtSprite; NewSprite: PExtSprite; Tags: PTagItem): LongInt; syscall GfxBase 171; +procedure ChangeSprite(Vp: PViewPort; s: PSimpleSprite; NewData: Pointer); syscall GfxBase 70; unimplemented; +procedure ChangeVPBitMap(Vp: PViewPort; Bm: PBitMap; Db: PDBufInfo); syscall GfxBase 157; +procedure ClearEOL(Rp: PRastPort); syscall GfxBase 7; +function ClearRectRegion(Reg: PRegion; Rect: PRectangle): LongBool; syscall GfxBase 87; +function ClearRectRegionND(Reg: PRegion; Rect: PRectangle): PRegion; syscall GfxBase 124; +procedure ClearRegion(Region: PRegion); syscall GfxBase 88; +function ClearRegionRegion(R1: PRegion; R2: PRegion): LongBool; syscall GfxBase 187; +function ClearRegionRegionND(R1: PRegion; R2: PRegion): PRegion; syscall GfxBase 141; +procedure ClearScreen(Rp: PRastPort); syscall GfxBase 8; +procedure ClipBlit(SrcRP: PRastPort; xSrc, ySrc: LongInt; DestRP: PRastPort; xDest, yDest, xSize, ySize: LongInt; MinTerm: Byte); syscall GfxBase 92; +procedure CloseFont(TextFont: PTextFont); syscall GfxBase 13; +function CloseMonitor(Monitor_Spec: PMonitorSpec): LongInt; syscall GfxBase 120; +procedure CMove(CopList: PUCopList; Reg: Pointer; Value: LongInt); syscall GfxBase 62; +function CoerceMode(RealViewPort: PViewPort; MonitorID: LongWord; Flags: LongWord): LongWord; syscall GfxBase 156; unimplemented; +function CopyRegion(Region: PRegion): PRegion; syscall GfxBase 188; +procedure CopySBitMap(l: PLayer); syscall GfxBase 75; +function CreateRastPort: PRastPort; syscall GfxBase 177; +function CloneRastPort(Rp: PRastPort): PRastPort; syscall GfxBase 178; +procedure DeinitRastPort(Rp: PRastPort); syscall GfxBase 179; +procedure FreeRastPort(Rp: PRastPort); syscall GfxBase 180; +procedure CWait(CopList: PUCopList; V: SmallInt; H: SmallInt); syscall GfxBase 63; +procedure DisownBlitter; syscall GfxBase 77; +procedure DisposeRegion(Region: PRegion); syscall GfxBase 89; +procedure DoCollision(Rp: PRastPort); syscall GfxBase 18; +function DoPixelFunc(Rp: PRastPort; x, y: LongInt; Render_Func: Pointer; FuncData: APTR; Do_Update: LongBool): LongInt; syscall GfxBase 185; +function DoRenderFunc(Rp: PRastPort; Src: PPoint; Rr: PRectangle; Render_Func: Pointer; FuncData: APTR; Do_Update: LongBool): LongInt; syscall GfxBase 184; +procedure Draw(Rp: PRastPort; x, y: LongInt); syscall GfxBase 41; +procedure DrawEllipse(Rp: PRastPort; xCenter, yCenter, a, b: LongInt); syscall GfxBase 30; +procedure DrawGList(Rp: PRastPort; Vp: PViewPort); syscall GfxBase 19; +procedure EraseRect(Rp: PRastPort; xMin, yMin, xMax, yMax: LongInt); syscall GfxBase 135; +function ExtendFont(Font: PTextFont; FontTags: PTagItem): LongWord; syscall GfxBase 136; +function FillRectPenDrMd(Rp: PRastPort; x1, y1, x2, y2: LongInt; Pix: Pointer{HIDDT_Pixel}; drmd: Pointer{HIDDT_DrawMode}; Do_Update: LongBool): LongInt; syscall GfxBase 183; +function FindColor(Cm: PColorMap; r, g, b, MaxPen: LongWord): LongWord; syscall GfxBase 168; +function FindDisplayInfo(ID: LongWord): DisplayInfoHandle; syscall GfxBase 121; +function Flood(Rp: PRastPort; Mode: LongWord; x, y: LongInt): LongBool; syscall GfxBase 55; +procedure FontExtent(Font: PTextFont; FontExtent: PTextExtent); syscall GfxBase 127; +procedure FreeBitMap(Bm: PBitMap); syscall GfxBase 154; +procedure FreeColorMap(ColorMap: PColorMap); syscall GfxBase 96; +procedure FreeCopList(CopList: PCopList); syscall GfxBase 91; +procedure FreeCprList(CprList: PCprList); syscall GfxBase 94; +procedure FreeDBufInfo(Dbi: PDBufInfo); syscall GfxBase 162; +procedure FreeGBuffers(AnOb: PAnimOb; Rp: PRastPort; db: LongBool); syscall GfxBase 100; +procedure FreeRaster(p: TPlanePtr; Width, Height: LongWord); syscall GfxBase 83; +procedure FreeSprite(Pick: SmallInt); syscall GfxBase 69; +procedure FreeSpriteData(ExtSp: PExtSprite); syscall GfxBase 172; +procedure FreeVPortCopLists(Vp: PViewPort); syscall GfxBase 90; +function GetAPen(Rp: PRastPort): LongWord; syscall GfxBase 143; +function GetBitMapAttr(BitMap: PBitMap; Attribute: LongWord): IPTR; syscall GfxBase 160; +function GetBPen(Rp: PRastPort): LongWord; syscall GfxBase 144; +function GetColorMap(Entries: LongWord): PColorMap; syscall GfxBase 95; +function GetDisplayInfoData(Handle: DisplayInfoHandle; Buf: PChar; Size: LongWord; TagID: LongWord; ID: LongWord): LongWord; syscall GfxBase 126; +function GetDrMd(Rp: PRastPort): LongWord; syscall GfxBase 145; +function GetExtSpriteA(Sprite: PExtSprite; Tags: PTagItem): LongInt; syscall GfxBase 155; +function GetGBuffers(AnOb: PAnimOb; Rp: PRastPort; Db: LongBool): LongBool; syscall GfxBase 28; +function GetOutlinePen(Rp: PRastPort): LongWord; syscall GfxBase 146; +procedure GetRGB32(Cm: PColorMap; FirstColor: LongWord; NColors: LongWord; Table: PLongWord); syscall GfxBase 150; +function GetRGB4(ColorMap: PColorMap; Entry: LongInt): LongWord; syscall GfxBase 97; +procedure GetRPAttrsA(Rp: PRastPort; Tags: PTagItem); syscall GfxBase 174; +function GetSprite(Sprite: PSimpleSprite; Pick: SmallInt): SmallInt; syscall GfxBase 68; +function GetVPModeID(Vp: PViewPort): LongWord; syscall GfxBase 132; +procedure GfxAssociate(Pointer_: Pointer; Node: PExtendedNode); syscall GfxBase 112; +procedure GfxFree(Node: PExtendedNode); syscall GfxBase 111; +function GfxLookUp(Pointer_: Pointer): PExtendedNode; syscall GfxBase 117; +function GfxNew(Node_Type: LongWord): PExtendedNode; syscall GfxBase 110; +procedure InitArea(AreaInfo: PAreaInfo; Buffer: Pointer; MaxVectors: SmallInt); syscall GfxBase 47; +procedure InitBitMap(Bm: PBitMap; Depth: ShortInt; Width, Height: Word); syscall GfxBase 65; +procedure InitGels(Head: PVSprite; Tail: PVSprite; GelsInfo: PGelsInfo); syscall GfxBase 20; +procedure InitGMasks(AnOb: PAnimOb); syscall GfxBase 29; +procedure InitMasks(VSprite: PVSprite); syscall GfxBase 21; +procedure InitRastPort(Rp: PRastPort); syscall GfxBase 33; +function InitTmpRas(TmpRas: PTmpRas; Buffer: Pointer; Size: LongWord): PTmpRas; syscall GfxBase 78; +procedure InitView(View: PView); syscall GfxBase 60; +procedure InitVPort(Vp: PViewPort); syscall GfxBase 34; +function IsPointInRegion(Reg: PRegion; x, y: SmallInt): LongBool; syscall GfxBase 190; +procedure LoadRGB32(Vp: PViewPort; const Table: PLongWord); syscall GfxBase 147; +procedure LoadRGB4(Vp: PViewPort; Colors: PWord; Count: LongInt); syscall GfxBase 32; +procedure LoadView(View: PView); syscall GfxBase 37; +procedure LockLayerRom(l: PLayer); syscall GfxBase 72; +function MakeVPort(View: PView; ViewPort: PViewPort): LongWord; syscall GfxBase 36; +function ModeNotAvailable(ModeID: LongWord): LongWord; syscall GfxBase 133; +procedure Move(Rp: PRastPort; x, y: SmallInt); syscall GfxBase 40; +procedure MoveSprite(Vp: PViewPort; Sprite: PSimpleSprite; x, y: SmallInt); syscall GfxBase 71; +function MrgCop(View: PView): LongWord; syscall GfxBase 35; +function NewRectRegion(MinX, MinY, MaxX, MaxY: SmallInt): PRegion; syscall GfxBase 194; +function NewRegion: PRegion; syscall GfxBase 86; +function NextDisplayInfo(Last_ID: LongWord): LongWord; syscall GfxBase 122; +function ObtainBestPenA(Cm: PColorMap; r, g, b: LongWord; Tags: PTagItem): LongInt; syscall GfxBase 140; +function ObtainPen(Cm: PColorMap; n, r, g, b: LongWord; Flags: LongWord): LongInt; syscall GfxBase 159; +function OpenFont(TextAttr: PTextAttr): PTextFont; syscall GfxBase 12; +function OpenMonitor(MonitorName: STRPTR; DisplayID: LongWord): PMonitorSpec; syscall GfxBase 119; +function OrRectRegion(Reg: PRegion; Rect: PRectangle): LongBool; syscall GfxBase 85; +function OrRectRegionND(Reg: PRegion; Rect: PRectangle): PRegion; syscall GfxBase 123; +function OrRegionRegion(SrcRegion: PRegion; DestRegion: PRegion): LongBool; syscall GfxBase 102; +function OrRegionRegionND(R1: PRegion; R2: PRegion): PRegion; syscall GfxBase 125; +procedure OwnBlitter; syscall GfxBase 76; +procedure PolyDraw(Rp: PRastPort; Count: LongInt; PolyTable: PSmallInt); syscall GfxBase 56; +procedure QBlit(Blit: PBltNode); syscall GfxBase 46; +procedure QBSBlit(Blit: PBltNode); syscall GfxBase 49; +function ReadPixel(Rp: PRastPort; x, y: LongInt): LongInt; syscall GfxBase 53; +function ReadPixelArray8(Rp: PRastPort; xStart, yStart, xStop, yStop: LongWord; Array_: PByte; TempRp: PRastPort): LongInt; syscall GfxBase 130; +function ReadPixelLine8(Rp: PRastPort; xStart, yStart, Width: LongWord; Array_: PByte; TempRP: PRastPort): LongInt; syscall GfxBase 128; +procedure RectFill(Rp: PRastPort; xMin, yMin, xMax, yMax : LongInt); syscall GfxBase 51; +procedure ReleasePen(Cm: PColorMap; n: LongWord); syscall GfxBase 158; +procedure RemFont(TextFont: PTextFont); syscall GfxBase 81; +procedure RemIBob(Bob: PBob; Rp: PRastPort; Vp: PViewPort); syscall GfxBase 22; +procedure RemVSprite(VSprite: PVSprite); syscall GfxBase 23; +function ScalerDiv(Factor: LongWord; Numerator: LongWord; Denominator: LongWord): Word; syscall GfxBase 114; +procedure ShowImminentReset; syscall GfxBase 197; +procedure ScrollRaster(Rp: PRastPort; dx, dy, xMin, yMin, xMax, yMax: LongInt); syscall GfxBase 66; +procedure ScrollRasterBF(Rp: PRastPort; dx, dy, xMin, yMin, xMax, yMax: LongInt); syscall GfxBase 167; +function ScrollRegion(Region: PRegion; Rect: PRectangle; Dx, Dy: SmallInt): LongBool; syscall GfxBase 191; +procedure ScrollVPort(Vp: PViewPort); syscall GfxBase 98; +procedure SetABPenDrMd(Rp: PRastPort; APen: LongWord; BPen: LongWord; DrawMode: LongWord); syscall GfxBase 149; +procedure SetAPen(Rp: PRastPort; Pen: LongWord); syscall GfxBase 57; +procedure SetBPen(Rp: PRastPort; Pen: LongWord); syscall GfxBase 58; +function SetChipRev(ChipRev: LongWord): LongWord; platform; syscall GfxBase 148; +procedure SetCollision(Num: LongWord; Routine: TProcedure; GInfo: PGelsInfo); syscall GfxBase 24; +procedure SetDisplayDriverCallback(CallBack: TDriverNotifyFunc; UserData: APTR); syscall GfxBase 186; +procedure SetDrMd(Rp: PRastPort; DrawMode: LongWord); syscall GfxBase 59; +procedure SetFont(Rp: PRastPort; TextFont: PTextFont); syscall GfxBase 11; +procedure SetMaxPen(Rp: PRastPort; MaxPen: LongWord); syscall GfxBase 165; +function SetOutlinePen(Rp: PRastPort; Pen: LongWord): LongWord; syscall GfxBase 163; +procedure SetRast(Rp: PRastPort; Pen: LongWord); syscall GfxBase 39; +function SetRegion(Src: PRegion; Dest: PRegion): LongBool; syscall GfxBase 195; +procedure SetRGB32(Vp: PViewPort; n, r, g, b : LongWord); syscall GfxBase 142; +procedure SetRGB32CM(Cm: PColorMap; n, r, g, b: LongWord); syscall GfxBase 166; +procedure SetRGB4(Vp: PViewPort; n, r, g, b: LongWord); syscall GfxBase 48; +procedure SetRGB4CM(Cm: PColorMap; n: SmallInt; r, g, b: Byte); syscall GfxBase 105; +procedure SetRPAttrsA(Rp: PRastPort; Tags: PTagItem); syscall GfxBase 173; +function SetSoftStyle(Rp: PRastPort; Style: LongWord; Enable: LongWord): LongWord; syscall GfxBase 15; +function SetWriteMask(Rp: PRastPort; Mask: LongWord): LongWord; syscall GfxBase 164; +procedure SortGList(Rp: PRastPort); syscall GfxBase 25; +procedure StripFont(Font: PTextFont); syscall GfxBase 137; +function SwapRegions(Region1: PRegion; Region2: PRegion; Intersect: PRectangle): LongBool; syscall GfxBase 192; +procedure SyncSBitMap(l: PLayer); syscall GfxBase 74; +procedure GfxText(Rp: PRastPort; const String_: STRPTR; Count: LongWord); syscall GfxBase 10; +procedure TextExtent(Rp: PRastPort; const String_: STRPTR; Count: LongWord; TextExtent_: PTextExtent); syscall GfxBase 115; +function TextFit(Rp: PRastPort; const String_: STRPTR; StrLen: LongWord; TextExtent_: PTextExtent; ConstrainingExtent: PTextExtent; StrDirection: LongInt; ConstrainingBitWidth: LongWord; ConstrainingBitHeight: LongWord): LongWord; syscall GfxBase 116; +function TextLength(Rp: PRastPort; const string_: STRPTR; Count: LongWord): SmallInt; syscall GfxBase 9; +function UCopperListInit(Ucl: PUCopList; n: SmallInt): PCopList; syscall GfxBase 99; +procedure UnlockLayerRom(l: PLayer); syscall GfxBase 73; +function VBeamPos: LongInt; platform; syscall GfxBase 64; +function VideoControl(Cm: PColorMap; Tags: PTagItem): LongWord; syscall GfxBase 118; unimplemented; +procedure WaitBlit; syscall GfxBase 38; unimplemented; +procedure WaitBOVP(Vp: PViewPort); syscall GfxBase 67; unimplemented; +procedure WaitTOF; syscall GfxBase 45; +function WeighTAMatch(ReqTextAttr: PTextAttr; TargetTextAttr: PTextAttr; TargetTags: PTagItem): SmallInt; syscall GfxBase 134; +procedure WriteChunkyPixels(Rp: PRastPort; xStart, yStart, xStop, yStop: LongWord; Array_: PByte; BytesPerRow: LongInt); syscall GfxBase 176; +function WritePixel(Rp: PRastPort; x, y: LongInt): LongInt; syscall GfxBase 54; +function WritePixelArray8(Rp: PRastPort; xStart, yStart, xStop, yStop: LongWord; Array_: PByte; TempRp: PRastPort): LongInt; syscall GfxBase 131; +function WritePixelLine8(Rp: PRastPort; xStart, yStart, Width: LongWord; Array_: PByte; TempRP: PRastPort): LongInt; syscall GfxBase 129; +function WritePixels8(Rp: PRastPort; Array_: PByte; Modulo: LongWord; xStart, yStart, xStop, yStop: LongWord; PixLUT: Pointer{PHIDDT_PixelLUT}; Do_Update: LongBool): LongInt; syscall GfxBase 182; +function XorRectRegion(Reg: PRegion; Rect: PRectangle): LongBool; syscall GfxBase 93; +function XorRectRegionND(Reg: PRegion; Rect: PRectangle): PRegion; syscall GfxBase 152; +function XorRegionRegion(SrcRegion: PRegion; DestRegion: PRegion): LongBool; syscall GfxBase 103; +function XorRegionRegionND(R1: PRegion; R2: PRegion): PRegion; syscall GfxBase 151; + +function BestModeID(Tags: array of const): LongWord; +function AllocSpriteData(Bitmap: PBitMap; Tags: array of const): PExtSprite; +function ChangeExtSprite(Vp: PViewPort; Oldsprite: PExtSprite; NewSprite: PExtSprite; Tags: array of const): LongInt; +function ExtendFontTags(Font: PTextFont; Tags: array of const): LongWord; +function GetExtSprite(Sprite: PExtSprite; Tags: array of const): LongInt; +procedure GetRPAttrs(Rp: PRastPort; Tags: array of const); +function ObtainBestPen(Cm: PColorMap; r, g, b: LongWord; Tags: array of const): LongInt; +procedure SetRPAttrs(Rp: PRastPort; Tags: array of const); +function VideoControlTags(Cm: PColorMap; Tags: array of const): LongWord; unimplemented; + +// gfxmacros + +// This one is used for determining optimal offset for blitting into cliprects +function Align_Offset(x: Pointer): Pointer; +function Is_Visible(l: PLayer): Boolean; +procedure InitAnimate(var Animkey: PAnimOb); +procedure RemBob(B: PBob); + +function RasSize(w, h: Word): Integer; +function BitmapFlags_are_Extended(f: LongInt): Boolean; +function GetTextFontReplyPort(Font: PTextFont): PMsgPort; + +procedure BNDRYOFF(w: PRastPort); + +procedure SetAfPt(w: PRastPort; p: Pointer; n: Byte); +procedure SetDrPt(w: PRastPort; p: Word); +procedure SetOPen(w: PRastPort; c: Byte); +procedure SetWrMsk(w: PRastPort; m: Byte); + +function SetAOlPen(Rp: PRastPort; Pen: LongWord): LongWord; + +procedure DrawCircle(Rp: PRastPort; xCenter, yCenter, r: LongInt); +function AreaCircle(Rp: PRastPort; xCenter, yCenter, r: SmallInt): LongWord; + +// Copper helper +function CINIT(c: PUCopList; n: SmallInt): PCopList; +procedure CMOVE1(c: PUCopList; a: Pointer; b: LongInt); +procedure CWAIT1(c: PUCopList; a: SmallInt; b: SmallInt); +procedure CEND(c: PUCopList); + +implementation + +uses + tagsarray; + +function BestModeID(Tags: array of const): LongWord; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := BestModeIDA(GetTagPtr(TagList)); +end; + +function AllocSpriteData(Bitmap: PBitMap; Tags: array of const): PExtSprite; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := AllocSpriteDataA(Bitmap, GetTagPtr(TagList)); +end; + +function ChangeExtSprite(Vp: PViewPort; Oldsprite: PExtSprite; NewSprite: PExtSprite; Tags: array of const): LongInt; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := ChangeExtSpriteA(Vp, Oldsprite, NewSprite, GetTagPtr(TagList)); +end; + +function ExtendFontTags(Font: PTextFont; Tags: array of const): LongWord; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := ExtendFont(Font, GetTagPtr(TagList)); +end; + +function GetExtSprite(Sprite: PExtSprite; Tags: array of const): LongInt; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := GetExtSpriteA(Sprite, GetTagPtr(TagList)); +end; + +procedure GetRPAttrs(Rp: PRastPort; Tags: array of const); +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + GetRPAttrsA(Rp, GetTagPtr(TagList)); +end; + +function ObtainBestPen(Cm: PColorMap; r, g, b: LongWord; Tags: array of const): LongInt; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := ObtainBestPenA(Cm, r, g, b, GetTagPtr(TagList)); +end; + +procedure SetRPAttrs(Rp: PRastPort; Tags: array of const); +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + SetRPAttrsA(Rp, GetTagPtr(TagList)); +end; + +function VideoControlTags(Cm: PColorMap; Tags: array of const): LongWord; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + {$WARNINGS OFF} // suppress unimplemented Warning + Result := VideoControl(Cm, GetTagPtr(TagList)); + {$WARNINGS ON} +end; + +function Align_Offset(x: Pointer): Pointer; inline; +begin + Align_Offset := Pointer(PtrUInt(x) and $0F); +end; + +function Is_Visible(l: PLayer): Boolean; inline; +begin + Is_Visible := l^.Visible <> 0; +end; + +procedure InitAnimate(var AnimKey: PAnimOb); inline; +begin + AnimKey := nil; +end; + +procedure RemBob(B: PBob); inline; +begin + B^.Flags := B^.Flags or BOBSAWAY; +end; + +function RasSize(w, h: Word): Integer; inline; +begin + Result := h * (((w + 15) shr 3) and $FFFE); +end; + +function BitmapFlags_are_Extended(f: LongInt): Boolean; inline; +begin + BitmapFlags_are_Extended := (f and BMF_CHECKMASK) = BMF_CHECKVALUE; +end; + +function GetTextFontReplyPort(Font: PTextFont): PMsgPort; inline; +var + tfe: PTextFontExtension; +begin + tfe := PTextFontExtension(ExtendFont(Font, nil)); + if Assigned(tfe) then + GetTextFontReplyPort := tfe^.tfe_OrigReplyPort + else + GetTextFontReplyPort := Font^.tf_Message.mn_ReplyPort; +end; + +function SetAOlPen(Rp: PRastPort; Pen: LongWord): LongWord; inline; +begin + Result := SetOutlinePen(Rp, Pen); +end; + +procedure BNDRYOFF (w: PRastPort); inline; +begin + w^.Flags := w^.Flags and (not AREAOUTLINE); +end; + +procedure SetAfPt(w: PRastPort; p: Pointer; n: Byte); inline; +begin + w^.AreaPtrn := p; + w^.AreaPtSz := n; +end; + +procedure SetDrPt(w: PRastPort; p: Word); inline; +begin + w^.LinePtrn := p; + w^.Flags := w^.Flags or (FRST_DOT or $10); + w^.linpatcnt := 15; +end; + +procedure SetOPen(w: PRastPort; c: Byte); inline; +begin + w^.AOlPen := c; + w^.Flags := w^.Flags or AREAOUTLINE; +end; + +{ This function is fine, but FOR OS39 the SetWriteMask() gfx function + should be prefered because it SHOULD operate WITH gfx boards as well. + At least I hope it does.... } +procedure SetWrMsk(w: PRastPort; m: Byte); inline; +begin + w^.Mask := m; +end; + +procedure DrawCircle(Rp: PRastPort; xCenter, yCenter, r: LongInt); inline; +begin + DrawEllipse(Rp, xCenter, yCenter, r, r); +end; + +function AreaCircle(Rp: PRastPort; xCenter, yCenter, r: SmallInt): LongWord; inline; +begin + Result := AreaEllipse(Rp, xCenter, yCenter, r, r); +end; + +function CINIT(c: PUCopList; n: SmallInt): PCopList; inline; +begin + Result := UCopperListInit(c, n); +end; + +procedure CMOVE1(c: PUCopList; a: Pointer; b: LongInt); +begin + CMove(c, a, b); + CBump(c); +end; + +procedure CWait1(c: PUCopList; a: SmallInt; b: SmallInt); inline; +begin + CWait(c, a, b); + CBump(c); +end; + +procedure CEND(c: PUCopList); inline; +begin + CWAIT(c, 10000, 255); +end; + +initialization + GfxBase := PGfxBase(OpenLibrary(GRAPHICSNAME, 36)); +finalization + CloseLibrary(PLibrary(GfxBase)); +end. + + + + + + diff --git a/packages/arosunits/src/amigados.pas b/packages/arosunits/src/amigados.pas new file mode 100644 index 0000000000..95dd55b7eb --- /dev/null +++ b/packages/arosunits/src/amigados.pas @@ -0,0 +1,2196 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + dos.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} +{ + missing elf.h // Elfheader + BSTR Funktions + + defines: + AROS_FAST_BPTR: BPTR is a pointer or a 2 shifted Pointer ->? whats standard? +} + +unit amigados; +{$mode objfpc} +interface + +uses + exec, utility, timer; + +{$PACKRECORDS C} + +const +{ Predefined Amiga DOS global constants } + DOSTRUE = -1; + DOSFALSE = 0; + TICKS_PER_SECOND = 50; { Number of ticks in one second } + + // Still to TEST + BITSPERBYTE = 8; + BYTESPERLONG = 4; + BITSPERLONG = 32; + +type + FileHandle = BPTR; + FileLock = BPTR; + +{* All BCPL data must be long Integer aligned. BCPL pointers are the long Integer + * address (i.e byte address divided by 4 (>>2)) *} + +{* BCPL strings have a length in the first byte and then the characters. + * For example: s[0]=3 s[1]=S s[2]=Y s[3]=S *} + + + +const +// DOS functions will return this when they reach EOF. */ + ENDSTREAMCH = -1; +// Buffering types for SetVBuf(). + BUF_LINE = 0; // Flush at the end of lines '\n'. + BUF_FULL = 1; // Flush only when buffer is full. + BUF_NONE = 2; // Do not buffer, read and write immediatly. + +type + PDateStamp = ^TDateStamp; + TDateStamp = record + ds_Days: Longint; { Number of days since Jan. 1, 1978 } + ds_Minute: Longint; { Number of minutes past midnight } + ds_Tick: Longint; { Number of ticks past minute } + end; + +const +{ The maximum length of filenames in AmigaOS. You should not depend on + this value, as it may change in future versions.} + MAXFILENAMELENGTH = 108; + +{ The maximum length of comments in AmigaOS. You should not depend on + this value, as it may change in future versions.} + MAXCOMMENTLENGTH = 80; + +type +{ Returned by Examine() and ExInfo(), must be on a 4 byte boundary + Structure used to describe a directory entry. Note that not all fields + are supported by all filesystems. This structure should be allocated + with AllocDosObject(). } + PFileInfoBlock = ^TFileInfoBlock; + TFileInfoBlock = record + fib_DiskKey: IPTR; + fib_DirEntryType: LongInt; // type of Directory. If < 0, then a plain file. If > 0 a directory + fib_FileName: array [0..MAXFILENAMELENGTH - 1] of Char; // Null terminated. Max 30 chars used for now + fib_Protection: LongInt; // bit mask of protection, rwxd are 3-0. + fib_EntryType: LongInt; + fib_Size: LongInt; // Number of bytes in file + fib_NumBlocks: LongInt; // Number of blocks in file + fib_Date: TDateStamp; // Date file last changed + fib_Comment: array [0..MAXCOMMENTLENGTH - 1] of Char; // Null terminated comment associated with file + fib_OwnerUID: Word; // UserID of fileowner. + fib_OwnerGID: Word; // GroupID of fileowner. + fib_Reserved: array [0..31] of Char; // PRIVATE + end; + +const +{ FIB stands for TFileInfoBlock (fib_Protection)} + +{ FIBB are bit definitions, FIBF are field definitions + Regular RWED bits are 0 == allowed. + NOTE: GRP and OTR RWED permissions are 0 == not allowed! + Group and Other permissions are not directly handled by the filesystem} + FIBB_DELETE = 0; // prevent file from being deleted } + FIBB_EXECUTE = 1; // ignored by system, used by Shell } + FIBB_WRITE = 2; // ignored by old filesystem } + FIBB_READ = 3; // ignored by old filesystem } + FIBB_ARCHIVE = 4; // cleared whenever file is changed } + FIBB_PURE = 5; // program is reentrant and rexecutable} + FIBB_SCRIPT = 6; // program is a script (execute) file } +// group flags + FIBB_GRP_DELETE = 8; // Group: prevent file from being deleted *} + FIBB_GRP_EXECUTE = 9; // Group: file is executable *} + FIBB_GRP_WRITE = 10; // Group: file is writable *} + FIBB_GRP_READ = 11; // Group: file is readable *} +// other + FIBB_OTR_DELETE = 12; // Other: prevent file from being deleted *} + FIBB_OTR_EXECUTE = 13; // Other: file is executable *} + FIBB_OTR_WRITE = 14; // Other: file is writable *} + FIBB_OTR_READ = 15; // Other: file is readable *} +// Values + FIBF_DELETE = (1 shl FIBB_DELETE); + FIBF_EXECUTE = (1 shl FIBB_EXECUTE); + FIBF_WRITE = (1 shl FIBB_WRITE); + FIBF_READ = (1 shl FIBB_READ); + FIBF_ARCHIVE = (1 shl FIBB_ARCHIVE); + FIBF_PURE = (1 shl FIBB_PURE); + FIBF_SCRIPT = (1 shl FIBB_SCRIPT); +// Group Values + FIBF_GRP_DELETE = (1 shl FIBB_GRP_DELETE); + FIBF_GRP_EXECUTE = (1 shl FIBB_GRP_EXECUTE); + FIBF_GRP_WRITE = (1 shl FIBB_GRP_WRITE); + FIBF_GRP_READ = (1 shl FIBB_GRP_READ); +// Other Values + FIBF_OTR_DELETE = (1 shl FIBB_OTR_DELETE); + FIBF_OTR_EXECUTE = (1 shl FIBB_OTR_EXECUTE); + FIBF_OTR_WRITE = (1 shl FIBB_OTR_WRITE); + FIBF_OTR_READ = (1 shl FIBB_OTR_READ); + +// Devices +type +{ returned by Info(), must be on a 4 byte boundary } + PInfoData = ^TInfoData; + TInfoData = record + id_NumSoftErrors: LongInt; // Number of soft errors on disk + id_UnitNumber: LongInt; // Which unit disk is (was) mounted on + id_DiskState: LongInt; // Dtate of Volume See defines below + id_NumBlocks: LongInt; // Number of blocks on device + id_NumBlocksUsed: LongInt; // Number of block in use + id_BytesPerBlock: LongInt; // Bytes per Block + id_DiskType: LongInt; // Type of Disk + id_VolumeNode: BPTR; // BCPL pointer to volume node + id_InUse: IPTR; // Flag, zero if not in use + end; + + {$PACKRECORDS NORMAL} + +const + { ID stands for InfoData } +{ Disk states } + ID_WRITE_PROTECTED = 80; // Disk is write protected + ID_VALIDATING = 81; // Disk is currently being validated + ID_VALIDATED = 82; // Disk is consistent and writeable +{ Filesystem types as used for id_DiskType. These are multi-character + constants of identifier strings. They are self-descriptive.} + ID_NO_DISK_PRESENT = -1; + ID_UNREADABLE_DISK = $42414400; // 'BAD#0' + ID_DOS_DISK = $444F5300; // 'DOS#0' + ID_FFS_DISK = $444F5301; // 'DOS#1' + ID_INTER_DOS_DISK = $444F5302; // 'DOS#2' + ID_INTER_FFS_DISK = $444F5303; // 'DOS#3' + ID_FASTDIR_DOS_DISK = $444F5304; // 'DOS#4' + ID_FASTDIR_FFS_DISK = $444F5305; // 'DOS#5' + ID_NOT_REALLY_DOS = $4E444F53; // 'NDOS' + ID_KICKSTART_DISK = $4B49434B; // 'KICK' + ID_MSDOS_DISK = $4d534400; // 'MSD#0' + ID_SFS_BE_DISK = $53465300; // 'SFS#0' + ID_SFS_LE_DISK = $73667300; // 'sfs#0' +{ These are the return codes used by convention by AmigaDOS commands + See FAILAT and IF for relvance to EXECUTE files} + // No Problem, success + RETURN_OK = 0; + { Program succeeded, but there was something not quite right. + This value may also be used to express a boolean state + (RETURN_WARN meaning TRUE, RETURN_OK meaning FALSE).} + RETURN_WARN = 5; + { Program succeeded partly. This may be returned, if the user aborts a + program or some external data were wrong.} + RETURN_ERROR = 10; // Something wrong + { Program execution failed. Normally used, if some system resources could + not be allocated.} + RETURN_FAIL = 20; // Complete or severe failure + +{ Secondary errors codes as used for IoErr(), SetIoErr() and in + Process^.pr_Result2. The term 'object' refers to files of all kinds + (ie plain files, directories, links, etc).} + + {This is used, if something went wrong, but it is unknown what exactly + went wrong. This is especially useful for emulation devices, when the + underlying system returned an error that the emulation side does not + know.} + ERROR_UNKNOWN = 100; +//General system errors + ERROR_NO_FREE_STORE = 103; // Out of memory. + ERROR_TASK_TABLE_FULL = 105; // Too many tasks are already running. +//Errors concerning ReadArgs(). + ERROR_BAD_TEMPLATE = 114; // Supplied template is broken + ERROR_BAD_NUMBER = 115; { A supplied argument that was expected to be numeric, was not numeric. + This is also returned by some functions to expresss that a supplied + number is out of range (ie to express application internal errors).} + ERROR_REQUIRED_ARG_MISSING = 116; // An argument that has to be supplied (ie signed with the '/A' flag) was not supplied. + ERROR_KEY_NEEDS_ARG = 117; // Keyword was specified, but not its contents. + ERROR_TOO_MANY_ARGS = 118; // There were more arguments than the template needs. + ERROR_UNMATCHED_QUOTES = 119; // An odd number of quotation marks was supplied. + ERROR_LINE_TOO_LONG = 120; { Either the command-line was longer than hardcoded line length limit or the + maximum number of multiple arguments (flag '/M') was exceeded. This can + also indicate that some argument is too long or a supplied buffer is too small.} +// Errors in files. + ERROR_FILE_NOT_OBJECT = 121; // You tried to execute a file that is not an executable. + ERROR_INVALID_RESIDENT_LIBRARY = 122; // A library or device could not be opened or that library or device is broken. + ERROR_NO_DEFAULT_DIR = 201; + ERROR_OBJECT_IN_USE = 202; // The accessed object is already in use (eg locked) by another task. + ERROR_OBJECT_EXISTS = 203; // You tried to overwrite an object. + ERROR_DIR_NOT_FOUND = 204; // The given directory or the path of a given object does not exist. + ERROR_OBJECT_NOT_FOUND = 205; // The given object does not exist. +// Miscellaneous errors. + ERROR_BAD_STREAM_NAME = 206; + ERROR_OBJECT_TOO_LARGE = 207; { The given object is too large for the operation to be made. Object is + this context are for example components of path-names.} + ERROR_ACTION_NOT_KNOWN = 209; { This is usually used to indicate that a filesystem does not support a + certain action, but may generally also be used by functions.} + ERROR_INVALID_COMPONENT_NAME = 210; // A path component was invalid (eg there were multiple colons in a path name + ERROR_INVALID_LOCK = 211; + ERROR_OBJECT_WRONG_TYPE = 212; { You tried to perform an action on an object, which this kind of object + does not support (eg makedir on a file).} + ERROR_DISK_NOT_VALIDATED = 213; // Writing failed, because the volume is not validated. + ERROR_DISK_WRITE_PROTECTED = 214; // Writing failed, because the volume is write-protected. + ERROR_RENAME_ACROSS_DEVICES = 215; { You tried to move/rename a file across different devices. Rename does only + work on the same device, as only the inode-data has to be changed to + perform that action.} + ERROR_DIRECTORY_NOT_EMPTY = 216; // You tried to delete a directory that still contains some files. Delete these files first. + ERROR_TOO_MANY_LEVELS = 217; // A recursive directory search could not be performed, because the stack was too small. + ERROR_DEVICE_NOT_MOUNTED = 218; // You tried to access a device that is currently not mounted. + ERROR_SEEK_ERROR = 219; // An error occured, while executing DosSeek(). + ERROR_COMMENT_TOO_BIG = 220; // The supplied file comment was longer than the hardcoded length limit for file comments. + ERROR_DISK_FULL = 221; // A write-operation could not be performed, because the volume has no space left. + ERROR_DELETE_PROTECTED = 222; // You tried to delete a delete-protected object. + ERROR_WRITE_PROTECTED = 223; { You tried to write to a write-protected object. This does not mean that + the volume, you wanted to write to, is write-protected!} + ERROR_READ_PROTECTED = 224; // You tried to read a read-protected object. + ERROR_NOT_A_DOS_DISK = 225; // Accessed disk is unreadable. + ERROR_NO_DISK = 226; // You tried to perform an action on a device that has no volume mounted (eg. an empty disk drive). + ERROR_NO_MORE_ENTRIES = 232; { This does not indicate an error, but is returned by several functions to + indicate that the last entry of a list was reached.} + ERROR_IS_SOFT_LINK = 233; { Given action can not be performed on a given object, because it is a + soft-link. This is usually only used by filesystem handlers and is catched + by dos. Applications should not see this.} + ERROR_OBJECT_LINKED = 234; // Given action can not be performed on a given object, because it is a link. + ERROR_BAD_HUNK = 235; // There was a bad hunk in a file that was to load. + ERROR_NOT_IMPLEMENTED = 236; { Indicates that a function does not implement a certain functionality. + There are more special error conditions (ERROR_BAD_NUMBER and + ERROR_ACTION_NOT_KNOWN), which should be preferred, if applicable.} + ERROR_RECORD_NOT_LOCKED = 240; // You tried to access a record that was not locked. + ERROR_LOCK_COLLISION = 241; // Somebody already locked a part of the record, you wanted to lock. + ERROR_LOCK_TIMEOUT = 242; // LockRecord() timed out. + ERROR_UNLOCK_ERROR = 243; // An error occured, while unlocking a record. + +{ more error codes are defined in dosasl.h and filesystem.h } + +{ Maximum length of strings got from Fault(). Note that they should be + shorter than 60 characters. } + FAULT_MAX = 82; + +{ Signals that are set, if the user presses the corresponding keys on + the controlling terminal. They may also be sent by using Signal(). + For more information see <exec/tasks.h>. } + SIGBREAKB_CTRL_C = 12; // CTRL-c, usually meaning program abortion. + SIGBREAKB_CTRL_D = 13; // CTRL-d + SIGBREAKB_CTRL_E = 14; // CTRL-e, usually meaning that the application should iconify itself. + SIGBREAKB_CTRL_F = 15; // CTRL-f, usually meaning that the application should uniconify itself. +{ Bit fields that signal you that a user has issued a break + for example: if (SetSignal(0,0) and SIGBREAKF_CTRL_C) then cleanup_and_exit();} + SIGBREAKF_CTRL_C = 1 shl SIGBREAKB_CTRL_C; + SIGBREAKF_CTRL_D = 1 shl SIGBREAKB_CTRL_D; + SIGBREAKF_CTRL_E = 1 shl SIGBREAKB_CTRL_E; + SIGBREAKF_CTRL_F = 1 shl SIGBREAKB_CTRL_F; + +{ Mode parameter to Open() } + MODE_OLDFILE = 1005; // Open existing file read/write positioned at beginning of file. + MODE_NEWFILE = 1006; // Open freshly created file (delete old file) read/write + MODE_READWRITE = 1004; // An old file is opened. If it does not exist, a new one is created. + +{ Passed as type to Lock() } + SHARED_LOCK = -2; // Non-exclusive lock, other tasks may lock this file as well. + ACCESS_READ = SHARED_LOCK; // This is used for read-only operations. + EXCLUSIVE_LOCK = -1; // Exclusive lock, other tasks may not lock this file. + ACCESS_WRITE = EXCLUSIVE_LOCK; // This is used for write operations. + +{ Values returned by SameLock() } + LOCK_SAME = 0; + LOCK_SAME_HANDLER = 1; // actually same volume + LOCK_DIFFERENT = -1; + +{ Values for MakeLink() } + LINK_HARD = 0; + LINK_SOFT = 1; + +{ Relative position to Seek() } + OFFSET_BEGINNING = -1; // relative to Begining Of File + OFFSET_CURRENT = 0; // relative to Current file position + OFFSET_END = 1; // relative to End Of File + +{ Limits of the "Integer" type already defined in FPC... but ok} + MAXINT = $7FFFFFFF; + MININT = $80000000; + +{ types for ChangeMode() } + CHANGE_LOCK = 0; + CHANGE_FH = 1; + +{ values returned by ReadItem() } + ITEM_EQUAL = -2; // '=' Symbol + ITEM_ERROR = -1; // error + ITEM_NOTHING = 0; // *N, ;, endstreamch + ITEM_UNQUOTED = 1; // unquoted item + ITEM_QUOTED = 2; // quoted item + +{ types for AllocDosObject/FreeDosObject } + DOS_FILEHANDLE = 0; // PFileHandle + DOS_EXALLCONTROL = 1; // PExAllControl + DOS_FIB = 2; // PFileInfoBlock + DOS_STDPKT = 3; // PDosPacket + DOS_CLI = 4; // PCommandLineInterface + DOS_RDARGS = 5; // PRDArgs + + +{ Data structures and equates used by the V1.4 DOS functions StrtoDate() and DatetoStr() } +{--------- String/Date structures etc } +type + PDateTime = ^TDateTime; + TDateTime = record + dat_Stamp: TDateStamp; // DOS DateStamp + dat_Format, // controls appearance of dat_StrDate + dat_Flags: Byte; // see BITDEF's below + dat_StrDay, // day of the week string + dat_StrDate, // date string + dat_StrTime: STRPTR; // time string + end; + +{ You need this much room for each of the DateTime strings: } +const + LEN_DATSTRING = 16; + +{ date format values } + FORMAT_DOS = 0; // DOS internal format, dd-mmm-yy + FORMAT_INT = 1; // International format, yy-mm-dd + FORMAT_USA = 2; // US-American format, mm-dd-yy } + FORMAT_CDN = 3; // Canadian format, dd-mm-yy } + FORMAT_MAX = FORMAT_CDN; + FORMAT_DEF = 4; { use default format, as defined by locale; if locale not + available, use FORMAT_DOS instead } + +{ flags for dat_Flags } + + DTB_SUBST = 0; // Substitute Today, Tomorrow, etc. if possible. + DTF_SUBST = 1 shl DTB_SUBST; + DTB_FUTURE = 1; // Day of the week is in future. + DTF_FUTURE = 1 shl DTB_FUTURE; + +{********************************************************************** +************************ PATTERN MATCHING ****************************** +************************************************************************ + +* structure expected by MatchFirst, MatchNext. +* Allocate this structure and initialize it as follows: +* +* Set ap_BreakBits to the signal bits (CDEF) that you want to take a +* break on, or NULL, if you don't want to convenience the user. +* +* If you want to have the FULL PATH NAME of the files you found, +* allocate a buffer at the END of this structure, and put the size of +* it into ap_Strlen. If you don't want the full path name, make sure +* you set ap_Strlen to zero. In this case, the name of the file, and stats +* are available in the ap_Info, as per usual. +* +* Then call MatchFirst() and then afterwards, MatchNext() with this structure. +* You should check the return value each time (see below) and take the +* appropriate action, ultimately calling MatchEnd() when there are +* no more files and you are done. You can tell when you are done by +* checking for the normal AmigaDOS return code ERROR_NO_MORE_ENTRIES. +* +} + +type + // PRIVATE structure, which describes an anchor for matching functions. + PAChain = ^TAChain; + TAChain = record + an_Child, // The next anchor + an_Parent: PAChain; // The last anchor + an_Lock: BPTR; // Lock of this anchor + an_Info: TFileInfoBlock; // fib Discribing this anchor + an_Flags: ShortInt; // se below + an_String: array[0..0] of Char; + end; +const +// an_Flags + DDB_PatternBit = 0; + DDB_ExaminedBit = 1; + DDB_Completed = 2; + DDB_AllBit = 3; + DDB_Single = 4; + DDF_PatternBit = 1 shl DDB_PatternBit; + DDF_ExaminedBit = 1 shl DDB_ExaminedBit; + DDF_Completed = 1 shl DDB_Completed; + DDF_AllBit = 1 shl DDB_AllBit; + DDF_Single = 1 shl DDB_Single; + +type + PAnchorPath = ^TAnchorPath; + TAnchorPath = record + case SmallInt of + 0 :( + ap_First : PAChain; + ap_Last : PAChain; + ); + 1 :( + ap_Base, // pointer to first anchor + ap_Current : PAChain; // pointer to last anchor + ap_BreakBits, // Signal bits that caused the function to break. + ap_FoundBreak : LongInt; // Bits we broke on. Also returns ERROR_BREAK + ap_Flags : Shortint; // see below + ap_Reserved : Shortint; // Private + ap_Strlen : SmallInt; // Size of ap_Buf (see below). This may be zero. + ap_Info : TFileInfoBlock; // describes any files found by matching-functions. + ap_Buf : Array[0..0] of Char; // Buffer for path name, allocated by user!! + ); + end; + +const + APB_DOWILD = 0; // Please check for wildcards in supplied string. + APB_ITSWILD = 1; // There is actually a wildcard in the supplied string. READ-ONLY + APB_DODIR = 2; { Set, if a directory is to be entered. + Applications may clear this bit to prohibit the + matching-functions from entering a directory. } + APB_DIDDIR = 3; // Set, if directory was already searched. READ-ONLY + APB_NOMEMERR = 4; // Set, if function was out of memory. READ-ONLY + APB_DODOT = 5; // '.' may refer to the current directory (unix-style). + APB_DirChanged = 6; // Directory changed since last call. + APB_FollowHLinks = 7; // Follow hardlinks, too. + + APF_DOWILD = 1 shl APB_DOWILD; + APF_ITSWILD = 1 shl APB_ITSWILD; + APF_DODIR = 1 shl APB_DODIR; + APF_DIDDIR = 1 shl APB_DIDDIR; + APF_NOMEMERR = 1 shl APB_NOMEMERR; + APF_DODOT = 1 shl APB_DODOT; + APF_DirChanged = 1 shl APB_DirChanged; + APF_FollowHLinks = 1 shl APB_FollowHLinks; + +{ Predefined tokens for wildcards. The characters are replaced by these + tokens in the tokenized string returned by the ParsePattern() function + family.} + P_ANY = $80; // Matches everything '#?' and '*' + P_SINGLE = $81; // Any character '?' + P_ORSTART = $82; // Opening parenthesis for OR'ing '(' + P_ORNEXT = $83; // Field delimiter for OR'ing '|' + P_OREND = $84; // Closing parenthesis for OR'ing ')' + P_NOT = $85; // Inversion '~' + P_NOTEND = $86; // Inversion end + P_NOTCLASS = $87; // Inversion class '^' + P_CLASS = $88; // Class '[]' + P_REPBEG = $89; // Beginning of repetition '[' + P_REPEND = $8A; // End of repetition ']' + P_STOP = $8B; // token to force end of evaluation + +{ Values for an_Status, NOTE: These are the actual bit numbers } + COMPLEX_BIT = 1; // Parsing complex pattern + EXAMINE_BIT = 2; // Searching directory + +{ Returns from MatchFirst(), MatchNext() more see before} + ERROR_BUFFER_OVERFLOW = 303; // User OR internal buffer overflow + ERROR_BREAK = 304; // A break character was received + ERROR_NOT_EXECUTABLE = 305; // A file has E bit cleared + +{ hunk types } + HUNK_UNIT = 999 ; + HUNK_NAME = 1000; + HUNK_CODE = 1001; + HUNK_DATA = 1002; + HUNK_BSS = 1003; + HUNK_RELOC32 = 1004; + HUNK_RELOC16 = 1005; + HUNK_RELOC8 = 1006; + HUNK_EXT = 1007; + HUNK_SYMBOL = 1008; + HUNK_DEBUG = 1009; + HUNK_END = 1010; + HUNK_HEADER = 1011; + HUNK_OVERLAY = 1013; + HUNK_BREAK = 1014; + HUNK_DREL32 = 1015; + HUNK_DREL16 = 1016; + HUNK_DREL8 = 1017; + HUNK_LIB = 1018; + HUNK_INDEX = 1019; + HUNK_RELOC32SHORT = 1020; + HUNK_RELRELOC32 = 1021; + HUNK_ABSRELOC16 = 1022; + +{ hunk_ext sub-types } + EXT_SYMB = 0; // symbol table + EXT_DEF = 1; // relocatable definition + EXT_ABS = 2; // Absolute hunks + EXT_REF32 = 129; // 32bit absolute reference to symbol + EXT_ABSREF32 = 129; + EXT_COMMON = 130; // 32bit absolute reference to common block + EXT_ABSCOMMON = 130; + EXT_REF16 = 131; // 16bit relative reference to symbol + EXT_RELREF16 = 131; + EXT_REF8 = 132; // 8bit relative reference to symbol + EXT_RELREF8 = 132; + EXT_DEXT32 = 133; // 32 bit data releative reference + EXT_DEXT16 = 134; // 16 bit data releative reference + EXT_DEXT8 = 135; // 8 bit data releative reference + EXT_RELREF32 = 136; // 32bit relative reference to symbol + EXT_RELCOMMON = 137; // 32bit relative reference to common block + EXT_ABSREF16 = 138; + EXT_ABSREF8 = 139; + +{ Hunk flags } + HUNKB_ADVISORY = 29; // Hunk is ignored, if unknown to loader. + HUNKB_CHIP = 30; + HUNKB_FAST = 31; + HUNKF_ADVISORY = 1 shl HUNKB_ADVISORY; + HUNKF_CHIP = 1 shl HUNKB_CHIP; + HUNKF_FAST = 1 shl HUNKB_FAST; + +type + PDosInfo = ^TDosInfo; + TDosInfo = record + di_McName: BPTR; // Network name of this machine; currently nil + di_DevInfo: BPTR; // Device List + di_Devices: BPTR; // Reserved + di_Handlers: BPTR; // Reserved + di_NetHand: BPTR; // Reserved (actually resident segment list) + di_DevLock, // do NOT access directly! + di_EntryLock, // do NOT access directly! + di_DeleteLock: TSignalSemaphore; // do NOT access directly! + end; + +{ All DOS processes have this structure } +{ Create and Device Proc returns pointer to the MsgPort in this structure } +{ dev_proc = Address(SmallInt(DeviceProc()) - SizeOf(Task)) } + + TExitProcedure = procedure(Arg: IPTR); cdecl; + + PProcess = ^TProcess; + TProcess = record + pr_Task: TTask; + pr_MsgPort: TMsgPort; // This is BPTR address from DOS functions + pr_Pad: SmallInt; // Remaining variables on 4 byte boundaries + pr_SegList: BPTR; // Array of seg lists used by this process + pr_StackSize: LongInt; // Size of process stack in bytes + pr_GlobVec: APTR; // Global vector for this process (BCPL) + pr_TaskNum: LongInt; // CLI task number of zero if not a CLI + pr_StackBase: BPTR; // Ptr to high memory end of process stack + pr_Result2: STRPTR; // Value of secondary result from last call + pr_CurrentDir: BPTR; // Lock associated with current directory + pr_CIS: BPTR; // Current CLI Input Stream + pr_COS: BPTR; // Current CLI Output Stream + pr_ConsoleTask: APTR; // Console handler process for current window + pr_FileSystemTask: APTR; // File handler process for current drive + pr_CLI: BPTR; // pointer to ConsoleLineInterpreter + pr_ReturnAddr: APTR; // pointer to previous stack frame + pr_PktWait: APTR; // Function to be called when awaiting msg + pr_WindowPtr: APTR; // Window for error printing + pr_HomeDir: BPTR; // Home directory of executing program + pr_Flags: LongInt; // flags telling dos about process + pr_ExitCode: TExitProcedure; // code to call on exit of program OR nil + pr_ExitData: IPTR; // Passed as an argument to pr_ExitCode. + pr_Arguments: STRPTR; // Arguments passed to the process at start + pr_LocalVars: TMinList; // Local environment variables + pr_ShellPrivate: ULONG; // for the use of the current shell + pr_CES: BPTR; // Error stream - IF NULL, use pr_COS + end; + +{ Flags for pr_Flags. (all PRIVATE) They mainly descibe what happens if the process + exits, i.e. which resources the process should clean itself. The flags + are self-explaining.} +const + PRB_FREESEGLIST = 0; + PRB_FREECURRDIR = 1; + PRB_FREECLI = 2; + PRB_CLOSEINPUT = 3; + PRB_CLOSEOUTPUT = 4; + PRB_FREEARGS = 5; + PRB_CLOSEERROR = 6; + PRB_SYNCHRONOUS = 7; + PRB_WAITINGFORCHILD = 8; // This one is subject to change! + PRB_NOTIFYONDEATH = 9; + + PRF_FREESEGLIST = 1 shl PRB_FREESEGLIST; + PRF_FREECURRDIR = 1 shl PRB_FREECURRDIR; + PRF_FREECLI = 1 shl PRB_FREECLI; + PRF_CLOSEINPUT = 1 shl PRB_CLOSEINPUT; + PRF_CLOSEOUTPUT = 1 shl PRB_CLOSEOUTPUT; + PRF_FREEARGS = 1 shl PRB_FREEARGS; + PRF_CLOSEERROR = 1 shl PRB_CLOSEERROR; + PRF_SYNCHRONOUS = 1 shl PRB_SYNCHRONOUS; + PRF_WAITINGFORCHILD = 1 shl PRB_WAITINGFORCHILD; // This one is subject to change! + PRF_NOTIFYONDEATH = 1 shl PRB_NOTIFYONDEATH; + +{ The long SmallInt address (BPTR) of this structure is returned by + Open() and other routines that return a file. You need only worry + about this struct to do async io's via PutMsg() instead of + standard file system calls } +type + PFileHandle = ^TFileHandle; + TFileHandle = record + fh_Flags: ULONG; { EXEC message } + fh_Port: PMsgPort; { Reply port for the packet } + fh_Type: PMsgPort; { Port to do PutMsg() to Address is negative if a plain file } + + fh_Buf: BPTR; + fh_Pos: LongInt; + fh_End: LongInt; + + fh_Func1: LongInt; + fh_Func2: LongInt; + fh_Func3: LongInt; + fh_Arg1: LongInt; + fh_Arg2: APTR; + fh_Size: ULONG; // Size of buffered io buffer + fh_Buf2: BPTR; // Always the same as fh_Buf + end; + +{ This is the extension to EXEC Messages used by DOS } + + PDosPacket = ^TDosPacket; + TDosPacket = record + dp_Link : PMessage; // Pointer to a standard exec message. + dp_Port : PMsgPort; // Reply-Port of that packet. Must be filled in each send. + case SmallInt of + 0 : ( + dp_Action : LongInt; + dp_Status : LongInt; + dp_Status2 : LongInt; + dp_BufAddr : LongInt; + ); + 1 : ( + dp_Type : LongInt; { See ACTION_... below and + * 'R' means Read, 'W' means Write to the + * file system } + dp_Res1 : LongInt; { For file system calls this is the result + * that would have been returned by the + * function, e.g. Write ('W') returns actual + * length written } + dp_Res2 : LongInt; { For file system calls this is what would + * have been returned by IoErr() } + dp_Arg1 : LongInt; + dp_Arg2 : LongInt; + dp_Arg3 : LongInt; + dp_Arg4 : LongInt; + dp_Arg5 : LongInt; + dp_Arg6 : LongInt; + dp_Arg7 : LongInt; + ); + end; + +const +{ Packet types dp_Type } + ACTION_NIL = 0; + ACTION_STARTUP = 0; + ACTION_GET_BLOCK = 2; // OBSOLETE + ACTION_SET_MAP = 4; + ACTION_DIE = 5; + ACTION_EVENT = 6; + ACTION_CURRENT_VOLUME = 7; + ACTION_LOCATE_OBJECT = 8; + ACTION_RENAME_DISK = 9; + ACTION_FREE_LOCK = 15; + ACTION_DELETE_OBJECT = 16; + ACTION_RENAME_OBJECT = 17; + ACTION_MORE_CACHE = 18; + ACTION_COPY_DIR = 19; + ACTION_WAIT_CHAR = 20; + ACTION_SET_PROTECT = 21; + ACTION_CREATE_DIR = 22; + ACTION_EXAMINE_OBJECT = 23; + ACTION_EXAMINE_NEXT = 24; + ACTION_DISK_INFO = 25; + ACTION_INFO = 26; + ACTION_FLUSH = 27; + ACTION_SET_COMMENT = 28; + ACTION_PARENT = 29; + ACTION_TIMER = 30; + ACTION_INHIBIT = 31; + ACTION_DISK_TYPE = 32; + ACTION_DISK_CHANGE = 33; + ACTION_SET_DATE = 34; + ACTION_SAME_LOCK = 40; + + ACTION_WRITE = $57; // 'W' + ACTION_READ = $52; // 'R' + + ACTION_SCREEN_MODE = 994; + ACTION_CHANGE_SIGNAL = 995; + ACTION_READ_RETURN = 1001; + ACTION_WRITE_RETURN = 1002; + ACTION_FINDUPDATE = 1004; + ACTION_FINDINPUT = 1005; + ACTION_FINDOUTPUT = 1006; + ACTION_END = 1007; + ACTION_SEEK = 1008; + ACTION_FORMAT = 1020; + ACTION_MAKE_LINK = 1021; + ACTION_SET_FILE_SIZE = 1022; + ACTION_WRITE_PROTECT = 1023; + ACTION_READ_LINK = 1024; + ACTION_FH_FROM_LOCK = 1026; + ACTION_IS_FILESYSTEM = 1027; + ACTION_CHANGE_MODE = 1028; + {} + ACTION_COPY_DIR_FH = 1030; + ACTION_PARENT_FH = 1031; + ACTION_EXAMINE_ALL = 1033; + ACTION_EXAMINE_FH = 1034; + ACTION_EXAMINE_ALL_END = 1035; + ACTION_SET_OWNER = 1036; + + ACTION_LOCK_RECORD = 2008; + ACTION_FREE_RECORD = 2009; + + ACTION_ADD_NOTIFY = 4097; + ACTION_REMOVE_NOTIFY = 4098; +{ Tell a file system to serialize the current volume. This is typically + done by changing the creation date of the disk. This packet does not take + any arguments.} + ACTION_SERIALIZE_DISK = 4200; + +type +{ A Packet does not require the Message to be before it in memory, but + for convenience it is useful to associate the two. + Also see the function init_std_pkt for initializing this structure } + PStandardPacket = ^TStandardPacket; + TStandardPacket = record + sp_Msg: TMessage; + sp_Pkt: TDosPacket; + end; + +const +{ types for initial packets to shells from run/newcli/execute/system. + NOTE: AROS doesn't use startup packets. This will ONLY make a difference + for shell writers...} + RUN_EXECUTE = -1; + RUN_SYSTEM = -2; + RUN_SYSTEM_ASYNCH = -3; + +type +{ ONLY to be allocated by DOS! } + PCliProcList = ^TCliProcList; + TCliProcList = record + cpl_Node: TMinNode; + cpl_First: LongInt; { number of first entry in array } + cpl_Array: array[0..0] of PMsgPort; + { [0] is max number of CLI's in this entry (n) + [1] is CPTR to process id of CLI cpl_First + [n] is CPTR to process id of CLI cpl_First+n-1} + end; + +{ structure for the Dos resident list. Do NOT allocate these, use } +{ AddSegment(), and heed the warnings in the autodocs! } +type + PSegment = ^TSegment; + TSegment = record + seg_Next: BPTR; // Pointer to next segment. + seg_UC: LongInt; // Usage count/type + seg_Seg: BPTR; // Actual Segment + seg_Name: array[0..3] of Char; // actually the first 4 chars of BSTR name } + end; + +const + CMD_SYSTEM = -1; + CMD_INTERNAL = -2; + CMD_DISABLED = -999; + +{ DOS Processes started from the CLI via RUN or NEWCLI have this additional + * set to data associated with them } +type + PCommandLineInterface = ^TCommandLineInterface; + TCommandLineInterface = record + cli_Result2: LongInt; // Value of IoErr from last command + cli_SetName: BSTR; // Name of current directory + cli_CommandDir: BPTR; // Lock associated with command directory + cli_ReturnCode: LongInt; // Return code from last command + cli_CommandName: BSTR; // Name of current command + cli_FailLevel: LongInt; // Fail level (set by FAILAT) + cli_Prompt: BSTR; // Current prompt (set by PROMPT) + cli_StandardInput: BPTR; // Default (terminal) CLI input + cli_CurrentInput: BPTR; // Current CLI input + cli_CommandFile: BSTR; // Name of EXECUTE command file + cli_Interactive: LongInt; // Boolean; True if prompts required + cli_Background: LongInt; // Boolean; True if CLI created by RUN + cli_CurrentOutput: BPTR; // Current CLI output + cli_DefaultStack: LongInt; // Stack size to be obtained in long words + cli_StandardOutput: BPTR; // Default (terminal) CLI output + cli_Module: BPTR; // SegList of currently loaded command +{$ifdef aros} + cli_StandardError: BPTR; // Standard/Default Error file. PFileLock +{$endif} + end; + +const +// CLI_DEFAULTSTACK_UNIT * cli_DefaultStack = stack in bytes + CLI_DEFAULTSTACK_UNIT = SizeOf(IPTR); + +type +{$ifdef aros} + PDosListAROSExt = ^TDosListAROSExt; + TDosListAROSExt = record + dol_DevName: STRPTR; + dol_Device: PDevice; + dol_Unit: PUnit; + end; +{$endif} +{ This structure can take on different values depending on whether it is + * a device, an assigned directory, or a volume. Below is the structure + * reflecting volumes only. Following that is the structure representing + * only devices. + } + +{ structure representing a volume } + + PDeviceList = ^TDeviceList; + TDeviceList = record + dl_Next: BPTR; // bptr to next device list + dl_Type: LongInt; // see DLT below + dl_Task: PMsgPort; // ptr to handler task + dl_Lock: BPTR; // not for volumes + dl_VolumeDate: TDateStamp; // creation date + dl_LockList: BPTR; // outstanding locks + dl_DiskType: LongInt; // 'DOS', etc + dl_unused: BPTR; + dl_Name: BSTR; // bptr to bcpl name +{$ifdef aros} + {$ifndef AROS_DOS_PACKETS} + dl_Reserved: array[0..5] of IPTR; + dl_AROS: TDosListAROSExt; + {$endif} +{$endif} + end; + +{ device structure (same as the DeviceNode structure in filehandler.h) } + PDevInfo = ^TDevInfo; + TDevInfo = record + dvi_Next: BPTR; + dvi_Type: LongInt; + dvi_Task: PMsgPort; + dvi_Lock: BPTR; + dvi_Handler: BSTR; + dvi_StackSize: LongInt; + dvi_Priority: LongInt; + dvi_Startup: BPTR; +{$ifdef aros} + dvi_NoAROS4: array[0..1] of BPTR; +{$else} + dvi_SegList: BPTR; + dvi_GlobVec: BSTR; +{$endif} + dvi_Name: BSTR; +{$ifdef aros} + {$ifndef AROS_DOS_PACKETS} + dvi_Reserved: array[0..5] of IPTR; + dvi_AROS: TDosListAROSExt; + {$endif} +{$endif} + end; + +const +{ Dos list scanning and locking modes as used in LockDosList() + Specify either LDF_READ, if you want a non-exclusive lock, or LDF_WRITE, + if you want an exclusive lock (i.e. if you want to modify the list).} + LDB_READ = 0; + LDB_WRITE = 1; +// Specify which list(s) to lock. + LDB_DEVICES = 2; + LDB_VOLUMES = 3; + LDB_ASSIGNS = 4; + LDB_ENTRY = 5; + LDB_DELETE = 6; + + LDF_READ = 1 shl LDB_READ; + LDF_WRITE = 1 shl LDB_WRITE; + LDF_DEVICES = 1 shl LDB_DEVICES; + LDF_VOLUMES = 1 shl LDB_VOLUMES; + LDF_ASSIGNS = 1 shl LDB_ASSIGNS; + LDF_ENTRY = 1 shl LDB_ENTRY; + LDF_DELETE = 1 shl LDB_DELETE; +{ actually all but LDF_ENTRY (which is used for internal locking) } + LDF_ALL = (LDF_DEVICES or LDF_VOLUMES or LDF_ASSIGNS); + +type +{ Used for assigns that point to multiple directories. } + + PAssignList = ^TAssignList; + TAssignList = record + al_Next: PAssignList; // Pointer to next assign node. + al_Lock: BPTR; // (struct FileLock *) Lock of on of the directories. + end; + +{ combined structure for devices, assigned directories, volumes } + PDosList = ^TDosList; + TDosList = record + dol_Next: BPTR; { bptr to next device on list } + dol_Type: LongInt; { see DLT below } + dol_Task: PMsgPort; { ptr to handler task } + dol_Lock: BPTR; + case SmallInt of + 0 :( + dol_Handler : record + dol_Handler: BSTR; { file name to load IF seglist is null } + dol_StackSize, { stacksize to use when starting process } + dol_Priority: LongInt; { task priority when starting process } + dol_Startup: BPTR; { startup msg: FileSysStartupMsg for disks } +{$ifdef aros} + dol_NoAROS3: array[0..1] of BPTR; +{$else} + dol_SegList, { already loaded code for new task } + dol_GlobVec: BPTR; { BCPL global vector to use when starting } +{$endif} + dol_Name: BSTR; { bptr to bcpl name } +{$ifdef aros} + {$ifndef AROS_DOS_PACKETS} + dol_Reserved: array[0..5] of IPTR; + dol_AROS: TDosListAROSExt; + {$endif} +{$endif} + end; + ); + 1 :( + dol_Volume: record + dol_VolumeDate: TDateStamp; { creation date } + dol_LockList: BPTR; { outstanding locks } + dol_DiskType: LongInt; { 'DOS', etc } + dol_Unused: BPTR + end; + ); + 2 :( + dol_assign: record + dol_AssignName: STRPTR; { name for non-OR-late-binding assign } + dol_List: PAssignList; { for multi-directory assigns (regular) } + end; + ); + end; + + +const + +{ definitions for dl_Type } + DLT_DEVICE = 0; + DLT_DIRECTORY = 1; + DLT_VOLUME = 2; + DLT_LATE = 3; // late-binding assign + DLT_NONBINDING = 4; // non-binding assign + DLT_PRIVATE = -1; // for internal use only + +{ structure return by GetDeviceProc() } +type + PDevProc = ^TDevProc; + TDevProc = record + dvp_Port: PMsgPort; + dvp_Lock: BPTR; // PFileLock + dvp_Flags: LongInt; // see below (DVPF_*) + dvp_DevNode: PDosList; // Private + end; + +const +{ definitions for dvp_Flags } + DVPB_UNLOCK = 0; + DVPB_ASSIGN = 1; + DVPF_UNLOCK = 1 shl DVPB_UNLOCK; + DVPF_ASSIGN = 1 shl DVPB_ASSIGN; + +{ Types for fib_DirEntryType. NOTE that both USERDIR and ROOT are + directories, and that directory/file checks should use <0 and >=0. + This is not necessarily exhaustive! Some handlers may use other + values as needed, though <0 and >=0 should remain as supported as + possible.} + ST_ROOT = 1 ; // Root directory of filesystem + ST_USERDIR = 2 ; // Normal directory + ST_SOFTLINK = 3 ; // Soft link (may be a file or directory) + ST_LINKDIR = 4 ; // Hard link to a directory + ST_FILE = -3; // Plain file + ST_LINKFILE = -4; // Hard link to a file + ST_PIPEFILE = -5; // File is a pipe + +type +{ a lock structure, as returned by Lock() or DupLock() } + PFileLock = ^TFileLock; + TFileLock = record + fl_Link: BPTR; // bcpl pointer to next lock + fl_Key: IPTR; // disk block number + fl_Access: LongInt; // exclusive or shared + fl_Task: PMsgPort; // handler task's port + fl_Volume: BPTR; // bptr to a DeviceList + end; + + +{ Structure (as used in ExAll()), containing information about a file. This + structure is only as long as it need to be. If is for example ED_SIZE was + specified, when calling ExAll(), this structure only consists of the fields + ed_Name through ed_Size. Therefore you can use the ED_ definitions below + as longword offsets into this structure.} +type + PExAllData = ^TExAllData; + TExAllData = record + ed_Next: PExAllData; + ed_Name: PChar; // Name of the file + ed_Type, // Type of File + ed_Size, // Size of File + ed_Prot, // Protection Bits +{ The following three fields are de facto an embedded datestamp + structure (see <dos/dos.h>), which describes the last modification date.} + ed_Days, + ed_Mins, + ed_Ticks : ULONG; + + ed_Comment: PChar; // The file comment + ed_OwnerUID, // The owner ID + ed_OwnerGID : Word; // the group-owner ID + end; + +{ Type argument for ExAll(). Each number includes the information of all + lower numbers, too. If you specify for example ED_SIZE, you will get + information about name, type and the size of a file. Note that all + filehandlers must handle all types up to ED_OWNER. If they do not support + a type, they must return ERROR_WRONG_NUMBER. Currently + that means, if a value higher than ED_OWNER is specified, filehandlers + must fail with this error.} +const + ED_NAME = 1; // Filename. + ED_TYPE = 2; // Type of file. + ED_SIZE = 3; // Size of file. + ED_PROTECTION = 4; // Protection bits. + ED_DATE = 5; // Last modification date. + ED_COMMENT = 6; // Addtional file comment. + ED_OWNER = 7; // Owner information. + +{ Structure as used for controlling ExAll(). Allocate this structure by using + AllocDosObject(DOS_EXALLCONTROL,...) only. All fields must be initialized + to 0, before using this structure. (AllocDosObject() does that for you.) + After calling ExAll() the first time, this structure is READ-ONLY. } +type + PExAllControl = ^TExAllControl; + TExAllControl = record + eac_Entries: ULONG; // number of entries returned in buffer + eac_LastKey: IPTR; // Don't touch inbetween linked ExAll calls! + eac_MatchString: PChar; // wildcard string for pattern match OR nil + eac_MatchFunc: PHook; // optional private wildcard FUNCTION + end; + +{ The disk "environment" is a longword array that describes the + * disk geometry. It is variable sized, with the length at the beginning. + * Here are the constants for a standard geometry.} +type + PDosEnvec = ^TDosEnvec; + TDosEnvec = record + de_TableSize: IPTR; // Size of this structure. Must be at least 11 (DE_NUMBUFFERS). + de_SizeBlock: IPTR; // Size in longwords of a block on the disk. + de_SecOrg: IPTR; // Unused. Must be 0 for now. + de_Surfaces: IPTR; // Number of heads/surfaces in drive. + de_SectorPerBlock: IPTR; // Unused. Must be 1 for now. + de_BlocksPerTrack: IPTR; // blocks per track. drive specific + de_Reserved: IPTR; // DOS reserved blocks at start of partition. + de_PreAlloc: IPTR; // DOS reserved blocks at end of partition + de_Interleave: IPTR; // usually 0 + de_LowCyl: IPTR; // starting cylinder. typically 0 + de_HighCyl: IPTR; // max cylinder. drive specific + de_NumBuffers: IPTR; // Initial # DOS of buffers. + de_BufMemType: IPTR; // type of mem to allocate for buffers + de_MaxTransfer: IPTR; // Max number of bytes to transfer at a time + de_Mask: IPTR; // Address Mask to block out certain memory + de_BootPri: LongInt; // Boot priority for autoboot + de_DosType: IPTR; // ASCII (HEX) string showing filesystem type + de_Baud: IPTR; // Baud rate for serial handler + de_Control: IPTR; // Control SmallInt for handler/filesystem + de_BootBlocks: IPTR; // Number of blocks containing boot code + end; + +const +{ The following constants are longword offsets, which point into a filehandler + structure (like the one above). For more information about the meaning + of these constants see the structure above. } + DE_TABLESIZE = 0; // standard value is 11 } + DE_SIZEBLOCK = 1; // in longwords: standard value is 128 } + DE_SECORG = 2; // not used; must be 0 } + DE_NUMHEADS = 3; // # of heads (surfaces). drive specific } + DE_SECSPERBLK = 4; // not used; must be 1 } + DE_BLKSPERTRACK = 5; // blocks per track. drive specific } + DE_RESERVEDBLKS = 6; // unavailable blocks at start. usually 2 } + DE_PREFAC = 7; // not used; must be 0 } + DE_INTERLEAVE = 8; // usually 0 } + DE_LOWCYL = 9; // starting cylinder. typically 0 } + DE_UPPERCYL = 10; // max cylinder. drive specific } + DE_NUMBUFFERS = 11; // starting # of buffers. typically 5 } + DE_MEMBUFTYPE = 12; // type of mem to allocate for buffers. } + DE_BUFMEMTYPE = 12; // same as above, 1 is public, 3 is chip, 5 is fast } + DE_MAXTRANSFER = 13; // Max number bytes to transfer at a time } + DE_MASK = 14; // Address Mask to block out certain memory } + DE_BOOTPRI = 15; // Boot priority for autoboot } + DE_DOSTYPE = 16; // ASCII (HEX) string showing filesystem type; + DE_BAUD = 17; // Baud rate for serial handler } + DE_CONTROL = 18; // Control SmallInt for handler/filesystem } + DE_BOOTBLOCKS = 19; // Number of blocks containing boot code } + + +{ This is the message that is passed to a file handler during startup + in the DeviceNode->dn_Startup field. It is not used in AROS DOS handlers + as they are now Device based, and the information is passed in during + OpenDevice(), however this needs to be stored for late opening + handlers.} +type + PFileSysStartupMsg = ^TFileSysStartupMsg; + TFileSysStartupMsg = record + fssm_Unit: IPTR; // exec unit number for this device + fssm_Device: BSTR; // null terminated bstring to the device name + fssm_Environ: BPTR; // ptr to environment table (see above) + fssm_Flags: ULONG; // flags for OpenDevice() + end; + + +{ This is an unwound version of the DosList structure. + This is the version for a DOS "device" DLT_DEVICE. + It is essentially the same structure as DevInfo. + For AROS this is notably different, as filehandlers are no longer + DOS tasks (ie Processes), some of the fields here have no purpose + and are ignored. The only fields retained are the dn_Next, dn_Type, + dn_Startup and dn_Handler fields.} + PDeviceNode = ^TDeviceNode; + TDeviceNode = record + dn_Next: BPTR; { singly linked list } + dn_Type: ULONG; { always 0 for dos "devices" } + dn_Task: PMsgPort; { standard dos "task" field. If this is + * null when the node is accesses, a task + * will be started up } + dn_Lock: BPTR; { not used for devices -- leave null } + dn_Handler: BSTR; { filename to loadseg (if seglist is null) } + dn_StackSize: ULONG; { stacksize to use when starting task } + dn_Priority: LongInt; { task priority when starting task } + dn_Startup: BPTR; { startup msg: FileSysStartupMsg for disks } + dn_SegList: BPTR; { code to run to start new task (if necessary). + * if null then dn_Handler will be loaded. } + dn_GlobalVec: BPTR; { BCPL global vector to use when starting + * a task. -1 means that dn_SegList is not + * for a bcpl program, so the dos won't + * try and construct one. 0 tell the + * dos that you obey BCPL linkage rules, + * and that it should construct a global + * vector for you. + } + dn_Name: BSTR; { the node name, e.g. '\3','D','F','3' } +{$ifdef aros} + {$ifndef AROS_DOS_PACKETS} + dn_Reserved: array[0..5] of IPTR; // Private extensions Should not be used in user land code. + dn_AROS: TDosListAROSExt; + {$endif} +{$endif} + end; + +type +{ General notification structure as passed to StartNotify() and EndNotify(). + After passing it to StartNotify() the first time, this structure becomes + READ-ONLY! } + + PNotifyRequest = ^TNotifyRequest; + TNotifyRequest = record + nr_Name: STRPTR; // Name of the watched file. + nr_FullName: STRPTR; // Fully qualified name of the watched file. This is READ-ONLY! + nr_UserData: IPTR; // Fill in with your own data. + nr_Flags: LongWord; // Flags: (NRB_*) + // The following case specified the way to notify the application, if + nr_stuff: record // the watched file changes. IF NRF_SEND_MESSAGE is set, nr_Msg is used, + case SmallInt of // when NRF_SEND_SIGNAL is set, nr_Signal is used. + 0: ( nr_Msg: record + nr_Port: PMsgPort; // Port to send message to. + end ); + 1 : ( nr_Signal: record + nr_Task: pTask; // Task to notify. + nr_SignalNum: Byte; // Signal number to set. + nr_pad: array[0..2] of Byte; // PRIVATE + end ); + end; + nr_Reserved: array[0..3] of LongWord; // PRIVATE! Set to 0 for now. + nr_MsgCount: LongWord; // Number of unreplied messages. + nr_Handler: PMsgPort; // Filesystem task/device. Used by EndNotify() + end; + + PNotifyMessage = ^TNotifyMessage; + TNotifyMessage = record + nm_ExecMessage: TMessage; + nm_Class: LongWord; // Class: NOTIFY_CLASS + nm_Code: Word; // Code: NOTIFY_CODE + nm_NReq: PNotifyRequest; // The notify structure that was passed to StartNotify(). Read-Only + nm_DoNotTouch, // like it says! For use by handlers + nm_DoNotTouch2 : LongWord; // dito + end; + + +const +// The two following flags specify by which means the watching task is to be notified. + NRB_SEND_MESSAGE = 0; // Send a message to the specified message port. + NRB_SEND_SIGNAL = 1; // Set a signal of the specified task. + NRB_WAIT_REPLY = 3; // Wait for a reply by the application before going on with watching? + NRB_NOTIFY_INITIAL = 4; // Notify if the file/directory exists when the notification request is posted + +// Flag Values for TNotifyRequest.nr_Flags + NRF_SEND_MESSAGE = 1 shl NRB_SEND_MESSAGE; + NRF_SEND_SIGNAL = 1 shl NRB_SEND_SIGNAL; + NRF_WAIT_REPLY = 1 shl NRB_WAIT_REPLY; + NRF_NOTIFY_INITIAL = 1 shl NRB_NOTIFY_INITIAL; + +// The following flags are for use by handlers only! + NR_HANDLER_FLAGS = $ffff0000; + NRB_MAGIC = 31; + NRF_MAGIC = 1 shl NRB_MAGIC; + +// nm_Class. Do not use, yet. + NOTIFY_CLASS = $40000000; + +//nm_Code. Do not use, yet. + NOTIFY_CODE = $1234; + +{ ********************************************************************* + * + * The CSource data structure defines the input source for "ReadItem()" + * as well as the ReadArgs call. It is a publicly defined structure + * which may be used by applications which use code that follows the + * conventions defined for access. + * + * When passed to the dos.library functions, the value passed as + * struct *CSource is defined as follows: + * if ( CSource == 0) Use buffered IO "ReadChar()" as data source + * else Use CSource for input character stream + * + * The following two pseudo-code routines define how the CSource structure + * is used: + * + * long CS_ReadChar( struct CSource *CSource ) + * + * if ( CSource == 0 ) return ReadChar(); + * if ( CSource->CurChr >= CSource->Length ) return ENDSTREAMCHAR; + * return CSource->Buffer[ CSource->CurChr++ ]; + * + * + * BOOL CS_UnReadChar( struct CSource *CSource ) + * + * if ( CSource == 0 ) return UnReadChar(); + * if ( CSource->CurChr <= 0 ) return FALSE; + * CSource->CurChr--; + * return TRUE; + * + * + * To initialize a struct CSource, you set CSource->CS_Buffer to + * a string which is used as the data source, and set CS_Length to + * the number of characters in the string. Normally CS_CurChr should + * be initialized to ZERO, or left as it was from prior use as + * a CSource. + * + *********************************************************************} + +type +// This structure emulates an input stream by using a buffer. + PCSource = ^TCSource; + TCSource = record + CS_Buffer: PChar; // The buffer, which contains the stream. In most cases this may be nil, + // in which case the current input stream is used. + CS_Length, + CS_CurChr: LongInt; + end; + +{ ********************************************************************* + * + * The RDArgs data structure is the input parameter passed to the DOS + * ReadArgs() function call. + * + * The RDA_Source structure is a CSource as defined above; + * if RDA_Source.CS_Buffer is non-null, RDA_Source is used as the input + * character stream to parse, else the input comes from the buffered STDIN + * calls ReadChar/UnReadChar. + * + * RDA_DAList is a private address which is used internally to track + * allocations which are freed by FreeArgs(). This MUST be initialized + * to NULL prior to the first call to ReadArgs(). + * + * The RDA_Buffer and RDA_BufSiz fields allow the application to supply + * a fixed-size buffer in which to store the parsed data. This allows + * the application to pre-allocate a buffer rather than requiring buffer + * space to be allocated. If either RDA_Buffer or RDA_BufSiz is NULL, + * the application has not supplied a buffer. + * + * RDA_ExtHelp is a text string which will be displayed instead of the + * template string, if the user is prompted for input. + * + * RDA_Flags bits control how ReadArgs() works. The flag bits are + * defined below. Defaults are initialized to ZERO. + * + *********************************************************************} +{ The main structure used for ReadArgs(). It contains everything needed for + ReadArgs() handling. Allocate this structure with AllocDosObject().} + PRDArgs = ^TRDArgs; + TRDArgs = record + RDA_Source: TCSource; // Select input source use this structure as source + // for parsing, otherwise use DosInput() as source. + RDA_DAList: IPTR; // PRIVATE. Must be initialized to 0 + {The next two fields allow an application to supply a buffer to be parsed + to ReadArgs(). If either of these fields is 0, ReadArgs() allocates this + buffer itself.} + RDA_Buffer: PChar; // Pointer to buffer. May be nil. + RDA_BufSiz: LongInt; // Size of the supplied RDA_Buffer. May be 0. + RDA_ExtHelp: PChar; // Additional help, if user requests it, by supplying '?' as argument. + RDA_Flags: LongInt; // Flags for any required control (RDAF_?) + end; + +const + RDAB_STDIN = 0; // Use Input() instead of the supplied command line. + RDAB_NOALLOC = 1; // If set, do not allocate extra string space. + RDAB_NOPROMPT = 2; // Do not prompt for input. + + RDAF_STDIN = 1 shl RDAB_STDIN; + RDAF_NOALLOC = 1 shl RDAB_NOALLOC; + RDAF_NOPROMPT = 1 shl RDAB_NOPROMPT; + +{ Maximum number of template keywords which can be in a template passed + to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.} + MAX_TEMPLATE_ITEMS = 100; + +{ Maximum number of MULTIARG items (/M) returned by ReadArgs(), before + an ERROR_LINE_TOO_LONG. These two limitations are due to stack + usage. Applications should allow "a lot" of stack to use ReadArgs(). + This may change in the future} + MAX_MULTIARGS = 128; + +const +{ LockRecord() and LockRecords() locking modes. EXCLUSIVE modes mean that + nobody else is allowed to lock a specific record, which is allowed, when + locking with SHARED mode. When using IMMED modes, the timeout is ignored. } + REC_EXCLUSIVE = 0; + REC_EXCLUSIVE_IMMED = 1; + REC_SHARED = 2; + REC_SHARED_IMMED = 3; + +// Structure as passed to LockRecords() and UnLockRecords(). +type + PRecordLock = ^TRecordLock; + TRecordLock = record + rec_FH : BPTR; // PFileHandle The file to get the current record from. + rec_Offset, // The offset, the current record should start. + rec_Length, // The length of the current record. + rec_Mode : LongWord; // The mode od locking (REC_*). + end; + +{ This structure describes a local variable. The list is normally held in + Process^.pr_LocalVars. Note that this structure is READ-ONLY! + Allocate it with SetVar(). } +type + PLocalVar = ^TLocalVar; + TLocalVar = record + lv_Node: TNode; // Standard node structure as defined in Exec + lv_Flags: Word; + lv_Value: STRPTR; // The contents of the variable. + lv_Len: LongWord; // The length of the contents. + end; + +{ The lv_Flags bits are available to the application. The unused + lv_Node.ln_Pri bits are reserved for system use.} +const +// bit definitions for lv_Node.ln_Type: + LV_VAR = 0; // This is a variable. + LV_ALIAS = 1; // This is an alias. +{ This flag may be or'ed into lv_Node.ln_Type. It means that dos.library + should ignore this entry.} + LVB_IGNORE = 7; // ignore this entry on GetVar, etc + LVF_IGNORE = 1 shl LVB_IGNORE; + +{ definitions of flags passed to GetVar()/SetVar()/DeleteVar() + bit defs to be OR'ed with the type: + item will be treated as a single line of text unless BINARY_VAR is used } + GVB_GLOBAL_ONLY = 8; //The variable is not to be used locally. + GVB_LOCAL_ONLY = 9; // The variable is not to be used globally. + GVB_BINARY_VAR = 10; // The variable is a binary variable. lv_Value points to binary data. + GVB_DONT_NULL_TERM = 11; // lv_Value is not null-terminated. This is only allowed, if GVB_BINARY_VAR is also set. + GVB_SAVE_VAR = 12; // This flag tells dos to save the variable to ENVARC: too. + GVF_GLOBAL_ONLY = 1 shl GVB_GLOBAL_ONLY; + GVF_LOCAL_ONLY = 1 shl GVB_LOCAL_ONLY; + GVF_BINARY_VAR = 1 shl GVB_BINARY_VAR; + GVF_DONT_NULL_TERM = 1 shl GVB_DONT_NULL_TERM; + GVF_SAVE_VAR = 1 shl GVB_SAVE_VAR; + +const +{ ***************************************************************************} +{ definitions for the System() call } + + SYS_Dummy = (TAG_USER + 32); + SYS_Input = (SYS_Dummy + 1); // specifies the input filehandle + SYS_Output = (SYS_Dummy + 2); // specifies the output filehandle + SYS_Asynch = (SYS_Dummy + 3); // run asynch, close input/output on exit(!) + SYS_UserShell = (SYS_Dummy + 4); // send to user shell instead of boot shell + SYS_CustomShell = (SYS_Dummy + 5); // send to a specific shell (data is name) +{$ifdef aros} + SYS_Error = (SYS_Dummy + 10); // (BPTR/struct FileHandle *) Output filehandle. + SYS_ScriptInput = (SYS_Dummy + 11); // Filehandle to script to execute + SYS_Background = (SYS_Dummy + 12); // (BOOL) The shell is run as a "background shell + SYS_CliNumPtr = (SYS_Dummy + 13); // (LONG *) ti_Data to store the cli number + +{ This is not a Tag its a TAG Item Use this together with SYS_Input, SYS_Output and + SYS_Error, to tell SystemTagList to *duplicate* the respective caller's streams.} + SYS_DupStream = 1; +{$endif} + + +{ Tags for CreateNewProc(). All tags, where no default is stated, the default + is inherited from the parent process. Additionally you may use tags for + AllocDosObject(DOS_CLI, ...).} + NP_Dummy = (TAG_USER + 1000); + NP_Seglist = (NP_Dummy + 1); // seglist of code to run for the process + NP_FreeSeglist = (NP_Dummy + 2); // free seglist on exit - only valid for for NP_Seglist. Default is True. + NP_Entry = (NP_Dummy + 3); // entry point to run, mutually exclusive with NP_Seglist! + NP_Input = (NP_Dummy + 4); // filehandle - default is Open("NIL:"...) + NP_Output = (NP_Dummy + 5); // filehandle - default is Open("NIL:"...) + NP_CloseInput = (NP_Dummy + 6); // close input filehandle on exit default True + NP_CloseOutput = (NP_Dummy + 7); // close output filehandle on exit default True + NP_Error = (NP_Dummy + 8); // filehandle - default is Open("NIL:"...) + NP_CloseError = (NP_Dummy + 9); // close error filehandle on exit default True + NP_CurrentDir = (NP_Dummy + 10);// lock - default is parent's current dir + NP_StackSize = (NP_Dummy + 11);// stacksize for process - default 4000 + NP_Name = (NP_Dummy + 12);// name for process - default "New Process" + NP_Priority = (NP_Dummy + 13);// priority - default same as parent + NP_ConsoleTask = (NP_Dummy + 14);// consoletask - default same as parent + NP_WindowPtr = (NP_Dummy + 15);// window ptr - default is same as parent + NP_HomeDir = (NP_Dummy + 16);// home directory - default curr home dir + NP_CopyVars = (NP_Dummy + 17);// boolean to copy local vars-default True + NP_Cli = (NP_Dummy + 18);// create cli structure - default FALSE + NP_Path = (NP_Dummy + 19);// path - default is copy of parents path only valid if a cli process! + NP_CommandName = (NP_Dummy + 20);// commandname - valid only for CLI + NP_Arguments = (NP_Dummy + 21);// If this tag is used, NP_Input must not be NULL. +//The following two tags do not work, yet. + NP_NotifyOnDeath = (NP_Dummy + 22); // (BOOL) Notify parent, when process exits? (Default: FALSE) + NP_Synchronous = (NP_Dummy + 23); // (BOOL) Wait until called process returns. (Default: FALSE) + + NP_ExitCode = (NP_Dummy + 24);// (APTR) Code that is to be called, when process exits. (Default: NULL) + NP_ExitData = (NP_Dummy + 25);// (APTR) Optional data for NP_ExitCode. (Default: NULL) +{$ifdef aros} + NP_UserData = (NP_Dummy + 26); //(IPTR) User dependant data. Do with it, what you want to. (Default: NULL) +{$endif} + +{ Tags for AllocDosObject } + ADO_Dummy = (TAG_USER + 2000); + ADO_FH_Mode = (ADO_Dummy + 1); // Sets up FH to the specified mode. + ADO_DirLen = (ADO_Dummy + 2); // size in bytes for current dir buffer + ADO_CommNameLen = (ADO_Dummy + 3); // size in bytes for command name buffer + ADO_CommFileLen = (ADO_Dummy + 4); // size in bytes for command file buffer + ADO_PromptLen = (ADO_Dummy + 5); // size in bytes for the prompt buffer + +type + PRootNode = ^TRootNode; + TRootNode = record + rn_TaskArray: BPTR; // Pointer to the SegList for CLIs. + rn_ConsoleSegment: BPTR; // SegList for the CLI + rn_Time: TDateStamp; // Current time + rn_RestartSeg: APTR; // SegList for the disk validator process + rn_Info: BPTR; // Pointer ot the Info structure + rn_FileHandlerSegment: BPTR; // segment for a file handler + rn_CliList: TMinList; // List of all CLI processe (CliProcList) + rn_BootProc: PMsgPort; // private ptr to msgport of boot fs + rn_ShellSegment: BPTR; // seglist for Shell (for NewShell) + rn_Flags: LongInt; // dos flags + rn_RootLock: TSignalSemaphore; // RootNode arbitrator + end; + +{ Structure that is linked into the rootnode's rn_CliList. Completely + private, of course! ... and it's not compatible to AmigaOS.} + PCLIInfo = ^TCLIInfo; + TCLIInfo = record + ci_Node: TNode; + ci_Process: PProcess; + end; + +{ A structure for holding error messages - stored as array with error == 0 + for the last entry.} + PErrorString = ^TErrorString; + TErrorString = record + estr_Nums: PLongInt; + estr_Strings: STRPTR; + end; + +const +{ error report types for ErrorReport() } + REPORT_STREAM = 0; // a stream + REPORT_TASK = 1; // a process - unused + REPORT_LOCK = 2; // a lock + REPORT_VOLUME = 3; // a volume node + REPORT_INSERT = 4; // please insert volume + +{ Special error codes for ErrorReport() } + ABORT_DISK_ERROR = 296; // Read/write error + ABORT_BUSY = 288; // You MUST replace... + + +type +// This is how the base of dos.library looks like. + PDosLibrary = ^TDosLibrary; + TDosLibrary = record + dl_lib: TLibrary; + dl_Root: PRootNode; // Pointer to RootNode, described below } +{$ifdef AROS_FLAVOUR_BINCOMPAT} + dl_GV: APTR; // Pointer to BCPL global vector } + dl_A2: LongInt; // Private register dump of DOS } + dl_A5: LongInt; + dl_A6: LongInt; +{$endif} + dl_Errors: PErrorString; // pointer to array of error msgs + dl_TimeReq: PTimeRequest; // private pointer to timer request + dl_UtilityBase : PLibrary; // private ptr to utility library + dl_IntuitionBase : PLibrary; +{ These were AROS-specific private fields. At the moment they are mostly not used + and are present only for binary compatibility with programs that used dl_Flags + (Directory Opus for example). Do not try to use them in any way!} +{$ifdef aros} + dl_TimerBase: PDevice; + dl_TimerIO: TTimeRequest; + dl_DevInfo: PDosList; + dl_SysBase: PExecBase; + dl_SegList: BPTR; + dl_NulHandler: PDevice; + dl_NulLock: PUnit; + // LDDemon (library loader) private data + dl_LDObjectsListSigSem: TSignalSemaphore; + dl_LDObjectsList: TList; + dl_LDHandler: TInterrupt; + dl_LDDemonPort: PMsgPort; + dl_LDDemonTask: PProcess; + dl_LDReturn: ULONG; + //* AROS-specific and private. Can go away in future. + dl_SYSLock: BPTR; + // The flags are ORed with RootNode^.rn_Flags. See below for definitions. + dl_Flags: ULONG; +{$endif} + end; + +const + RNB_WILDSTAR = 24; + RNF_WILDSTAR = 1 shl RNB_WILDSTAR; + RNB_PRIVATE1 = 1; // private for dos + RNF_PRIVATE1 = 1 shl RNB_PRIVATE1; + +{ ***************************************************************************} +{ tags for NewLoadSeg } +{ no tags are defined yet for NewLoadSeg } + +{$ifdef aros} + +type +// FSA_Open, Returns a new filehandle. The file may be newly created (depending on io_FileMode) + PIFS_OPEN = ^TIFS_OPEN; + TIFS_OPEN = record + io_FileName: STRPTR; // File to open. + io_FileMode: LongWord; // Filemode (FMF_*) + end; +// Reads from a filehandle into a buffer. + PIFS_READ_WRITE = ^TIFS_READ_WRITE; + TIFS_READ_WRITE = record + io_Buffer: PChar; // The buffer for the data to read/write. + io_Length: LongInt; // The length of the buffer. This is filled by the filesystem handler + end; // with the number of bytes actually read/written. +// This action does exactly the same as the function Seek(). + PIFS_SEEK = ^TIFS_SEEK; + TIFS_SEEK = record + io_Offset: QWord; // Offset from position, specified as mode. This is filled by the + // filehandler with the old position in the file. + io_SeekMode: LongInt; // Seek mode (OFFSET_*) + end; +{ Waits for a character to arrive at the filehandle. This is not used for + plain files, but for queues only. Optionally a maximum time to wait may be + specified.} + PIFS_WAIT_CHAR = ^TIFS_WAIT_CHAR; + TIFS_WAIT_CHAR = record + io_Timeout: LongInt; // Maximum time (in microseconds) to wait for a character. + io_Success: LongBool; // This is set to False by the filehandler if no character arrived in + end; // time. Otherwise it is set to True. +{ Applies a new mode to a file. If you supply io_Mask with a value of 0, + no changes are made and you can just read the resulting io_FileMode.} + PIFS_FILE_MODE = ^TIFS_FILE_MODE; + TIFS_FILE_MODE = record + io_FileMode: LongWord; // The new mode to apply to the filehandle. See below for definitions. + // The filehandler fills this with the old mode bits. + io_Mask: LongWord; // This mask defines which flags are to be changed. + end; +{ This action can be used to query if a filehandle is interactive, i.e. if it + is a terminal or not.} + PIFS_IS_INTERACTIVE = ^TIFS_IS_INTERACTIVE; + TIFS_IS_INTERACTIVE = record + io_IsInteractive: LongBool; // This boolean is filled by the filehandler. It is set to TRUE if the + // filehandle is interactive, otherwise it is set to FALSE. + end; +// Compares two locks for equality. + PIFS_SAME_LOCK = ^TIFS_SAME_LOCK; + TIFS_SAME_LOCK = record + io_Lock: array[0..1] of APTR; // The two locks to compare. + io_Same: LongInt; // This is set to one of LOCK_DIFFERENT or LOCK_SAME + end; +// Examines a filehandle, giving various information about it. + PIFS_EXAMINE = ^TIFS_EXAMINE; + TIFS_EXAMINE = record + io_ead: PExAllData; // ExAllData structure buffer to be filled by the filehandler. + io_Size: LongInt; // Size of the buffer. + io_Mode: LongInt; // With which kind of information shall the buffer be filled with? + end; // see ED_* definitions for more information. + PIFS_EXAMINE_NEXT = ^TIFS_EXAMINE_NEXT; + TIFS_EXAMINE_NEXT = record + io_fib: PFileInfoBlock; // FileInfoBlock structure buffer to be used and filled by the filehandler. + end; +{ Works exactly like FSA_EXAMINE with the exeption that multiple files may be + examined, i.e. the filehandle must be a directory.} + PIFS_EXAMINE_ALL = ^TIFS_EXAMINE_ALL; + TIFS_EXAMINE_ALL = record + io_ead: PExAllData; + io_eac: PExallControl; + io_Size: LongInt; + io_Mode: LongInt; + end; +{ Works exactly like FSA_OPEN, but you can additionally specify protection + bits to be applied to new files.} + PIFS_OPEN_FILE = ^TIFS_OPEN_FILE; + TIFS_OPEN_FILE = record + io_Filename: STRPTR; // File to open. + io_FileMode: LongWord; // see below. + io_Protection: LongWord; // The protection bits + end; +// Creates a new directory. The filehandle of that new directory is returned. + PIFS_CREATE_DIR = ^TIFS_CREATE_DIR; + TIFS_CREATE_DIR = record + io_FileName: STRPTR; // Name of directory to create. + io_Protection: LongWord; // The protection bits. + end; +// Creates a hard link (i.e. gives one file/directory a second name). + PIFS_CREATE_HARDLINK = ^TIFS_CREATE_HARDLINK; + TIFS_CREATE_HARDLINK = record + io_Filename: STRPTR; // The filename of the link to create. + io_OldFile: APTR; // Filehandle of the file to link to. + end; +// Creates a soft link (i.e. a file is created that references another by its name). + PIFS_CREATE_SOFTLINK = ^TIFS_CREATE_SOFTLINK; + TIFS_CREATE_SOFTLINK = record + io_Filename: STRPTR; // The filename of the link to create. + io_Reference: STRPTR; // The name of the file to link to. + end; +// Renames a file. To the old and the new name, the current directory is applied to. + PIFS_RENAME = ^TIFS_RENAME; + TIFS_RENAME = record + io_Filename: STRPTR; // The old filename. + io_NewName: STRPTR; // The new filename. + end; +// Resolves the full path name of the file a softlink filehandle points to. + PIFS_READ_SOFTLINK = ^TIFS_READ_SOFTLINK; + TIFS_READ_SOFTLINK = record + io_Filename: STRPTR; // file name which returned ERROR_IS_SOFT_LINK + io_Buffer: STRPTR; { The buffer to fill with the pathname. If this buffer is too small, the + filesystem handler is supposed to return ERROR_LINE_TOO_LONG.} + io_Size: LongWord; // The size of the buffer pointed to by io_Buffer. + end; +// Deletes an object on the volume. + PIFS_DELETE_OBJECT = ^TIFS_DELETE_OBJECT; + TIFS_DELETE_OBJECT = record + io_Filename: STRPTR; // The name of the file to delete. + end; +// Sets a filecomment for a file. + PIFS_SET_COMMENT = ^TIFS_SET_COMMENT; + TIFS_SET_COMMENT = record + io_Filename: STRPTR; // The name of the file to be commented. + io_Comment: STRPTR; // The new filecomment. May be nil, in which case the current filecomment is deleted. + end; +// Sets the protection bits of a file. + PIFS_SET_PROTECT = ^TIFS_SET_PROTECT; + TIFS_SET_PROTECT = record + io_Filename: STRPTR; // The file to change. + io_Protection: LongWord; // The new protection bits. + end; +// Sets the ownership of a file. + PIFS_SET_OWNER = ^TIFS_SET_OWNER; + TIFS_SET_OWNER = record + io_Filename: STRPTR; // The file to change. + io_UID: Word; // The new owner. + io_GID: Word; // The new group owner. + end; +{ Sets the last modification date/time of the filename given as first + argument. The date/time is given as standard DateStamp structure} + PIFS_SET_DATE = ^TIFS_SET_DATE; + TIFS_SET_DATE = record + io_Filename: STRPTR; // The file to change + io_Date: TDateStamp; // The new date + end; +// Check if a filesystem is in fact a FILEsystem, i.e. can contain different files. + PIFS_IS_FILESYSTEM = ^TIFS_IS_FILESYSTEM; + TIFS_IS_FILESYSTEM = record + io_IsFilesystem: LongBool; // This is set to True by the filesystem handler if it is a filesystem + end; // and set to False if it is not. +{ Changes the number of buffers for the filesystem. The current number of + buffers is returned. The size of the buffers is filesystem-dependent.} + PIFS_MORE_CACHE = ^TIFS_MORE_CACHE; + TIFS_MORE_CACHE = record + io_NumBuffers: LongInt; // Number of buffers to add. May be negative to reduce number of buffers. + end; // This is to be set to the current number of buffers on success. +// Formats a volume, i.e. erases all data on it. + PIFS_FORMAT = ^TIFS_FORMAT; + TIFS_FORMAT = record + io_VolumeName: STRPTR; // New name for the volume. + io_DosType: LongWord; // New type for the volume. Filesystem specific. + end; +{ Resets/reads the mount-mode of the volume passed in as io_Unit. The first + and second arguments work exactly like FSA_FILE_MODE, but the third + argument can contain a password, if MMF_LOCKED is set.} + PIFS_MOUNT_MODE = ^TIFS_MOUNT_MODE; + TIFS_MOUNT_MODE = record + io_MountMode: LongWord; // The new mode to apply to the volume. See below for definitions. + // The filehandler fills this with the old mode bits. + io_Mask: LongWord; // This mask defines which flags are to be changed. + io_Password: STRPTR; // A password, which is needed if MMF_LOCKED is set. + end; + PIFS_INHIBIT = ^TIFS_INHIBIT; + TIFS_INHIBIT = record + io_Inhibit: LongBool; + end; + PIFS_NOTIFY = ^TIFS_NOTIFY; + TIFS_NOTIFY = record + io_FileName: STRPTR; // Needed for synchronous operation + io_NotificationRequest: PNotifyRequest; + end; + PIFS_INFO = ^TIFS_INFO; + TIFS_INFO = record + io_Info: PInfoData; + end; + PIFS_CHANGE_SIGNAL = ^TIFS_CHANGE_SIGNAL; + TIFS_CHANGE_SIGNAL = record + io_Task: PTask; + end; + PIFS_RECORD = ^TIFS_RECORD; + TIFS_RECORD = record + io_Offset: QWord; + io_Size: LongInt; + io_RecordMode: LongWord; + io_Timeout: LongWord; + end; + PIFS_PARENT_DIR = ^TIFS_PARENT_DIR; + TIFS_PARENT_DIR = record + io_DirName: PChar; // This will contain the return value of the parent directory, or + end; // nil if we are at the root directory already +// Allows us to change a console between raw and cooked mode. + PIFS_CONSOLE_MODE = ^TIFS_CONSOLE_MODE; + TIFS_CONSOLE_MODE = record + io_ConsoleMode: LongInt; // (FCM_*) + end; + PIFS_RELABEL = ^TIFS_RELABEL; + TIFS_RELABEL = record + io_NewName: STRPTR; + io_Result: LongBool; + end; +{ FSA_PIPE: create a pair of handles connected to each other + This opens a "file" (which will usually be a pipe device) and returns two + handles such that writing data to the writer will result in that data + appearing on the reader. Both handles must be closed for the underlying + file to be closed. If a NULL/empty path is supplied, an unnamed pipe will + be created, which will be destroyed once both handles are closed. + The read handle is returned in io_Unit.} + PIFS_PIPE = ^TIFS_PIPE; + TIFS_PIPE = record + io_FileName: STRPTR; + io_Writer: PUnit; + end; +const + FSA_OPEN = 1; // Returns a new filehandle. The file may be newly created (depending on io_FileMode) TIFS_OPEN + FAS_CLOSE = 2; // Closes an opened filehandle. Takes no extra arguments. + FSA_READ = 3; // Reads from a filehandle into a buffer. TIFS_READ_WRITE + FSA_WRITE = 4; // Writes the contents of a buffer into a filehandle. Uses TIFS_READ_WRITE. + FSA_SEEK = 5; // This action does exactly the same as the function Seek(). TIFS_SEEK + FSA_SET_FILE_SIZE = 6; // Sets the size of filehandle. Uses TIFS_SEEK (see above) as argument array. + FSA_WAIT_CHAR = 7; // Waits for a character to arrive at the filehandle. (TIFS_WAIT_CHAR) + FSA_FILE_MODE = 8; // Applies a new mode to a file. + FSA_IS_INTERACTIVE = 9; // Query if a filehandle is interactive + FSA_SAME_LOCK = 10; // Compares two locks for equality. + FSA_EXAMINE = 11; // Examines a filehandle, giving various information about it. + FSA_EXAMINE_NEXT = 12; // Examine next file + FSA_EXAMINE_ALL = 13; // Works exactly like FSA_EXAMINE on directories + FSA_EXAMINE_ALL_END = 14; { This has to be called if FSA_EXAMINE_ALL is stopped before all examined + files were returned. It takes no arguments except the filehandle in io_Unit.} + FSA_OPEN_FILE = 15; // Works exactly like FSA_OPEN but with special protection bits + FSA_CREATE_DIR = 16; // Creates a new directory. The filehandle of that new directory is returned. + FSA_CREATE_HARDLINK = 17; // Creates a hard link (i.e. gives one file/directory a second name). + FSA_CREATE_SOFTLINK = 18; // Creates a soft link (i.e. a file is created that references another by its name). + FSA_RENAME = 19; // Renames a file. To the old and the new name, the current directory is applied to. + FSA_READ_SOFTLINK = 20; // Resolves the full path name of the file a softlink filehandle points to. + FSA_DELETE_OBJECT = 21; // Deletes an object on the volume. + FSA_SET_COMMENT = 22; // Sets a filecomment for a file. + FSA_SET_PROTECT = 23; // Sets the ownership of a file. + FSA_SET_OWNER = 24; // Sets the last modification date/time + FSA_SET_DATE = 25; // Set file date + FSA_IS_FILESYSTEM = 26; // Check if a filesystem is in fact a FILEsystem, i.e. can contain different files. + FSA_MORE_CACHE = 27; // Changes the number of buffers for the filesystem. + FSA_FORMAT = 28; // Formats a volume, i.e. erases all data on it. + FSA_MOUNT_MODE = 29; // Resets/reads the mount-mode + //FSA_SERIALIZE_DISK = 30; // currently not supported + // FSA_FLUSH = 31; // currently not supported + FSA_INHIBIT = 32; + //FSA_WRITE_PROTECT = 33; // currently not supported + //FSA_DISK_CHANGE = 34; // currently not supported + FSA_ADD_NOTIFY = 35; + FSA_REMOVE_NOTIFY = 36; + FSA_DISK_INFO = 37; + FSA_CHANGE_SIGNAL = 38; + FSA_LOCK_RECORD = 39; + FSA_UNLOCK_RECORD = 40; + FSA_PARENT_DIR = 41; + FSA_PARENT_DIR_POST = 42; + FSA_CONSOLE_MODE = 43; // Allows us to change a console between raw and cooked mode. + FSA_RELABEL = 44; + FSA_PIPE = 45; // create a pair of handles connected to each other +// io_ConsoleMode + FCM_COOKED = 0; + FCM_RAW = 1 shl 0; + FCM_NOECHO = 1 shl 1; +{ io_FileMode for FSA_OPEN, FSA_OPEN_FILE and FSA_FILE_MODE. These are flags + and may be OR'ed. Note that not all filesystems support all flags.} + FMF_LOCK = 1 shl 0; // Lock exclusively. + FMF_EXECUTE = 1 shl 1; // Open for executing. +// At least one of the following two flags must be specified. Otherwise expect strange things to happen. + FMF_WRITE = 1 shl 2; // Open for writing. + FMF_READ = 1 shl 3; // Open for reading. + FMF_CREATE = 1 shl 4; // Create file if it doesn't exist. + FMF_CLEAR = 1 shl 5; // Truncate file on open. + FMF_RAW = 1 shl 6; // Switch cooked to raw and vice versa. + FMF_NONBLOCK = 1 shl 7; // Don't block Open() in case it would and return an error in case Write()/Read() would block + FMF_APPEND = 1 shl 8; // Every write will happen always at the end of the file + FMF_AMIGADOS = (1 shl 9) or (1 shl 31); // Identifies the old AmigaDOS modes: + // - bit 9 is the first bit set in the MODE_#? modes + // - bit 31 is the first bit set in ACCESS_#? modes + FMF_MODE_OLDFILE = FMF_AMIGADOS or FMF_WRITE or FMF_READ; + FMF_MODE_READWRITE = FMF_MODE_OLDFILE or FMF_CREATE; + FMF_MODE_NEWFILE = FMF_MODE_READWRITE or FMF_LOCK or FMF_CLEAR; +// io_MountMode for FSA_MOUNT_MODE. These are flags and may be OR'ed. + MMF_READ = 1 shl 0; // Mounted for reading. + MMF_WRITE = 1 shl 1; // Mounted for writing. + MMF_READ_CACHE = 1 shl 2; // Read cache enabled. + MMF_WRITE_CACHE = 1 shl 3; // Write cache enabled. + MMF_OFFLINE = 1 shl 4; // Filesystem currently does not use the device. + MMF_LOCKED = 1 shl 5; // Mount mode is password protected. +{ This structure is an extended TIORequest. It is used for + requesting actions from AROS filesystem handlers. + Note that this structure may grow in the future. Do not depend on its size! + You may use sizeof(TIOFileSys) nevertheless if you are reserving + memory for a TIOFileSys as the size of it will never shrink.} +type + PIOFileSys = ^TIOFileSys; + TIOFileSys = record + IOFS: TIORequest; // Standard I/O request. + io_DosError: LongInt; // Dos error code. + io_PacketEmulation: PDosPacket; // Private + io_DirPos: IPTR; // Handler-private key to current directory position + //* This union contains all the data needed for the various actions. */ + io_Union: record + case Smallint of + 0: (io_OpenDevice : record + io_DeviceName: STRPTR; // Name of the device to open. */ + io_Unit: IPTR; // Number of unit to open. */ + io_Environ: ^IPTR; // Pointer to environment array. + io_DosName: STRPTR; // The name with which the + // filesystem is being mounted + // (the mount point, one might + // say) + io_DeviceNode: PDeviceNode; // The DOS entry for this + // filesystem. Packet-based + // filesystems expect to receive + // this along with the + // startup message + end; + ); + 1: (io_NamedFile: record + io_Filename: STRPTR; + end; + ); + 2: ( + io_OPEN: TIFS_OPEN; // FSA_OPEN + io_READ_WRITE: TIFS_READ_WRITE; // FSA_READ, FSA_WRITE + io_SEEK: TIFS_SEEK; // FSA_SEEK + io_WAIT_CHAR: TIFS_WAIT_CHAR; // FSA_WAIT_CHAR + io_FILE_MODE: TIFS_FILE_MODE; // FSA_FILE_MODE */ + io_IS_INTERACTIVE: TIFS_IS_INTERACTIVE; // FSA_IS_INTERACTIVE */ + io_SAME_LOCK: TIFS_SAME_LOCK; // FSA_SAME_LOCK */ + io_EXAMINE: TIFS_EXAMINE; // FSA_EXAMINE */ + io_EXAMINE_ALL: TIFS_EXAMINE_ALL; // FSA_EXAMINE_ALL */ + io_EXAMINE_NEXT: TIFS_EXAMINE_NEXT; // FSA_EXAMINE_NEXT */ + io_OPEN_FILE: TIFS_OPEN_FILE; // FSA_OPEN_FILE */ + io_CREATE_DIR: TIFS_CREATE_DIR; // FSA_CREATE_DIR */ + io_CREATE_HARDLINK: TIFS_CREATE_HARDLINK; // FSA_CREATE_HARDLINK */ + io_CREATE_SOFTLINK: TIFS_CREATE_SOFTLINK; // FSA_CREATE_SOFTLINK */ + io_RENAME: TIFS_RENAME; // FSA_RENAME */ + io_READ_SOFTLINK: TIFS_READ_SOFTLINK; // FSA_READ_SOFTLINK */ + io_DELETE_OBJECT: TIFS_DELETE_OBJECT; // FSA_DELETE_OBJECT */ + io_SET_COMMENT: TIFS_SET_COMMENT; // FSA_SET_COMMENT */ + io_SET_PROTECT: TIFS_SET_PROTECT; // FSA_SET_PROTECT */ + io_SET_OWNER: TIFS_SET_OWNER; // FSA_SET_OWNER */ + io_SET_DATE: TIFS_SET_DATE; // FSA_SET_DATE */ + io_IS_FILESYSTEM: TIFS_IS_FILESYSTEM; // FSA_IS_FILESYSTEM */ + io_MORE_CACHE: TIFS_MORE_CACHE; // FSA_MORE_CACHE */ + io_FORMAT: TIFS_FORMAT; // FSA_FORMAT */ + io_MOUNT_MODE: TIFS_MOUNT_MODE; // FSA_MOUNT_MODE */ + io_INHIBIT: TIFS_INHIBIT; // FSA_INHIBIT */ + io_PARENT_DIR: TIFS_PARENT_DIR; // FSA_PARENT_DIR */ + io_CONSOLE_MODE: TIFS_CONSOLE_MODE; // FSA_CONSOLE_MODE */ + io_RELABEL: TIFS_RELABEL; // FSA_RELABEL */ + io_NOTIFY: TIFS_NOTIFY; // FSA_ADD_NOTIFY + io_INFO: TIFS_INFO; // FSA_INFO + io_RECORD: TIFS_RECORD; // FSA_LOCK_RECORD + io_CHANGE_SIGNAL: TIFS_CHANGE_SIGNAL; // FSA_CHANGE_SIGNAL + io_PIPE: TIFS_PIPE; // FSA_PIPE + ); + end; +end; + +const + ERROR_BROKEN_PIPE = 400; // An attempt to write on a pipe without any reader has been made + ERROR_WOULD_BLOCK = 401; // A Read() or a Write() on a file opened with the FMF_NONBLOCK flag would block + ERROR_INTERRUPTED = 402; // The I/O file operation has been interrupted for some reason +{$endif} + + + +procedure AbortPkt(Port: PMsgPort; Pkt: PDosPacket); syscall AOS_DOSBase 44; +function AddBuffers(const DeviceName: STRPTR; NumbBuffers: LongInt): LongBool; syscall AOS_DOSBase 122; +function AddDosEntry(DList: PDosList): LongInt; syscall AOS_DOSBase 113; +function AddPart(DirName: STRPTR; const FileName: STRPTR; Size: LongWord): LongBool; syscall AOS_DOSBase 147; +function AddSegment(const Name: STRPTR; Seg: BPTR; Type_: LongInt): LongBool; syscall AOS_DOSBase 129; +function AllocDosObject(Type_: LongWord; const Tags: PTagItem): APTR; syscall AOS_DOSBase 38; + //function AllocDosObjectTagList(Type_ : LongWord;const Tags : PTagItem) : Pointer; +function AssignAdd(const Name: STRPTR; Lock: BPTR): LongBool; syscall AOS_DOSBase 105; +function AssignLate(const Name: STRPTR; const Path: STRPTR): LongBool; syscall AOS_DOSBase 103; +function AssignLock(const Name: STRPTR; Lock: BPTR): LongInt; syscall AOS_DOSBase 102; +function AssignPath(const Name: STRPTR; const Path: STRPTR): LongBool; syscall AOS_DOSBase 104; +function AttemptLockDosList(Flags: LongWord): PDosList; syscall AOS_DOSBase 111; +function ChangeMode(Type_: LongWord; Object_: BPTR; NewMode: LongWord): LongBool; syscall AOS_DOSBase 75; +function CheckSignal(Mask: LongInt): LongInt; syscall AOS_DOSBase 132; +function Cli: PCommandLineInterface; syscall AOS_DOSBase 82; +function CliInitNewcli(Dp: PDosPacket): IPTR; syscall AOS_DOSBase 155; +function CliInitRun(Dp: PDosPacket): IPTR; syscall AOS_DOSBase 156; +function CompareDates(const Date1: PDateStamp; const Date2: PDateStamp): LongInt; syscall AOS_DOSBase 123; +function CreateDir(const Name: STRPTR): BPTR; syscall AOS_DOSBase 20; +function CreateNewProc(const Tags: PTagItem): PProcess; syscall AOS_DOSBase 83; + //function CreateNewProcTagList(const Tags : PTagItem) : pProcess; +function CreateProc(const Name: STRPTR; Pri: LongInt; SegList: BPTR; StackSize: LongInt): PMsgPort; syscall AOS_DOSBase 23; +function CurrentDir(Lock: BPTR): BPTR; syscall AOS_DOSBase 21; +function DateStamp(Date: PDateStamp): PDateStamp; syscall AOS_DOSBase 32; +function DateToStr(Datetime: PDateTime): LongBool; syscall AOS_DOSBase 124; +function DeleteFile(const Name: STRPTR): LongBool; syscall AOS_DOSBase 12; +function DeleteVar(const Name: STRPTR; Flags: LongWord): LongInt; syscall AOS_DOSBase 152; +function DeviceProc(const Name: STRPTR): PMsgPort; syscall AOS_DOSBase 29; +function DisplayError(FormstStr: STRPTR; Flags: LongWord; Args: APTR): LongInt; syscall AOS_DOSBase 81; +function DoPkt(Port: PMsgPort; Action: LongInt; Arg1, Arg2, Arg3, Arg4, Arg5: LongInt): LongInt; syscall AOS_DOSBase 40; +function DOSClose(File_: BPTR): LongBool; syscall AOS_DOSBase 6; +procedure DOSDelay(TimeOut: LongWord); syscall AOS_DOSBase 33; +procedure DOSExit(ReturnCode: LongInt); syscall AOS_DOSBase 24; +function DosError(): BPTR; syscall AOS_DOSBase 142; +function DOSFlush(File_: BPTR): LongInt; syscall AOS_DOSBase 60; +function DosGetLocalizedString(StringNum: LongInt): STRPTR; syscall AOS_DOSBase 154; +function DosGetString(StringNum: LongInt): STRPTR; syscall AOS_DOSBase 163; +function DOSInput: BPTR; syscall AOS_DOSBase 9; +function DOSOpen(const Name: STRPTR; AccessMode: LongInt): BPTR; syscall AOS_DOSBase 5; +function DOSOutput : BPTR; syscall AOS_DOSBase 10; +function DOSRead(File_: BPTR; Buffer: APTR; Length: LongInt): LongInt; syscall AOS_DOSBase 7; +function DOSRename(const OldName: STRPTR; const NewName: STRPTR): LongInt; syscall AOS_DOSBase 13; +function DOSSeek(File_: BPTR; Position: LongInt; Mode: LongInt): LongInt; syscall AOS_DOSBase 11; +function DOSWrite(File_: BPTR; Buffer: APTR; Length: LongInt): LongInt; syscall AOS_DOSBase 8; +function DupLock(Lock: BPTR): BPTR; syscall AOS_DOSBase 16; +function DupLockFromFH(Lock: BPTR): BPTR; syscall AOS_DOSBase 62; +procedure EndNotify(Notify: PNotifyRequest); syscall AOS_DOSBase 149; +function ErrorReport(Code: LongInt; Type_: LongInt; Arg1: IPTR; Device: PMsgPort): LongBool; syscall AOS_DOSBase 80; +function ExAll(Lock: BPTR; Buffer: PExAllData; Size: LongInt; Data: LongInt; Control: PExAllControl): LongBool; syscall AOS_DOSBase 72; +procedure ExAllEnd(Lock: BPTR; Buffer: PExAllData; Size: LongInt; Data: LongInt; Control: PExAllControl); syscall AOS_DOSBase 165; +function Examine(Lock: BPTR; FileInfoBlock: PFileInfoBlock): LongInt; syscall AOS_DOSBase 17; +function ExamineFH(Fh: BPTR; Fib: PFileInfoBlock): LongBool; syscall AOS_DOSBase 65; +function Execute(const String_: STRPTR; Input: BPTR; Output: BPTR): LongInt; syscall AOS_DOSBase 37; +function ExNext(Lock: BPTR; FileInfoBlock: PFileInfoBlock): LongInt; syscall AOS_DOSBase 18; +function Fault(Code: LongInt; Header: STRPTR; Buffer: STRPTR; Len: LongInt): LongBool; syscall AOS_DOSBase 78; +function FGetC(File_: BPTR): LongInt; syscall AOS_DOSBase 51; +function FGets(Fh: BPTR; Buf: STRPTR; BufLen: LongWord): STRPTR; syscall AOS_DOSBase 56; +function FilePart(const Path: STRPTR): STRPTR; syscall AOS_DOSBase 145; +function FindArg(const Template: STRPTR; const KeyWord: STRPTR): LongInt; syscall AOS_DOSBase 134; +function FindCliProc(Num: LongWord): PProcess; syscall AOS_DOSBase 91; +function FindDosEntry(const DList: PDosList; const Name: STRPTR; Flags: LongWord): PDosList; syscall AOS_DOSBase 114; +function FindSegment(const Name: STRPTR; const Seg: PSegment; System: LongBool): PSegment; syscall AOS_DOSBase 130; +function FindVar(const Name: STRPTR; Type_: LongWord): PLocalVar; syscall AOS_DOSBase 153; +function DosFormat(const DeviceName: STRPTR; const VolumeName: STRPTR; DosType: LongWord): LongBool; syscall AOS_DOSBase 119; +function FPutC(File_: BPTR; Character: LongInt): LongInt; syscall AOS_DOSBase 52; +function FPuts(File_: BPTR; const String_: STRPTR): LongInt; syscall AOS_DOSBase 57; +function FRead(Fh: BPTR; Block: APTR; Blocklen: LongWord; Number: LongWord): LongInt; syscall AOS_DOSBase 54; +procedure FreeArgs(Args: PRDArgs); syscall AOS_DOSBase 143; +procedure FreeDeviceProc(Dp: PDevProc); syscall AOS_DOSBase 108; +procedure FreeDosEntry(DList: PDosList); syscall AOS_DOSBase 117; +procedure FreeDosObject(Type_: LongWord; Ptr: APTR); syscall AOS_DOSBase 39; +function FWrite(Fh: BPTR; Block: APTR; Blocklen: LongWord; NumBlocks: LongWord): LongInt; syscall AOS_DOSBase 55; +function GetArgStr: STRPTR; syscall AOS_DOSBase 89; +function GetConsoleTask: PMsgPort; syscall AOS_DOSBase 85; +function GetCurrentDirName(Buf: STRPTR; Len: LongInt): LongBool; syscall AOS_DOSBase 94; +function GetDeviceProc(const Name: STRPTR; Dp: PDevProc): PDevProc; syscall AOS_DOSBase 107; +function GetFileSysTask: PMsgPort; syscall AOS_DOSBase 87; +function GetProgramDir: BPTR; syscall AOS_DOSBase 100; +function GetProgramName(Buf: STRPTR; Len: LongInt): LongBool; syscall AOS_DOSBase 96; +function GetPrompt(Buf: STRPTR; Len: LongInt): LongBool; syscall AOS_DOSBase 98; +function GetVar(const Name: STRPTR; Buffer: STRPTR; Size: LongInt; Flags: LongInt): LongInt; syscall AOS_DOSBase 151; +function Info(Lock: BPTR; ParameterBlock: PInfoData): LongInt; syscall AOS_DOSBase 19; +function Inhibit(const Name: STRPTR; OnOff: LongInt): LongInt; syscall AOS_DOSBase 121; +function InternalLoadSeg(Fh: BPTR; Table: BPTR; const FuncArray: PLongInt; var Stack: LongInt): BPTR; syscall AOS_DOSBase 126; +function InternalUnLoadSeg(SegList: BPTR; FreeFunc: TProcedure): LongBool; syscall AOS_DOSBase 127; +function IoErr: LongInt; syscall AOS_DOSBase 22; +function IsFileSystem(const Name: STRPTR): LongBool; syscall AOS_DOSBase 118; +function IsInteractive(File_: BPTR): LongInt; syscall AOS_DOSBase 36; +function LoadSeg(const Name: STRPTR): BPTR; syscall AOS_DOSBase 25; +function Lock(const Name: STRPTR; AccessMode: LongInt): BPTR; syscall AOS_DOSBase 14; +function LockDosList(Flags: LongWord): PDosList; syscall AOS_DOSBase 109; +function LockRecord(Fh: BPTR; Offset: LongWord; Length: LongWord; Mode: LongWord; Timeout: LongWord): LongBool; syscall AOS_DOSBase 45; +function LockRecords(RecArray: PRecordLock; TimeOut: LongWord): LongBool; syscall AOS_DOSBase 46; +function MakeDosEntry(const Name: STRPTR; Type_: LongInt): PDosList; syscall AOS_DOSBase 116; +function MakeLink(const Name: STRPTR; Dest: APTR; Soft: LongInt): LongInt; syscall AOS_DOSBase 74; +procedure MatchEnd(AP: PAnchorPath); syscall AOS_DOSBase 139; +function MatchFirst(const Pat: STRPTR; AP: PAnchorPath): LongInt; syscall AOS_DOSBase 137; +function MatchNext(AP: PAnchorPath): LongInt; syscall AOS_DOSBase 138; +function MatchPattern(const Pat: STRPTR; Str: STRPTR): LongBool; syscall AOS_DOSBase 141; +function MatchPatternNoCase(const Pat: STRPTR; Str: STRPTR): LongBool; syscall AOS_DOSBase 162; +function MaxCli: LongWord; syscall AOS_DOSBase 92; +function NameFromFH(Fh: BPTR; Buffer: STRPTR; Length: LongInt): LongBool; syscall AOS_DOSBase 68; +function NameFromLock(Lock: BPTR; Buffer: STRPTR; Length: LongInt): LongBool; syscall AOS_DOSBase 67; +function NewLoadSeg(const File_: STRPTR; const Tags: PTagItem): BPTR; syscall AOS_DOSBase 128; + //function NewLoadSegTagList(const file_ : PChar;const Tags : PTagItem) : LongInt; +function NextDosEntry(const DList: PDosList; Flags: LongWord): PDosList; syscall AOS_DOSBase 115; +function OpenFromLock(Lock: BPTR): BPTR; syscall AOS_DOSBase 62; +function ParentDir(Lock: BPTR): BPTR; syscall AOS_DOSBase 35; +function ParentOfFH(Fh: BPTR): BPTR; syscall AOS_DOSBase 64; +function ParsePattern(const Source: STRPTR; Dest: STRPTR; DestLength: LongInt): LongInt; syscall AOS_DOSBase 140; +function ParsePatternNoCase(const Source: STRPTR; Dest: STRPTR; DestLen: LongInt): LongInt; syscall AOS_DOSBase 161; +function PathPart(const Path: STRPTR): STRPTR; syscall AOS_DOSBase 146; +function Pipe(const Name: STRPTR; var Reader: BPTR; var Writer: BPTR): LongInt; syscall AOS_DOSBase 160; +function PrintFault(Code: LongInt; const Header: STRPTR): LongBool; syscall AOS_DOSBase 79; +function PutStr(const String_: STRPTR): LongInt; syscall AOS_DOSBase 158; +function ReadArgs(const Template: STRPTR; var Array_: IPTR; RdArgs: PRDArgs): PRDArgs; syscall AOS_DOSBase 133; +function ReadItem(const Buffer: STRPTR; MaxChars: LongInt; CSource: PCSource): LongInt; syscall AOS_DOSBase 135; +function ReadLink(Port: PMsgPort; Lock: LongInt; const Path: STRPTR; Buffer: STRPTR; Size: LongWord): LongInt; syscall AOS_DOSBase 73; +function Relabel(const Drive: STRPTR; const NewName: STRPTR): LongInt; syscall AOS_DOSBase 120; +function RemAssignList(const Name: STRPTR; Lock: BPTR): LongInt; syscall AOS_DOSBase 106; +function RemDosEntry(DList: PDosList): LongInt; syscall AOS_DOSBase 112; +function RemSegment(Seg: PSegment): LongInt; syscall AOS_DOSBase 131; +procedure ReplyPkt(Dp: PDosPacket; Res1: LongInt; Res2: LongInt); syscall AOS_DOSBase 43; +function RunCommand(SegList: BPTR; StackSize: LongWord; const ArgPtr: STRPTR; ArgSize: LongWord): LongInt; syscall AOS_DOSBase 84; +function RunHandler(DevNode: PDeviceNode; Path: PChar): PMsgPort; syscall AOS_DOSBase 27; +function SameDevice(Lock1: BPTR; Lock2: BPTR): LongBool; syscall AOS_DOSBase 164; +function SameLock(Lock1: BPTR; Lock2: BPTR): LongInt; syscall AOS_DOSBase 70; +function ScanVars(Hook: PHook; Flags: LongWord; UserData: APTR): LongInt; syscall AOS_DOSBase 167; +function SelectError(Fh: BPTR): BPTR; syscall AOS_DOSBase 144; +function SelectInput(Fh: BPTR): BPTR; syscall AOS_DOSBase 49; +function SelectOutput(Fh: BPTR): BPTR; syscall AOS_DOSBase 50; +procedure SendPkt(Dp: PDosPacket; Port: PMsgPort; ReplyPort: PMsgPort); syscall AOS_DOSBase 41; +function SetArgStr(const String_: STRPTR): STRPTR; syscall AOS_DOSBase 90; +function SetComment(const Name: STRPTR; const Comment: STRPTR): LongInt; syscall AOS_DOSBase 30; +function SetConsoleTask(const Handler: PMsgPort): PMsgPort; syscall AOS_DOSBase 86; +function SetCurrentDirName(const Name: STRPTR): LongBool; syscall AOS_DOSBase 93; +function SetFileDate(const Name: STRPTR; Date: PDateStamp): LongBool; syscall AOS_DOSBase 66; +function SetFileSize(File_: BPTR; Offset: LongInt; Mode: LongInt): LongInt; syscall AOS_DOSBase 76; +function SetFileSysTask(const Task: PMsgPort): PMsgPort; syscall AOS_DOSBase 88; +function SetIoErr(Result_: LongInt): LongInt; syscall AOS_DOSBase 77; +function SetMode(Fh: BPTR; Mode: LongInt): LongBool; syscall AOS_DOSBase 72; +function SetOwner(const Name: STRPTR; Owner_Info: LongWord): LongBool; syscall AOS_DOSBase 166; +function SetProgramDir(Lock: BPTR): BPTR; syscall AOS_DOSBase 99; +function SetProgramName(const Name: STRPTR): LongBool; syscall AOS_DOSBase 95; +function SetPrompt(const Name: STRPTR): LongBool; syscall AOS_DOSBase 97; +function SetProtection(const Name: STRPTR; Protect: LongWord): LongInt; syscall AOS_DOSBase 31; +function SetVar(const Name: STRPTR; Buffer: PChar; Size: LongInt; Flags: LongInt): LongBool; syscall AOS_DOSBase 150; +function SetVBuf(File_: BPTR; Buff: STRPTR; Type_: LongInt; Size: LongInt): LongInt; syscall AOS_DOSBase 61; +function SplitName(const Name: STRPTR; Seperator: LongWord; Buf: STRPTR; OldPos: LongInt; Size: LongInt): LongInt; syscall AOS_DOSBase 69; +function StartNotify(Notify: PNotifyRequest): LongBool; syscall AOS_DOSBase 148; +function StrToDate(DateTime: PDateTime): LongBool; syscall AOS_DOSBase 125; +function StrToLong(const String_: STRPTR; var Value: LongInt): LongInt; syscall AOS_DOSBase 136; +function SystemTagList(const Command: STRPTR; const Tags: PTagItem): LongInt; syscall AOS_DOSBase 101; + //function DOSSystem(const command : PChar;const Tags : PTagItem) : LongInt; //* Real: SystemTagList ??? +function UnGetC(File_: BPTR; Character: LongInt): LongInt; syscall AOS_DOSBase 53; +procedure UnLoadSeg(Seglist: BPTR); syscall AOS_DOSBase 25; +function UnLock(Lock: BPTR): LongBool; syscall AOS_DOSBase 26; +procedure UnLockDosList(Flags: LongWord); syscall AOS_DOSBase 110; +function UnLockRecord(Fh: BPTR; Offset: LongWord; Length: LongWord): LongBool; syscall AOS_DOSBase 47; +function UnLockRecords(RecArray: PRecordLock): LongBool; syscall AOS_DOSBase 48; +function VFPrintf(Fh: BPTR; const format: STRPTR; const ArgArray: PLongInt): LongInt; syscall AOS_DOSBase 59; +function VFWritef(Fh: BPTR; const Fmt: STRPTR; const ArgArray: PLongInt): LongInt; syscall AOS_DOSBase 58; +function VPrintf(const Format: STRPTR; var ArgArray: IPTR): LongInt; syscall AOS_DOSBase 159; +function WaitForChar(File_: BPTR; TimeOut: LongInt): LongInt; syscall AOS_DOSBase 34; +function WaitPkt: PDosPacket; syscall AOS_DOSBase 42; +function WriteChars(const Buf: STRPTR; BufLen: LongWord): LongInt; syscall AOS_DOSBase 157; + +function ReadChar(): LongInt; +function WriteChar(c: LongInt): LongInt; +function UnReadChar(c: LongInt): LongInt; + +// Special functions for var args +function AllocDosObjectTags(const Type_: LongWord; const Tags: array of const): APTR; +function CreateNewProcTags(const Tags: array of const): PProcess; +function NewLoadSegTags(const File_: STRPTR; const Tags: array of const): BPTR; +function SystemTags(const Command: STRPTR; const Tags: array of const): LongInt; + +const + BNULL = nil; + +function MKBADDR(a: APTR): BPTR; +function BADDR(a: BPTR): APTR; + +implementation + +uses + tagsarray; + + +function AllocDosObjectTags(const Type_: LongWord; const Tags: array of const): APTR; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + AllocDosObjectTags := AllocDosObject(Type_, GetTagPtr(TagList)); +end; + +function CreateNewProcTags(const Tags: array of const): PProcess; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + CreateNewProcTags := CreateNewProc(GetTagPtr(TagList)); +end; + +function NewLoadSegTags(const File_: STRPTR; const Tags: array of const): BPTR; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + NewLoadSegTags := NewLoadSeg(File_, GetTagPtr(TagList)); +end; + +function SystemTags(const Command: STRPTR; const Tags: array of const): LongInt; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + SystemTags := SystemTagList(Command, GetTagPtr(TagList)); +end; + +function MKBADDR(a: APTR): BPTR; inline; +begin + {$ifdef AROS_FAST_BPTR} + MKBADDR := a; + {$else} + MKBADDR := APTR((IPTR(a)) shr 2); + {$endif} +end; + +function BADDR(a: BPTR): APTR; inline; +begin + {$ifdef AROS_FAST_BPTR} + BADDR := a; + {$else} + BADDR := BPTR((IPTR(a)) shl 2); + {$endif} +end; + +function ReadChar(): LongInt; +begin + ReadChar := FGetC(DosInput()); +end; + +function WriteChar(c: LongInt): LongInt; +begin + WriteChar := FPutC(DosOutput(), c); +end; + +function UnReadChar(c: LongInt): LongInt; +begin + UnReadChar := UnGetC(DosInput(),c); +end; + +end. (* UNIT DOS *) + + diff --git a/packages/arosunits/src/clipboard.pas b/packages/arosunits/src/clipboard.pas new file mode 100755 index 0000000000..00b85ae816 --- /dev/null +++ b/packages/arosunits/src/clipboard.pas @@ -0,0 +1,179 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + clipboard functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit clipboard; + +interface + +{$mode objfpc}{$H+} + +uses exec; + +const + CBD_POST = CMD_NONSTD + 0; + CBD_CURRENTREADID = CMD_NONSTD + 1; + CBD_CURRENTWRITEID = CMD_NONSTD + 2; + CBD_CHANGEHOOK = CMD_NONSTD + 3; + + CBERR_OBSOLETEID = 1; + +type + + PClipboardUnitPartial = ^TClipboardUnitPartial; + TClipboardUnitPartial = record + cu_Node : TNode; { list of units } + cu_UnitNum : LongWord; { unit number for this unit } + { the remaining unit data is private to the device } + end; + + + PIOClipReq = ^TIOClipReq; + TIOClipReq = record + io_Message : TMessage; + io_Device : PDevice; { device node pointer } + io_Unit : PClipboardUnitPartial; { unit (driver private) } + io_Command : Word; { device command } + io_Flags : Byte; { including QUICK and SATISFY } + io_Error : ShortInt; { error or warning num } + io_Actual : LongWord; { number of bytes transferred } + io_Length : LongWord; { number of bytes requested } + io_Data : STRPTR; { either clip stream or post port } + io_Offset : LongWord; { offset in clip stream } + io_ClipID : LongInt; { ordinal clip identifier } + end; + +const + PRIMARY_CLIP = 0; { primary clip unit } + +type + + PSatisfyMsg = ^TSatisfyMsg; + TSatisfyMsg = record + sm_Msg : TMessage; { the length will be 6 } + sm_Unit : Word; { which clip unit this is } + sm_ClipID : LongInt; { the clip identifier of the post } + end; + + PClipHookMsg = ^TClipHookMsg; + TClipHookMsg = record + chm_Type : LongWord; { zero for this structure format } + chm_ChangeCmd, { command that caused this hook invocation: } + { either CMD_UPDATE OR CBD_POST } + chm_ClipID : LongInt; { the clip identifier of the new data } + END; + +function GetTextFromClip(ClipUnit: Byte): string; +function PutTextToClip(ClipUnit: Byte; Text: string): Boolean; + +implementation + + +uses + iffparse; + +const + ID_FTXT = 1179932756; + ID_CHRS = 1128813139; + +function GetTextFromClip(ClipUnit: Byte): string; +var + Iff: PIffHandle; + Error: LongInt; + Cn: PContextNode; + Buf: PChar; + Len: Integer; + Cu: LongInt; +begin + Result := ''; + Cu := ClipUnit; + Iff := AllocIff; + if Assigned(Iff) then + begin + Iff^.iff_Stream := LongWord(OpenClipboard(Cu)); + if Iff^.iff_Stream<>0 then + begin + InitIffAsClip(iff); + if OpenIff(Iff, IFFF_READ) = 0 then + begin + if StopChunk(iff, ID_FTXT, ID_CHRS) = 0 then + begin + while True do + begin + Error := ParseIff(iff, IFFPARSE_SCAN); + if (Error <> 0) and (Error <> IFFERR_EOC) then + Break; + Cn := CurrentChunk(Iff); + if not Assigned(Cn) then + begin + Continue; + end; + Len := Cn^.cn_Size; + if (Cn^.cn_Type = ID_FTXT) and (Cn^.cn_ID = ID_CHRS) and (Len > 0) then + begin + GetMem(Buf, Len + 1); + FillChar(Buf^, Len + 1, #0); + try + ReadChunkBytes(Iff, Buf, Len); + Result := Result + string(Buf); + finally + FreeMem(Buf); + end; + end; + end; + end; + CloseIff(Iff); + end; + CloseClipboard(PClipBoardHandle(iff^.iff_Stream)); + end; + FreeIFF(Iff); + end; +end; + +function PutTextToClip(ClipUnit: Byte; Text: string): Boolean; +var + Iff: PIffHandle; + TText: string; + Len: Integer; +begin + Result := False; + Iff := AllocIff; + if Assigned(Iff) then + begin + Iff^.iff_Stream := LongWord(OpenClipboard(ClipUnit)); + if Iff^.iff_Stream <> 0 then + begin + InitIffAsClip(iff); + if OpenIff(Iff, IFFF_WRITE) = 0 then + begin + if PushChunk(iff, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN) = 0 then + begin + if PushChunk(iff, 0, ID_CHRS, IFFSIZE_UNKNOWN) = 0 then + begin + Len := Length(Text); + TText := Text + #0; + Result := WriteChunkBytes(iff, @(TText[1]), Len) = len; + PopChunk(iff); + end; + PopChunk(iff); + end; + CloseIff(iff); + end; + CloseClipboard(PClipBoardHandle(iff^.iff_Stream)); + end; + FreeIFF(Iff); + end; +end; + +end. diff --git a/packages/arosunits/src/diskfont.pas b/packages/arosunits/src/diskfont.pas new file mode 100755 index 0000000000..82cf201814 --- /dev/null +++ b/packages/arosunits/src/diskfont.pas @@ -0,0 +1,139 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + diskfont.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit diskfont; + +{$mode objfpc} + +INTERFACE + +uses exec, agraphics,utility; + +const + + MAXFONTPATH = 256; + +type + + pFontContents = ^tFontContents; + tFontContents = record + fc_FileName : Array [0..MAXFONTPATH-1] of Char; + fc_YSize : Word; + fc_Style : Byte; + fc_Flags : Byte; + end; + + + pTFontContents = ^tTFontContents; + tTFontContents = record + tfc_FileName : Array[0..MAXFONTPATH-3] of Char; + tfc_TagCount : Word; + + tfc_YSize : Word; + tfc_Style, + tfc_Flags : Byte; + END; + + +const + + FCH_ID = $0f00; + TFCH_ID = $0f02; + OFCH_ID = $0f03; + + + +type + + pFontContentsHeader = ^tFontContentsHeader; + tFontContentsHeader = record + fch_FileID : Word; + fch_NumEntries : Word; + end; + +const + + DFH_ID = $0f80; + MAXFONTNAME = 32; + +type + + pDiskFontHeader = ^tDiskFontHeader; + tDiskFontHeader = record + dfh_DF : tNode; + dfh_FileID : Word; + dfh_Revision : Word; + dfh_Segment : Longint; + dfh_Name : Array [0..MAXFONTNAME-1] of Char; + dfh_TF : tTextFont; + end; + +const + + AFB_MEMORY = 0; + AFF_MEMORY = 1; + AFB_DISK = 1; + AFF_DISK = 2; + AFB_SCALED = 2; + AFF_SCALED = $0004; + AFB_BITMAP = 3; + AFF_BITMAP = $0008; + AFB_TAGGED = 16; + AFF_TAGGED = $10000; + + +type + + pAvailFonts = ^tAvailFonts; + tAvailFonts = record + af_Type : Word; + af_Attr : tTextAttr; + end; + + pTAvailFonts = ^tTAvailFonts; + tTAvailFonts = record + taf_Type : Word; + taf_Attr : tTTextAttr; + end; + + pAvailFontsHeader = ^tAvailFontsHeader; + tAvailFontsHeader = record + afh_NumEntries : Word; + end; + +const + DISKFONTNAME : PChar = 'diskfont.library'; + +var + DiskfontBase: PLibrary; + +function AvailFonts(Buffer: PChar; BufBytes: LongInt; Flags: LongInt): LongInt; syscall DiskfontBase 6; +procedure DisposeFontContents(FontContentsHeader: PFontContentsHeader); syscall DiskfontBase 8; +function NewFontContents(FontsLock: BPTR; FontName: PChar): PFontContentsHeader; syscall DiskfontBase 7; +function NewScaledDiskFont(SourceFont: PTextFont; DestTextAttr: PTextAttr): PDiskFontHeader; syscall DiskfontBase 9; +function OpenDiskFont(TextAttr: PTextAttr): PTextFont; syscall DiskfontBase 5; +//function GetDiskFontCtrl(tagid: LongInt): LongInt; +//procedure SetDiskFontCtrlA(taglist: PTagItem); + +implementation + +initialization + DiskfontBase := OpenLibrary(DISKFONTNAME, 36); +finalization + CloseLibrary(DiskfontBase); +end. + + + diff --git a/packages/arosunits/src/exec.pas b/packages/arosunits/src/exec.pas new file mode 100644 index 0000000000..0bfe3a8a80 --- /dev/null +++ b/packages/arosunits/src/exec.pas @@ -0,0 +1,1533 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + exec.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{ + +missing: + MemHeaderExt (difficult struct) + ETask Substructure in TTask + +defines: + AROS_NEED_LONG_ALIGN = ???? + AROS_FLAVOUR_BINCOMPAT = Bincompat mode + AROS_MORPHOS_COMPATIBLE = ???? +} + + +unit Exec; + +interface + +type + APTR = Pointer; + CONST_APTR = Pointer; + LONG = LongInt; + ULONG = LongWord; + QUAD = Int64; + UQUAD = QWord; + IPTR = NativeUInt; + PIPTR = ^IPTR; + STRPTR = PChar; + CONST_STRPTR = PChar; + BPTR = Pointer; + BSTR = Pointer; + BOOL = SmallInt; + UWORD = Word; + WORDBITS = Word; + LONGBITS = LongWord; + PLONGBITS = ^LONGBITS; + UBYTE = Byte; + PULONG = PLongWord; + PAPTR = ^APTR; + PLONG = PLongInt; + PaSmallInt = PSmallInt; + + +// TagItem moved from Utilities to exec because needed for records + +{ This data type may propagate through the system for more general use. + In the meantime, it is used as a general mechanism of extensible data + arrays for parameter specification and property inquiry (coming soon + to a display controller near you). + In practice, an array (or chain of arrays) of TagItems is used.} +type + Tag = LongWord; + PTag = ^Tag; + + PTagItem = ^TTagItem; + TTagItem = record + ti_Tag: Tag; + ti_Data: IPTR; + end; + PPTagItem = ^PTagItem; + +const + TAG_USER = 1 shl 31; // differentiates user tags from system tags +// END of part from utility move + +const +// There is a problem with Boolean vaules in taglists, just use this for now instead + LTrue : LongInt = 1; + LFalse: LongInt = 0; + +type +// List Node Structure. Each member in a list starts with a Node + PNode = ^TNode; + +{$ifdef AROS_FLAVOUR_BINCOMPAT} + TNode = record + ln_Succ, // Pointer to next (successor) + ln_Pred : PNode; // Pointer to previous (predecessor) + ln_Type : Byte; + ln_Pri : ShortInt; // Priority, for sorting + ln_Name : STRPTR; // ID string, null terminated + end; // Note: smallint aligned +{$else} + TNode = Record + ln_Succ, // Pointer to next (successor) + ln_Pred : PNode; // Pointer to previous (predecessor) + ln_Name : STRPTR; // ID string, null terminated + ln_Type : Byte; + ln_Pri : ShortInt; // Priority, for sorting + End; // Note: smallint aligned +{$endif} + +// minimal node -- no type checking possible + + PMinNode = ^TMinNode; + TMinNode = Record + mln_Succ, + mln_Pred : PMinNode; + End; + +{ + Note: Newly initialized IORequests, and software interrupt structures + used with Cause(), should have type NT_UNKNOWN. The OS will assign a type + when they are first used. + } + +// ----- Node Types for LN_TYPE ----- + +Const + + NT_UNKNOWN = 0; // Unknown Node + NT_TASK = 1; // Exec task + NT_INTERRUPT = 2; // Interrupt + NT_DEVICE = 3; // Device + NT_MSGPORT = 4; // Message Port + NT_MESSAGE = 5; // Indicates message currently pending + NT_FREEMSG = 6; + NT_REPLYMSG = 7; // Message has been replied + NT_RESOURCE = 8; + NT_LIBRARY = 9; + NT_MEMORY = 10; + NT_SOFTINT = 11; // Internal flag used by SoftInits + NT_FONT = 12; + NT_PROCESS = 13; // AmigaDOS Process + NT_SEMAPHORE = 14; + NT_SIGNALSEM = 15; // signal semaphores + NT_BOOTNODE = 16; + NT_KICKMEM = 17; + NT_GRAPHICS = 18; + NT_DEATHMESSAGE = 19; + NT_HIDD = 20; // AROS Specific + + NT_USER = 254; // User node types work down from here + NT_EXTENDED = 255; + +{ This file defines Exec system lists, which are used to link + various things. Exec provides several routines to handle list + processing (defined at the bottom of this file), so you can + use these routines to save yourself the trouble of writing a list + package.} +type +// Normal, full featured list + PList = ^TList; + TList = record + lh_Head: PNode; + lh_Tail: PNode; + lh_TailPred: PNode; + lh_Type: Byte; + l_pad: Byte; + end; + +// minimum list -- no type checking possible + PMinList = ^TMinList; + TMinList = record + mlh_Head: PMinNode; + mlh_Tail: PMinNode; + mlh_TailPred: PMinNode; + end; + +{******************************************************************** +* +* Format of the alert error number: +* +* +-+-------------+----------------+--------------------------------+ +* |D| SubSysId | General Error | SubSystem Specific Error | +* +-+-------------+----------------+--------------------------------+ +* 1 7 bits 8 bits 16 bits +* +* D: DeadEnd alert +* SubSysId: indicates ROM subsystem number. +* General Error: roughly indicates what the error was +* Specific Error: indicates more detail +*********************************************************************} + +{ ******************************************************************** +* +* General Alerts +* +* For example: timer.device cannot open math.library would be $05038015 +* +* Alert(AN_TimerDev|AG_OpenLib|AO_MathLib); +* +********************************************************************} + +const +// General Types + AT_DeadEnd = $80000000; // Alert that crashes + AT_Recovery = $00000000; // Alert that returns + +// General purpose alert codes } + AG_NoMemory = $00010000; + AG_MakeLib = $00020000; + AG_OpenLib = $00030000; + AG_OpenDev = $00040000; + AG_OpenRes = $00050000; + AG_IOError = $00060000; + AG_NoSignal = $00070000; + AG_BadParm = $00080000; + AG_CloseLib = $00090000; // usually too many closes + AG_CloseDev = $000A0000; // or a mismatched close + AG_ProcCreate = $000B0000; // Process creation failed + +{********************************************************************* +* +* Hardware/CPU specific alerts: They may show without the 8 at the +* front of the number. These are CPU/68000 specific. See 68$0 +* programmer's manuals for more details. +* +*********************************************************************} + ACPU_BusErr = $80000002; // Hardware bus fault/access error + ACPU_AddressErr = $80000003; // Illegal address access (ie: odd) + ACPU_InstErr = $80000004; // Illegal instruction + ACPU_DivZero = $80000005; // Divide by zero + ACPU_CHK = $80000006; // Check instruction error + ACPU_TRAPV = $80000007; // TrapV instruction error + ACPU_PrivErr = $80000008; // Privilege violation error + ACPU_Trace = $80000009; // Trace error + ACPU_LineA = $8000000A; // Line 1010 Emulator error + ACPU_LineF = $8000000B; // Line 1111 Emulator error + ACPU_Format = $8000000E; // Stack frame format error + ACPU_Spurious = $80000018; // Spurious interrupt error + ACPU_AutoVec1 = $80000019; // AutoVector Level 1 interrupt error + ACPU_AutoVec2 = $8000001A; // AutoVector Level 2 interrupt error + ACPU_AutoVec3 = $8000001B; // AutoVector Level 3 interrupt error + ACPU_AutoVec4 = $8000001C; // AutoVector Level 4 interrupt error + ACPU_AutoVec5 = $8000001D; // AutoVector Level 5 interrupt error + ACPU_AutoVec6 = $8000001E; // AutoVector Level 6 interrupt error + ACPU_AutoVec7 = $8000001F; // AutoVector Level 7 interrupt error + +// alert libraries + AO_ExecLib = $00008001; + AO_GraphicsLib = $00008002; + AO_LayersLib = $00008003; + AO_Intuition = $00008004; + AO_MathLib = $00008005; + AO_DOSLib = $00008007; + AO_RAMLib = $00008008; + AO_IconLib = $00008009; + AO_ExpansionLib = $0000800A; + AO_DiskfontLib = $0000800B; + AO_UtilityLib = $0000800C; + AO_KeyMapLib = $0000800D; +// alert devices + AO_AudioDev = $00008010; + AO_ConsoleDev = $00008011; + AO_GamePortDev = $00008012; + AO_KeyboardDev = $00008013; + AO_TrackDiskDev = $00008014; + AO_TimerDev = $00008015; +// alert resources + AO_CIARsrc = $00008020; + AO_DiskRsrc = $00008021; + AO_MiscRsrc = $00008022; +// alert other + AO_BootStrap = $00008030; + AO_Workbench = $00008031; + AO_DiskCopy = $00008032; + AO_GadTools = $00008033; + AO_Unknown = $00008035; +// AROS Additions, start at $40 + AO_ArosLib = $00008040; + AO_OOPLib = $00008041; + AO_HiddLib = $00008042; + +{******************************************************************** +* +* Specific Alerts: +* +********************************************************************} +// exec.library + AN_ExecLib = $01000000; + AN_ExcptVect = $01000001; // 68000 exception vector checksum (obs.) + AN_BaseChkSum = $01000002; // Execbase checksum (obs.) + AN_LibChkSum = $01000003; // Library checksum failure + AN_MemCorrupt = $81000005; // Corrupt memory list detected in FreeMem + AN_IntrMem = $81000006; // No memory for interrupt servers + AN_InitAPtr = $01000007; // InitStruct() of an APTR source (obs.) + AN_SemCorrupt = $01000008; // A semaphore is in an illegal state at ReleaseSempahore() + AN_FreeTwice = $01000009; // Freeing memory already freed + AN_BogusExcpt = $8100000A; // illegal 68k exception taken (obs.) + AN_IOUsedTwice = $0100000B; // Attempt to reuse active IORequest + AN_MemoryInsane = $0100000C; // Sanity check on memory list failed during AvailMem(MEMF_LARGEST) + AN_IOAfterClose = $0100000D; // IO attempted on closed IORequest + AN_StackProbe = $0100000E; // Stack appears to extend out of range + AN_BadFreeAddr = $0100000F; // Memory header not located. [ Usually an invalid address passed to FreeMem() ] + AN_BadSemaphore = $01000010; // An attempt was made to use the old message semaphores. + +// dos.library + AN_DOSLib = $07000000; + AN_StartMem = $07010001; // no memory at startup + AN_EndTask = $07000002; // EndTask didn't + AN_QPktFail = $07000003; // Qpkt failure + AN_AsyncPkt = $07000004; // Unexpected packet received + AN_FreeVec = $07000005; // Freevec failed + AN_DiskBlkSeq = $07000006; // Disk block sequence error + AN_BitMap = $07000007; // Bitmap corrupt + AN_KeyFree = $07000008; // Key already free + AN_BadChkSum = $07000009; // Invalid checksum + AN_DiskError = $0700000A; // Disk Error + AN_KeyRange = $0700000B; // Key out of range + AN_BadOverlay = $0700000C; // Bad overlay + AN_BadInitFunc = $0700000D; // Invalid init packet for cli/shell + AN_FileReclosed = $0700000E; // A filehandle was closed more than once + +// graphics.library + AN_GraphicsLib = $02000000; + AN_GfxNoMem = $82010000; // graphics out of memory + AN_GfxNoMemMspc = $82010001; // MonitorSpec alloc, no memory + AN_LongFrame = $82010006; // long frame, no memory + AN_ShortFrame = $82010007; // short frame, no memory + AN_TextTmpRas = $02010009; // text, no memory for TmpRas + AN_BltBitMap = $8201000A; // BltBitMap, no memory + AN_RegionMemory = $8201000B; // regions, memory not available + AN_MakeVPort = $82010030; // MakeVPort, no memory + AN_GfxNewError = $0200000C; + AN_GfxFreeError = $0200000D; + AN_GfxNoLCM = $82011234; // emergency memory not available + AN_ObsoleteFont = $02000401; // unsupported font description used + +// intuition.library + AN_Intuition = $04000000; + AN_GadgetType = $84000001; // unknown gadget type + AN_BadGadget = $04000001; // Recovery form of AN_GadgetType + AN_CreatePort = $84010002; // create port, no memory + AN_ItemAlloc = $04010003; // item plane alloc, no memory + AN_SubAlloc = $04010004; // sub alloc, no memory + AN_PlaneAlloc = $84010005; // plane alloc, no memory + AN_ItemBoxTop = $84000006; // item box top < RelZero + AN_OpenScreen = $84010007; // open screen, no memory + AN_OpenScrnRast = $84010008; // open screen, raster alloc, no memory + AN_SysScrnType = $84000009; // open sys screen, unknown type + AN_AddSWGadget = $8401000A; // add SW gadgets, no memory + AN_OpenWindow = $8401000B; // open window, no memory + AN_BadState = $8400000C; // Bad State Return entering Intuition + AN_BadMessage = $8400000D; // Bad Message received by IDCMP + AN_WeirdEcho = $8400000E; // Weird echo causing incomprehension + AN_NoConsole = $8400000F; // couldn't open the Console Device + AN_NoISem = $04000010; // Intuition skipped obtaining a sem + AN_ISemOrder = $04000011; // Intuition obtained a sem in bad order + +// System utility library + AN_UtilityLib = $34000000; + +// layers.library + AN_LayersLib = $03000000; + AN_LayersNoMem = $83010000; // layers out of memory + +// math.library + AN_MathLib = $05000000; + +// expansion.library + AN_ExpansionLib = $0A000000; + AN_BadExpansionFree = $0A000001; // freeed free region + +// ramlib.library + AN_RAMLib = $08000000; + AN_BadSegList = $08000001; // no overlays in library seglists + +// diskfont.library + AN_DiskfontLib = $0B000000; + +// icon.library + AN_IconLib = $09000000; + +// Gadtools.library toolkit for Intuition + AN_GadTools = $33000000; + +// audio.device + AN_AudioDev = $10000000; + +// console.device + AN_ConsoleDev = $11000000; + AN_NoWindow = $11000001; // Console can't open initial window + +// gameport.device + AN_GamePortDev = $12000000; + +// keyboard.device + AN_KeyboardDev = $13000000; + +// ------ trackdisk.device + AN_TrackDiskDev = $14000000; + AN_TDCalibSeek = $14000001; // calibrate: seek error + AN_TDDelay = $14000002; // delay: error on timer wait + +// timer.device + AN_TimerDev = $15000000; + AN_TMBadReq = $15000001; // bad request + AN_TMBadSupply = $15000002; // power supply -- no 50/60Hz ticks + +// cia.resource + AN_CIARsrc = $20000000; + +// disk.resource + AN_DiskRsrc = $21000000; + AN_DRHasDisk = $21000001; // get unit: already has disk + AN_DRIntNoAct = $21000002; // interrupt: no active unit + +// misc.resource + AN_MiscRsrc = $22000000; + +// bootstrap + AN_BootStrap = $30000000; + AN_BootError = $30000001; // boot code returned an error + +// Workbench + AN_Workbench = $31000000; + AN_NoFonts = $B1000001; + AN_WBBadStartupMsg1 = $31000001; + AN_WBBadStartupMsg2 = $31000002; + AN_WBBadIOMsg = $31000003; + AN_WBReLayoutToolMenu = $B1010009; + +// DiskCopy + AN_DiskCopy = $32000000; + +// For use by any application that needs it + AN_Unknown = $35000000; + +// AROS Additions + AN_Aros = $40000000; + AN_OOP = $41000000; + +// Hidd Subsystem + AN_Hidd = $42000000; + AN_HiddNoRoot = $C2000001; + +const + IOERR_OPENFAIL = -1; // device/unit failed to open + IOERR_ABORTED = -2; // request terminated early [after AbortIO()] + IOERR_NOCMD = -3; // command not supported by device + IOERR_BADLENGTH = -4; // not a valid length (usually IO_LENGTH) + IOERR_BADADDRESS = -5; // invalid address (misaligned or bad range) + IOERR_UNITBUSY = -6; // device opens ok, but requested unit is busy + IOERR_SELFTEST = -7; // hardware failed self-test + +type + PResident = ^TResident; + TResident = record + rt_MatchWord: Word; // smallint to match on (ILLEGAL) + rt_MatchTag: PResident; // pointer to the above + rt_EndSkip: APTR; // address to continue scan + rt_Flags: Byte; // various tag flags + rt_Version: Byte; // release version number + rt_Type: Byte; // type of module (NT_mumble) + rt_Pri: ShortInt; // initialization priority + rt_Name: CONST_STRPTR; // pointer to node name + rt_IdString: CONST_STRPTR;// pointer to ident string + rt_Init: APTR; // pointer to init code + rt_Revision: Word; // Extension taken over from MorphOS. Only valid if RTF_EXTENDED is set + rt_Tags: PTagItem; // PTagItem + end; + +const + RTC_MATCHWORD = $4AFC; + + RTF_COLDSTART = $01; + RTF_SINGLETASK = $02; + RTF_AFTERDOS = $04; + RTF_AUTOINIT = $80; + + RTF_EXTENDED = $40; // MorphOS extension: extended structure fields are valid + +// Compatibility: + + RTW_NEVER = $00; + RTW_COLDSTART = $01; + + RTT_STARTUP = TAG_USER + $04AF1234; + +type +//****** MemChunk **************************************************** + PMemChunk = ^TMemChunk; + TMemChunk = record + mc_Next: PMemChunk; // pointer to next chunk + mc_Bytes: IPTR; // chunk byte size + end; + +//****** MemHeader *************************************************** + PMemHeader = ^TMemHeader; + TMemHeader = record + mh_Node: TNode; + mh_Attributes: Word; // characteristics of this region + mh_First: PMemChunk; // first free region + mh_Lower, // lower memory bound + mh_Upper: APTR; // upper memory bound+1 + mh_Free: ULONG; // total number of free bytes + end; + +//****** MemEntry **************************************************** + PMemEntry = ^TMemEntry; + TMemEntry = record + me_Un: record + case LongInt of + 0: (meu_Reqs: ULONG); + 1: (meu_Addr: APTR); + end; + me_Length: ULONG; + end; + +//****** MemList ***************************************************** +// Note: sizeof(TMemList) includes the size of the first MemEntry + PMemList = ^TMemList; + TMemList = record + ml_Node: TNode; + ml_NumEntries: Word; // number of entries in this struct + ml_ME: array [0..0] of TMemEntry; // the first entry + End; + +// Memory Requirement Types +// See the AllocMem() documentation for details +const + MEMF_ANY = $0; // Any type of memory will do + MEMF_PUBLIC = 1 shl 0; + MEMF_CHIP = 1 shl 1; + MEMF_FAST = 1 shl 2; + MEMF_EXECUTABLE = 1 shl 4; // AmigaOS 4 Compatible + MEMF_LOCAL = 1 shl 8; + MEMF_24BITDMA = 1 shl 9; // DMAable memory within 24 bits of address + MEMF_KICK = 1 shl 10; // Memory that can be used for KickTags + MEMF_31BIT = 1 shl 12; // Low address space (<2GB). Effective only on 64 bit machines. + MEMF_CLEAR = 1 shl 16; // Explicitly clear memory after allocation + MEMF_LARGEST = 1 shl 17; + MEMF_REVERSE = 1 shl 18; + MEMF_TOTAL = 1 shl 19; // AvailMem: return total size of memory + MEMF_HWALIGNED = 1 shl 20; // For AllocMem() - align address and size to physical page boundary + MEMF_SEM_PROTECTED = 1 shl 20; // For CreatePool() - add semaphore protection to the pool + MEMF_NO_EXPUNGE = 1 shl 31; // AllocMem: Do not cause expunge on failure + + MEM_BLOCKSIZE = 8; + MEM_BLOCKMASK = MEM_BLOCKSIZE-1; + +{$ifdef CPU64} + MEMF_PHYSICAL_MASK = MEMF_PUBLIC or MEMF_CHIP or MEMF_FAST or MEMF_LOCAL or MEMF_24BITDMA or MEMF_KICK or MEMF_31BIT; +{$else} + MEMF_PHYSICAL_MASK = MEMF_PUBLIC or MEMF_CHIP or MEMF_FAST or MEMF_LOCAL or MEMF_24BITDMA or MEMF_KICK; +{$endif} + +type +//***** MemHandlerData ********************************************* +// Note: This structure is *READ ONLY* and only EXEC can create it! + PMemHandlerData = ^TMemHandlerData; + TMemHandlerData = record + memh_RequestSize, // Requested allocation size + memh_RequestFlags, // Requested allocation flags + memh_Flags: ULONG; // Flags (see below) + end; + +const + MEMHF_RECYCLE = 1; // 0 = First time, 1 = recycle +//***** Low Memory handler return values ************************** + MEM_ALL_DONE = -1; // We did all we could do + MEM_DID_NOTHING = 0; // Nothing we could do... + MEM_TRY_AGAIN = 1; // We did some, try the allocation again + +type + PInterrupt = ^TInterrupt; + TInterrupt = record + is_Node: TNode; + is_Data: APTR; // Server data segment + is_Code: Pointer; // Server code entry + end; + +// PRIVATE + PIntVector = ^TIntVector; + TIntVector = record // For EXEC use ONLY! + iv_Data: APTR; + iv_Code: Pointer; + iv_Node: PNode; + end; + +// PRIVATE + PSoftIntList = ^TSoftIntList; + TSoftIntList = record // For EXEC use ONLY! + sh_List: TList; + sh_Pad : Word; + end; + +const + SIH_PRIMASK = $F0; +// this is a fake INT definition, used only for AddIntServer and the like + INTB_NMI = 15; + INTF_NMI = 1 shl 15; +{ Offset of kernel interrupt vectors. + Usage: + AddIntServer(INTB_KERNEL + irq, irq_handler); + RemIntServer(INTB_KERNEL + irq, irq_handler); } + INTB_KERNEL = 16; + +{ This file defines ports and messages, which are used for inter- + task communications using the routines defined toward the + bottom of this file.} +type +//****** MsgPort ***************************************************** + PMsgPort = ^TMsgPort; + TMsgPort = record + mp_Node: TNode; + mp_Flags: Byte; + mp_SigBit: Byte; { signal bit number } + mp_SigTask: Pointer; { task to be signalled (TaskPtr) } + mp_MsgList: TList; { message linked list } + end; + +//****** Message ***************************************************** + PMessage = ^TMessage; + TMessage = record + mn_Node: TNode; + mn_ReplyPort: PMsgPort; // message reply port + mn_Length: Word; // message len in bytes (include the size of the Message structure in the length) + end; + +//****** MagicMessage *********************************************** + PMagicMessage = ^TMagicMessage; + TMagicMessage = record + mn_Node: TNode; + mn_ReplyPort: PMsgPort; // message reply port + mn_Length: Word; // total message length, in bytes (include the size of the Message structure in the length) + mn_Magic: ULONG; // can be used to figure out the message sender + mn_Version: ULONG; // version can be used to extend a message in later versions + end; + +{ definition for entry Magic in Messages + Magic is introduced to prevent Multiple Ports, for example if you´r using + ScreenNotifications and DecorNotifications you must have two Ports as long + as you cannot figure out which Messsage ist posted. With Magic this is no + problem.} +const + MAGIC_DECORATOR = $8000001; + MAGIC_SCREENNOTIFY = $8000002; + +{ Every Amiga Task has one of these Task structures associated with it. + To find yours, use FindTask(Nil). AmigaDOS processes tack a few more + values on to the end of this structure, which is the difference between + Tasks and Processes.} +type + PTask = ^TTask; + TTask = record + tc_Node: TNode; + tc_Flags: Byte; + tc_State: Byte; + tc_IDNestCnt: Shortint; // intr disabled nesting + tc_TDNestCnt: Shortint; // task disabled nesting + tc_SigAlloc: ULONG; // sigs allocated + tc_SigWait: ULONG; // sigs we are waiting for + tc_SigRecvd: ULONG; // sigs we have received + tc_SigExcept: ULONG; // sigs we will take excepts for + tc_TrapAlloc: Word; // traps allocated + tc_TrapAble: Word; // traps enabled + tc_ExceptData: APTR; // points to except data + tc_ExceptCode: APTR; // points to except code + tc_TrapData: APTR; // points to trap data + tc_TrapCode: APTR; // points to trap code + tc_SPReg: APTR; // stack pointer + tc_SPLower: APTR; // stack lower bound + tc_SPUpper: APTR; // stack upper bound + 2 + tc_Switch: Pointer; // task losing CPU + tc_Launch: Pointer; // task getting CPU + tc_MemEntry: TList; // allocated memory + tc_UserData: APTR; // per task data + end; + +// Stack swap structure as passed to StackSwap() + PStackSwapStruct = ^TStackSwapStruct; + TStackSwapStruct = record + stk_Lower: APTR; // Lowest byte of stack + stk_Upper: APTR; // Upper end of stack (size + Lowest) + stk_Pointer: APTR; // Stack pointer at switch point + end; + + PStackSwapArgs = ^TStackSwapArgs; + TStackSwapArgs = record + Args: array[0..7] of IPTR; + end; + +const +//----- Flag Bits ------------------------------------------ + TB_PROCTIME = 0; + TB_ETASK = 3; + TB_STACKCHK = 4; + TB_EXCEPT = 5; + TB_SWITCH = 6; + TB_LAUNCH = 7; + + TF_PROCTIME = 1; + TF_ETASK = 8; + TF_STACKCHK = 16; + TF_EXCEPT = 32; + TF_SWITCH = 64; + TF_LAUNCH = 128; + +//----- Task States (tc_State) --------------------------------- + TS_INVALID = 0; + TS_ADDED = 1; + TS_RUN = 2; + TS_READY = 3; + TS_WAIT = 4; + TS_EXCEPT = 5; + TS_REMOVED = 6; + +//----- Predefined Signals ------------------------------------- + SIGB_ABORT = 0; + SIGB_CHILD = 1; + SIGB_BLIT = 4; // Note: same as SIGB_SINGLE + SIGB_SINGLE = 4; // Note: same as SIGB_BLIT + SIGB_INTUITION = 5; + SIGB_NET = 7; + SIGB_DOS = 8; + + SIGF_ABORT = 1; + SIGF_CHILD = 2; + SIGF_BLIT = 16; + SIGF_SINGLE = 16; + SIGF_INTUITION = 32; + SIGF_NET = 128; + SIGF_DOS = 256; + +type +{$ifdef AROS_MORPHOS_COMPATIBLE} + TETask = record + Message: TMessage; + Parent: PTask; // Pointer to task + UniqueID: ULONG; + Children: TMinList; // List of children + TrapAlloc: Word; + TrapAble: Word; + Result1: ULONG; // First result + Result2: APTR; // Result data pointer (AllocVec) + MsgPort: TMsgPort; + MemPool: Pointer; + Reserved: array[0..1] of Pointer; + RegFrame: Pointer; + // Internal fields follow + end; +{$else} +// Extended Task structure + TETask = record + et_Message: TMessage; + et_Parent: APTR; // Pointer to parent task + et_UniqueID: ULONG; + et_Children: TMinList; // List of children + et_TrapAlloc: Word; + et_TrapAble: Word; + et_Result1: ULONG; // First result + et_Result2: APTR; // Result data pointer (AllocVec) + et_TaskMsgPort: TMsgPort; + et_Compatibility: array[0..3] of APTR; // Reserve this space for compiled software to access iet_startup and iet_acpd + et_MemPool: Pointer; // Task's private memory pool +{$ifdef aros} + et_Reserved: array[0..0] of IPTR; // MorphOS Private + et_TaskStorage: Pointer; // Task Storage Slots +{$else} + et_Reserved: array[0..1] of IPTR; // MorphOS Private +{$endif} + et_RegFrame: Pointer; + // Internal fields follow + end; +{$endif} + +const +// Return codes from new child functions + CHILD_NOTNEW = 1; // function not called from a new style task + CHILD_NOTFOUND = 2; // Child not found + CHILD_EXITED = 3; // Child has exited + CHILD_ACTIVE = 4; // Child is currently active and running + + TASKTAG_Dummy = TAG_USER + $100000; + TASKTAG_ERROR = TASKTAG_Dummy + 0; + TASKTAG_CODETYPE = TASKTAG_Dummy + 1; + TASKTAG_PC = TASKTAG_Dummy + 2; + TASKTAG_FINALPC = TASKTAG_Dummy + 3; + TASKTAG_STACKSIZE = TASKTAG_Dummy + 4; + TASKTAG_NAME = TASKTAG_Dummy + 6; + TASKTAG_USERDATA = TASKTAG_Dummy + 7; + TASKTAG_PRI = TASKTAG_Dummy + 8; + TASKTAG_POOLPUDDLE = TASKTAG_Dummy + 9; + TASKTAG_POOLTHRESH = TASKTAG_Dummy + 10; + TASKTAG_ARG1 = TASKTAG_Dummy + 16; + TASKTAG_ARG2 = TASKTAG_Dummy + 17; + TASKTAG_ARG3 = TASKTAG_Dummy + 18; + TASKTAG_ARG4 = TASKTAG_Dummy + 19; + TASKTAG_ARG5 = TASKTAG_Dummy + 20; + TASKTAG_ARG6 = TASKTAG_Dummy + 21; + TASKTAG_ARG7 = TASKTAG_Dummy + 22; + TASKTAG_ARG8 = TASKTAG_Dummy + 23; + TASKTAG_STARTUPMSG = TASKTAG_Dummy + 24; + TASKTAG_TASKMSGPORT = TASKTAG_Dummy + 25; + TASKTAG_FLAGS = TASKTAG_Dummy + 26; + TASKTAG_TCBEXTRASIZE = TASKTAG_Dummy + 28; + + TASKERROR_OK = 0; + TASKERROR_NOMEMORY = 1; +// Actions for ShutdownA() + SD_ACTION_POWEROFF = 0; + SD_ACTION_COLDREBOOT = 1; + +// mp_Flags: Port arrival actions (PutMsg) +const + PF_ACTION = 7; // Mask + PA_SIGNAL = 0; // Signal task in mp_SigTask + PA_SOFTINT = 1; // Signal SoftInt in mp_SoftInt/mp_SigTask + PA_IGNORE = 2; // Ignore arrival + PA_CALL = 3; // Call function in mp_SigTask. This was never + // documented on AmigaOS and was never defined + // but would work for mp_Flags = 3 + PA_FASTCALL = 4; // AROS extension. Like PA_SOFTINT, calls an + // Interrupt in mp_SoftInt, but passes the + // message as the third argument without doesn't + // add it to the message list and so doesn't + // require any locking, task switching or + // Disable()/Enable() pairs */ +// Semaphore +type +// This is the structure used to request a signal semaphore + PSemaphoreRequest = ^TSemaphoreRequest; + TSemaphoreRequest = record + sr_Link: TMinNode; + sr_Waiter: PTask; + end; + +// The actual semaphore itself + PSignalSemaphore = ^TSignalSemaphore; + TSignalSemaphore = record + ss_Link: TNode; + ss_NestCount: SmallInt; + ss_WaitQueue: TMinList; + ss_MultipleLink: TSemaphoreRequest; + ss_Owner: PTask; + ss_QueueCount: SmallInt; + end; + +// Semaphore procure message for Procure/Vacate + PSemaphoreMessage = ^TSemaphoreMessage; + TSemaphoreMessage = record + ssm_Message: TMessage; + ssm_Semaphore: PSignalSemaphore; + end; + +{ not in aros? + PSemaphore = ^TSemaphore; + TSemaphore = record + sm_MsgPort: TMsgPort; + sm_Bids: SmallInt; + end; +} +const + SM_SHARED = 1; + SM_EXCLUSIVE = 0; + +//------ Special Constants --------------------------------------- + LIB_RESERVED = 4; // Exec reserves the first 4 vectors + LIB_VECTSIZE = 6; // Each library entry takes 6 bytes + LIB_BASE = (-LIB_VECTSIZE); + LIB_USERDEF = (LIB_BASE-(LIB_RESERVED*LIB_VECTSIZE)); + LIB_NONSTD = (LIB_USERDEF); +//------ Standard functions -------------------------------------- + LIB_OPEN = LIB_BASE * 1; + LIB_CLOSE = LIB_BASE * 2; + LIB_EXPUNGE = LIB_BASE * 3; + LIB_EXTFUNC = LIB_BASE * 4; // for future expansion +type +//------ Library Base Structure ---------------------------------- +// Also used for Devices and some Resources + PLibrary = ^TLibrary; + TLibrary = record + lib_Node: TNode; + lib_Flags, + lib_pad: Byte; + lib_NegSize, // number of bytes before library + lib_PosSize, // number of bytes after library + lib_Version, // major + lib_Revision: Word; // minor +{$ifdef AROS_NEED_LONG_ALIGN} + lib_pad1: Word; +{$endif} + lib_IdString: STRPTR; // ASCII identification + lib_Sum: ULONG; // the checksum itself + lib_OpenCnt: Word; // number of current opens +{$ifdef AROS_NEED_LONG_ALIGN} + lib_pad2: Word; +{$endif} + + end; // Warning: size is not a longword multiple! + +const +// lib_Flags bit definitions (all others are system reserved) + LIBF_SUMMING = 1 shl 0; // we are currently checksumming + LIBF_CHANGED = 1 shl 1; // we have just changed the lib + LIBF_SUMUSED = 1 shl 2; // set if we should bother to sum + LIBF_DELEXP = 1 shl 3; // delayed expunge + +// ID numbers for Exec/TaggedOpenLibrary + TAGGEDOPEN_GRAPHICS = 1; + TAGGEDOPEN_LAYERS = 2; + TAGGEDOPEN_INTUITION = 3; + TAGGEDOPEN_DOS = 4; + TAGGEDOPEN_ICON = 5; + TAGGEDOPEN_EXPANSION = 6; + TAGGEDOPEN_UTILITY = 7; + TAGGEDOPEN_KEYMAP = 8; + TAGGEDOPEN_GADTOOLS = 9; + TAGGEDOPEN_WORKBENCH = 10; + +{ This file defines the constants and types required to use + Amiga device IO routines, which are also defined here.} +type +//***** Device **************************************************** + PDevice = ^TDevice; + TDevice = record + dd_Library: TLibrary; + end; + +//***** Unit ****************************************************** + PUnit = ^TUnit; + TUnit = record + unit_MsgPort: TMsgPort; // queue for unprocessed messages instance of msgport is recommended + unit_flags, + unit_pad : Byte; + unit_OpenCnt: Word; // number of active opens + end; + +const + UNITF_ACTIVE = 1 shl 0; + UNITF_INTASK = 1 shl 1; + +type + PIORequest = ^TIORequest; + TIORequest = record + io_Message: TMessage; + io_Device: PDevice; // device node pointer + io_Unit: PUnit; // unit (driver private) + io_Command: Word; // device command + io_Flags: Byte; + io_Error: ShortInt; // error or warning num + end; + + PIOStdReq = ^TIOStdReq; + TIOStdReq = record + io_Message: TMessage; + io_Device: PDevice; // device node pointe + io_Unit: PUnit; // unit (driver private) + io_Command: Word; // device command + io_Flags: Byte; + io_Error: ShortInt; // error or warning num + io_Actual: ULONG; // actual number of bytes transferred + io_Length: ULONG; // requested number bytes transferred + io_Data: APTR; // points to data area + io_Offset: ULONG; // offset for block structured devices + end; + +// library vector offsets for device reserved vectors +const + DEV_BEGINIO = -30; + DEV_ABORTIO = -36; +{ io_Flags defined bits } + IOB_QUICK = 0; + IOF_QUICK = 1; + + CMD_INVALID = 0; + CMD_RESET = 1; + CMD_READ = 2; + CMD_WRITE = 3; + CMD_UPDATE = 4; + CMD_CLEAR = 5; + CMD_STOP = 6; + CMD_START = 7; + CMD_FLUSH = 8; + CMD_NONSTD = 9; + +{ Definition of the Exec library base structure (pointed to by location 4). +** Most fields are not to be viewed or modified by user programs. Use +** extreme caution. + } + +type + PArosSupportBase = ^TArosSupportBase; + TArosSupportBase = record + StdOut: Pointer; + kPrintfPtr: Pointer; + rkPrintfPtr: Pointer; + vkPrintfPtr: Pointer; + DebugConfig: Pointer; + end; + + PExecBase = ^TExecBase; + TExecBase = record +// Standard Library Structure + LibNode: TLibrary; // Standard library node +{ ******* Static System Variables ******* } + SoftVer: Word; // kickstart release number (obs.) + LowMemChkSum: SmallInt; // checksum of 68000 trap vectors + ChkBase: ULONG; // system base pointer complement + ColdCapture, // coldstart soft capture vector + CoolCapture, // coolstart soft capture vector + WarmCapture, // warmstart soft capture vector + SysStkUpper, // system stack base (upper bound) + SysStkLower: APTR; // top of system stack (lower bound) + MaxLocMem: IPTR; // top of chip memory + DebugEntry, // global debugger entry point + DebugData, // global debugger data segment + AlertData, // alert data segment + MaxExtMem: APTR; // top of extended mem, or null if none + ChkSum: Word; // for all of the above (minus 2) +//***** Interrupt Related ***************************************** + IntVects: array[0..15] of TIntVector; +//***** Dynamic System Variables ********************************** + ThisTask: PTask; // pointer to current task (readable) + IdleCount, // idle counter + DispCount: ULONG; // dispatch coutner + Quantum, // time slice quantum + Elapsed, // current quantum ticks + SysFlags: Word; // misc internal system flags + IDNestCnt, // interrupt disable nesting count + TDNestCnt: Shortint; // task disable nesting count + AttnFlags, // special attention flags (readable) + AttnResched : Word; // rescheduling attention + ResModules, // resident module array pointer + TaskTrapCode, + TaskExceptCode, + TaskExitCode: APTR; + TaskSigAlloc: ULONG; + TaskTrapAlloc: Word; +//***** System Lists (private!) ******************************* + MemList, + ResourceList, + DeviceList, + IntrList, + LibList, + PortList, + TaskReady, + TaskWait: TList; + SoftInts: array[0..4] of TSoftIntList; +//***** Other Globals ****************************************** + LastAlert: array[0..3] of LONG; + { these next two variables are provided to allow + ** system developers to have a rough idea of the + ** period of two externally controlled signals -- + ** the time between vertical blank interrupts and the + ** external line rate (which is counted by CIA A's + ** "time of day" clock). In general these values + ** will be 50 or 60, and may or may not track each + ** other. These values replace the obsolete AFB_PAL + ** and AFB_50HZ flags.} + VBlankFrequency, // (readable) + PowerSupplyFrequency: Byte; // (readable) + SemaphoreList: TList; + { these next two are to be able to kickstart into user ram. + ** KickMemPtr holds a singly linked list of MemLists which + ** will be removed from the memory list via AllocAbs. If + ** all the AllocAbs's succeeded, then the KickTagPtr will + ** be added to the rom tag list.} + KickMemPtr, // ptr to queue of mem lists + KickTagPtr, // ptr to rom tag queue + KickCheckSum: APTR; // checksum for mem and tags +//***** Miscellaneous Stuff ************************************* + ex_Pad0: Word; + ex_LaunchPoint: IPTR; + ex_RamLibPrivate: APTR; + { The next ULONG contains the system "E" clock frequency, + ** expressed in Hertz. The E clock is used as a timebase for + ** the Amiga's 8520 I/O chips. (E is connected to "02"). + ** Typical values are 715909 for NTSC, or 709379 for PAL.} + ex_EClockFrequency, // (readable) + ex_CacheControl, // Private to CacheControl calls + ex_TaskID: ULONG; // Next available task ID + ex_Reserved1: array[0..4] of ULONG; + ex_MMULock: Pointer; // private + ex_Reserved2: array[0..1] of ULONG; + ex_DebugFlags: ULONG; + { The following list and data element are used + exec's low memory handler...} + ex_MemHandlers : tMinList; // The handler list + ex_MemHandler : Pointer; // Private! handler pointer +//***** Additional AROS fields ********************************** + DebugArosBase : PArosSupportBase; + end; + +{ ***** Bit defines for AttnFlags (see above) ***************************** } +{ Processors and Co-processors: } +const + AFB_68010 = 0; { also set for 68020 } + AFB_68020 = 1; { also set for 68030 } + AFB_68030 = 2; { also set for 68040 } + AFB_68040 = 3; + AFB_68881 = 4; { also set for 68882 } + AFB_68882 = 5; + AFB_FPU40 = 6; { Set if 68040 FPU } + AFB_68060 = 7; + AFB_ADDR32 = 14; // AROS extension, CPU has 32-bit addressing + AFB_PRIVATE = 15; // see below + + AFF_68010 = 1 shl 0; + AFF_68020 = 1 shl 1; + AFF_68030 = 1 shl 2; + AFF_68040 = 1 shl 3; + AFF_68881 = 1 shl 4; + AFF_68882 = 1 shl 5; + AFF_FPU40 = 1 shl 6; + AFF_68060 = 1 shl 7; + AFF_ADDR32 = 1 shl 14; + AFF_PRIVATE = 1 shl 15; +{* +* AFB_PRIVATE is actually FPU presence flag with architecture-specific meaning: +* m68k - Set if any FPU type detected. AmigaOS-compatible, however considered private. +* ARM - Set if VFP is present. Considered public. +* Others - not used. +*} + AFB_FPU = AFB_PRIVATE; + AFF_FPU = AFF_PRIVATE ; + +//* SysFlags. Private and AROS-specific. */ + SFF_SoftInt = 1 shl 5; // There is a software interrupt pending + SFF_QuantumOver = 1 shl 13; // Task's time slice is over + +// AttnResched. AmigaOS(tm)-compatible, but private. + ARF_AttnSwitch = 1 shl 7; // Delayed task switch pending + +{ ***** Selected flag definitions for Cache manipulation calls ********* } + + CACRF_EnableI = 1 shl 0; // Enable instruction cache + CACRF_FreezeI = 1 shl 1; // Freeze instruction cache + CACRF_ClearI = 1 shl 3; // Clear instruction cache + CACRF_IBE = 1 shl 4; // Instruction burst enable + CACRF_EnableD = 1 shl 8; // 68030 Enable data cache + CACRF_FreezeD = 1 shl 9; // 68030 Freeze data cache + CACRF_ClearD = 1 shl 11; // 68030 Clear data cache + CACRF_DBE = 1 shl 12; // 68030 Data burst enable + CACRF_WriteAllocate = 1 shl 13; // 68030 Write-Allocate mode (must always be set!) + CACRF_InvalidateD = 1 shl 15; + CACRF_EnableE = 1 shl 30; + CACRF_CopyBack = 1 shl 31; + + DMA_Continue = 1 shl 1; // Continuation flag for CachePreDMA + DMA_NoModify = 1 shl 2; // Set if DMA does not update memory + DMA_ReadFromRAM = 1 shl 3; // Set if DMA goes *FROM* RAM to device + +{* + * Runtime debug output flags, MorphOS-compatible. + * Most of them are reserved for now. + *} + EXECDEBUGF_INITRESIDENT = $00000001; // Single resident initialization + EXECDEBUGF_INITCODE = $00000002; // Kickstart initialization + EXECDEBUGF_FINDRESIDENT = $00000004; // Resident search + EXECDEBUGF_CREATELIBRARY = $00000010; // Library creation + EXECDEBUGF_SETfunction = $00000020; // Library function patching + EXECDEBUGF_NEWSETfunction = $00000040; + EXECDEBUGF_CHIPRAM = $00000080; + EXECDEBUGF_ADDTASK = $00000100; // Task creation + EXECDEBUGF_REMTASK = $00000200; // Task removal + EXECDEBUGF_GETTASKATTR = $00000400; + EXECDEBUGF_SETTASKATTR = $00000800; + EXECDEBUGF_EXCEPTHANDLER = $00001000; + EXECDEBUGF_ADDDOSNODE = $00002000; + EXECDEBUGF_PCI = $00004000; + EXECDEBUGF_RAMLIB = $00008000; + EXECDEBUGF_NOLOGSERVER = $00010000; + EXECDEBUGF_NOLOGWINDOW = $00020000; + EXECDEBUGF_LOGFILE = $00040000; + EXECDEBUGF_LOGKPRINTF = $00080000; + EXECDEBUGF_PERMMEMTRACK = $00100000; + EXECDEBUGF_MEMTRACK = $00200000; + EXECDEBUGF_CYBERGUARDDEADLY = $00400000; + EXECDEBUGF_LOGEXTENDED = $00800000; + EXECDEBUGF_LOADSEG = $01000000; + EXECDEBUGF_UNLOADSEG = $02000000; + EXECDEBUGF_PPCSTART = $04000000; + EXECDEBUGF_CGXDEBUG = $08000000; + EXECDEBUGF_INVZEROPAGE = $10000000; + EXECDEBUGF_INIT = $40000000; // Generic system startup + EXECDEBUGF_LOG = $80000000; + +// The base node in an AVL tree. Embed this within your object a-la exec ListNode +type + PPAVLNode = ^PAVLNode; + PAVLNode = ^TAVLNode; + TAVLNode = record + avl_link: array[0..1] of PAVLNode; + avl_parent: PAVLNode; + avl_balance: LONG; + end; + AVLKey = Pointer; + + PAVLNODECOMP = ^AVLNODECOMP; + AVLNODECOMP = APTR; + PAVLKEYCOMP = ^AVLKEYCOMP; + AVLKEYCOMP = APTR; + + +const +// Magic constants for RawDoFmt() anv VNewRawDoFmt() to be given as PutChProc + RAWFMTFUNC_STRING = 0; // Output to string given in PutChData + RAWFMTFUNC_SERIAL = 1; // Output to debug log (usually serial port) + RAWFMTFUNC_COUNT = 2; // Just count characters, PutChData is a pointer to the counter (ULONG *) + +// function headers +function AbortIO(IORequest: PIORequest): LongInt; syscall AOS_ExecBase 80; +procedure AddDevice(Device: PDevice); syscall AOS_ExecBase 72; +procedure AddHead(List: PList; Node: PNode); syscall AOS_ExecBase 40; +procedure AddIntServer(IntNumber: ULONG; Interrupt_: PInterrupt); syscall AOS_ExecBase 28; +procedure AddLibrary(Library_: PLibrary); syscall AOS_ExecBase 66; +procedure AddMemHandler(MemHandler: PInterrupt); syscall AOS_ExecBase 129; +procedure AddMemList(Size: ULONG; Attributes: ULONG; Pri: LongInt; Base: APTR; const Name: STRPTR); syscall AOS_ExecBase 103; +procedure AddPort(Port: PMsgPort); syscall AOS_ExecBase 59; +function AddResetCallback(ResetCallback: PInterrupt): LongBool; syscall AOS_ExecBase 167; +procedure AddResource(Resource: APTR); syscall AOS_ExecBase 81; +procedure AddSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 100; +procedure AddTail(List: PList; Node: PNode); syscall AOS_ExecBase 41; +function AddTask(Task: PTask; const InitialPC: APTR; const FinalPC: APTR): PTask; syscall AOS_ExecBase 47; deprecated; +procedure Alert(AlertNum: ULONG); syscall AOS_ExecBase 18; +function AllocAbs(ByteSize: ULONG; Location: APTR): APTR; syscall AOS_ExecBase 34; +function Allocate(FreeList: PMemHeader; ByteSize: ULONG): PMemHeader; syscall AOS_ExecBase 31; +function AllocEntry(Entry: PMemList): PMemList; syscall AOS_ExecBase 37; +function AllocMem(ByteSize: ULONG; Requirements: ULONG): APTR; syscall AOS_ExecBase 33; +function AllocPooled(PoolHeader: APTR; MemSize: ULONG): APTR; syscall AOS_ExecBase 118; +function AllocSignal(SignalNum: LongInt): ShortInt; syscall AOS_ExecBase 55; +function AllocTrap(TrapNum: LongInt): LongInt; syscall AOS_ExecBase 57; +function AllocVec(ByteSize: ULONG; Requirements: ULONG): APTR; syscall AOS_ExecBase 114; +function AllocVecPooled(Pool: APTR; Size: ULONG): APTR; syscall AOS_ExecBase 149; +function AttemptSemaphore(SigSem: PSignalSemaphore): ULONG; syscall AOS_ExecBase 96; +function AttemptSemaphoreShared(SigSem: PSignalSemaphore): ULONG; syscall AOS_ExecBase 120; +function AvailMem(Requirements: ULONG): ULONG; syscall AOS_ExecBase 36; +function AVL_AddNode(Root: PPAVLNode; Node: PAVLNode; Func: PAVLNODECOMP): PAVLNode; syscall AOS_ExecBase 139; +function AVL_FindFirstNode(Root: PAVLNode): PAVLNode; syscall AOS_ExecBase 147; +function AVL_FindLastNode(Root: PAVLNode): PAVLNode; syscall AOS_ExecBase 148; +function AVL_FindNode(Root: PPAVLNode; Key: AVLKey; Func: PAVLNODECOMP): PAVLNode; syscall AOS_ExecBase 142; +function AVL_FindPrevNodeByAddress(Node: PAVLNode): PAVLNode; syscall AOS_ExecBase 143; +function AVL_FindPrevNodeByKey(Node: PAVLNode; Key: AVLKey): PAVLNode; syscall AOS_ExecBase 144; +function AVL_FindNextNodeByAddress(Node: PAVLNode): PAVLNode; syscall AOS_ExecBase 145; +function AVL_FindNextNodeByKey(Node: PAVLNode; Key: AVLKey): PAVLNode; syscall AOS_ExecBase 146; +function AVL_RemNodeByAddress(Root: PPAVLNode; Node: PAVLNode): PAVLNode; syscall AOS_ExecBase 140; +function AVL_RemNodeByKey(Root: PPAVLNode; Key: AVLKey; Func: PAVLNODECOMP): PAVLNode; syscall AOS_ExecBase 141; +procedure CacheClearE(Address: APTR; Length: ULONG; Caches: ULONG); syscall AOS_ExecBase 107; +procedure CacheClearU;syscall AOS_ExecBase 106; +function CacheControl(CacheBits: ULONG; CacheMask: ULONG): ULONG; syscall AOS_ExecBase 108; +procedure CachePostDMA(const Address: APTR; var Length: ULONG; Flags: ULONG); syscall AOS_ExecBase 128; +function CachePreDMA(const Address: APTR; var Length: ULONG; Flags: ULONG): APTR; syscall AOS_ExecBase 127; +procedure Cause(Interrupt_: PInterrupt); syscall AOS_ExecBase 30; +function CheckIO(IORequest: PIORequest): PIORequest; syscall AOS_ExecBase 78; +procedure ChildFree(Tid: ULONG); syscall AOS_ExecBase 123; +function ChildOrphan(Tid: ULONG): ULONG; syscall AOS_ExecBase 124; +function ChildStatus(Tid: ULONG): ULONG; syscall AOS_ExecBase 125; +function ChildWait(Tid: ULONG): IPTR; syscall AOS_ExecBase 126; +procedure CloseDevice(IORequest: PIORequest); syscall AOS_ExecBase 75; +procedure CloseLibrary(Library_: PLibrary); syscall AOS_ExecBase 69; +procedure ColdReboot; syscall AOS_ExecBase 121; +procedure CopyMem(const Source: APTR; Dest: APTR; Size: ULONG); syscall AOS_ExecBase 104; +procedure CopyMemQuick(const Source: APTR; Dest: APTR; Size: ULONG); syscall AOS_ExecBase 105; +function CreateIORequest(const IOReplyPort: PMsgPort; Size: ULONG): APTR; syscall AOS_ExecBase 109; +function CreateMsgPort: PMsgPort; syscall AOS_ExecBase 111; +function CreatePool(Requirements: ULONG; PuddleSize: ULONG; ThreshSize: ULONG): APTR; syscall AOS_ExecBase 116; +procedure Deallocate(FreeList: PMemHeader; MemoryBlock: APTR; ByteSize: ULONG); syscall AOS_ExecBase 32; +procedure Debug(Flags: ULONG); syscall AOS_ExecBase 19; +procedure DeleteIORequest(IORequest: APTR); syscall AOS_ExecBase 110; +procedure DeleteMsgPort(Port: PMsgPort); syscall AOS_ExecBase 112; +procedure DeletePool(PoolHeader: APTR); syscall AOS_ExecBase 117; +procedure Disable; syscall AOS_ExecBase 20; +procedure Dispatch; syscall AOS_ExecBase 10; +function DoIO(IORequest: PIORequest): LongInt; syscall AOS_ExecBase 76; +procedure Enable; syscall AOS_ExecBase 21; +procedure Enqueue(List: PList; Node: PNode); syscall AOS_ExecBase 45; +procedure ExecFreeMem(MemoryBlock: APTR; ByteSize: ULONG); syscall AOS_ExecBase 35; +procedure ExecInsert(List: PList; Node: PNode; Pred: PNode); syscall AOS_ExecBase 39; +procedure ExecException; syscall AOS_ExecBase 11; +function FindName(List: PList; const Name: PChar): PNode; syscall AOS_ExecBase 46; +function FindPort(const Name: STRPTR): PMsgPort; syscall AOS_ExecBase 65; +function FindResident(const Name: PChar): PResident; syscall AOS_ExecBase 16; +function FindSemaphore(const SigSem: STRPTR): PSignalSemaphore; syscall AOS_ExecBase 99; +function FindTask(const Name: STRPTR): PTask; syscall AOS_ExecBase 49; +procedure Forbid; syscall AOS_ExecBase 22; +procedure FreeEntry(Entry: PMemList); syscall AOS_ExecBase 38; +procedure FreePooled(PoolHeader: APTR; Memory: APTR; MemSize: ULONG); syscall AOS_ExecBase 119; +procedure FreeSignal(SignalNum: LongInt); syscall AOS_ExecBase 56; +procedure FreeTrap(TrapNum: LongInt); syscall AOS_ExecBase 58; +procedure FreeVec(MemoryBlock: APTR); syscall AOS_ExecBase 115; +procedure FreeVecPooled(Pool: APTR; Memory: APTR); syscall AOS_ExecBase 150; +function GetCC: Word; syscall AOS_ExecBase 88; +function GetMsg(Port: PMsgPort): PMessage; syscall AOS_ExecBase 62; +procedure InitCode(StartClass: ULONG; Version: ULONG); syscall AOS_ExecBase 12; +function InitResident(const Resident_: PResident; SegList: ULONG): PResident; syscall AOS_ExecBase 17; +procedure InitSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 93; +procedure InitStruct(const InitTable: APTR; Memory: APTR; Size: ULONG); syscall AOS_ExecBase 13; +procedure MakeFunctions(const Target: APTR; const FunctionArray: CONST_APTR; const FuncDispBase: CONST_APTR); syscall AOS_ExecBase 15; +function MakeLibrary(const FuncInit: APTR; const StructInit: APTR; LibInit: TProcedure; DataSize: ULONG; SegList: ULONG): PLibrary; syscall AOS_ExecBase 14; +function NewAddTask(Task: PTask; InitialPC: APTR; FinalPC: APTR; TagList: PTagItem): APTR; syscall AOS_ExecBase 152; +function NewAddTaskA(TagList: PTagItem): APTR; syscall AOS_ExecBase 153; +function NewAllocEntry(Entry: PMemList; var Return_Entry: PMemList; var Return_Flags: ULONG): LongBool; syscall AOS_ExecBase 151; +function NewStackSwap(NewStack: PStackSwapStruct; Function_: APTR; Args: PStackSwapArgs): IPTR; syscall AOS_ExecBase 134; +function ObtainQuickVector(InterruptCode: APTR): ULONG; syscall AOS_ExecBase 131; +procedure ObtainSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 94; +procedure ObtainSemaphoreList(SigSem: PList); syscall AOS_ExecBase 97; +procedure ObtainSemaphoreShared(SigSem: PSignalSemaphore); syscall AOS_ExecBase 113; +function OldOpenLibrary(const LibName: STRPTR): PLibrary; syscall AOS_ExecBase 68; deprecated; +function OpenDevice(const DevName: STRPTR; UnitNumber: ULONG; IORequest: PIORequest; Flags: ULONG): LongInt; syscall AOS_ExecBase 74; +function OpenLibrary(const LibName: STRPTR; Version: ULONG): PLibrary; syscall AOS_ExecBase 92; +function OpenResource(const ResName: STRPTR): APTR; syscall AOS_ExecBase 83; +procedure Permit; syscall AOS_ExecBase 23; +function PrepareContext(Task: PTask; EntryPoint: APTR; FallBack: APTR; TagList: PTagItem): LongBool; syscall AOS_ExecBase 6; +function Procure(SigSem: PSignalSemaphore; BidMsg: PSemaphoreMessage): ULONG; syscall AOS_ExecBase 90; +procedure PutMsg(Port: PMsgPort; Message: PMessage); syscall AOS_ExecBase 61; +function RawDoFmt(const FormatString: STRPTR; const DataStream: APTR; PutChProc: TProcedure; PutChData: APTR): APTR; syscall AOS_ExecBase 87; +procedure RawIOInit; syscall AOS_ExecBase 84; +function RawMayGetChar: LongInt; syscall AOS_ExecBase 85; +procedure RawMayPutChar(Cha: Byte); syscall AOS_ExecBase 86; +function ReadGayle: ULONG; syscall AOS_ExecBase 136; +procedure ReleaseSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 95; +procedure ReleaseSemaphoreList(SigSem: PList); syscall AOS_ExecBase 98; +procedure RemDevice(Device: PDevice); syscall AOS_ExecBase 73; +function RemHead(List: PList): PNode; syscall AOS_ExecBase 43; +procedure RemIntServer(IntNumber: ULONG; Interrupt_: PInterrupt); syscall AOS_ExecBase 29; +procedure RemLibrary(Library_: PLibrary); syscall AOS_ExecBase 67; +procedure RemMemHandler(MemHandler: PInterrupt); syscall AOS_ExecBase 130; +procedure Remove(Node: PNode); syscall AOS_ExecBase 42; +procedure RemPort(Port: PMsgPort); syscall AOS_ExecBase 60; +procedure RemResetCallback(ResetCallback: PInterrupt); syscall AOS_ExecBase 168; +procedure RemResource(Resource: APTR); syscall AOS_ExecBase 82; +procedure RemSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 101; +function RemTail(List: PList): PNode; syscall AOS_ExecBase 44; +procedure RemTask(Task: PTask); syscall AOS_ExecBase 48; +procedure ReplyMsg(Message: PMessage); syscall AOS_ExecBase 63; +procedure Reschedule(Task: PTask); syscall AOS_ExecBase 8; +procedure SendIO(IORequest: PIORequest); syscall AOS_ExecBase 77; +function SetExcept(NewSignals: ULONG; SignalSet: ULONG): ULONG; syscall AOS_ExecBase 52; +function SetFunction(Library_: PLibrary; FuncOffset: LongInt; NewFunction: TProcedure): APTR; syscall AOS_ExecBase 70; +function SetIntVector(IntNumber: LongInt; const Interrupt_: PInterrupt): PInterrupt; syscall AOS_ExecBase 27; +function SetSignal(NewSignals: ULONG; SignalSet: ULONG): ULONG; syscall AOS_ExecBase 51; +function SetSR(NewSR: ULONG; Mask: ULONG): ULONG; syscall AOS_ExecBase 24; +function SetTaskPri(Task: PTask; Priority: LongInt): ShortInt; syscall AOS_ExecBase 50; +function ShutdownA(Action: ULONG): ULONG; syscall AOS_ExecBase 173; +procedure Signal(Task: PTask; SignalSet: ULONG); syscall AOS_ExecBase 54; +procedure StackSwap(NewStack: PStackSwapStruct); syscall AOS_ExecBase 122; deprecated; +procedure SumKickData; syscall AOS_ExecBase 102; +procedure SumLibrary(Library_: PLibrary); syscall AOS_ExecBase 71; +function SuperState: APTR; syscall AOS_ExecBase 25; +function Supervisor(UserFunction: TProcedure): ULONG; syscall AOS_ExecBase 5; +procedure Switch; syscall AOS_ExecBase 9; +function TaggedOpenLibrary(Tag: LongInt): APTR; syscall AOS_ExecBase 135; +function TypeOfMem(const Address: APTR): ULONG; syscall AOS_ExecBase 89; +procedure UserState(SysStack: APTR); syscall AOS_ExecBase 26; +procedure Vacate(SigSem: PSignalSemaphore; BidMsg: PSemaphoreMessage); syscall AOS_ExecBase 91; +function VNewRawDoFmt(const FormatString: STRPTR; PutChProc: TProcedure; PutChData: APTR; VaListStream: PChar): STRPTR; syscall AOS_ExecBase 137; +function Wait(SignalSet: ULONG): ULONG; syscall AOS_ExecBase 53; +function WaitIO(IORequest: PIORequest): LongInt; syscall AOS_ExecBase 79; +function WaitPort(Port: PMsgPort): PMessage; syscall AOS_ExecBase 64; + +function BitMask(no :ShortInt): LongInt; +// C Macros +procedure SetNodeName(Node: PNode; Name: PChar); +function GetNodeName(Node: PNode): PChar; + +procedure NewList(List: PList); +function GetHead(List: PList): PNode; inline; +function GetTail(List: PList): PNode; inline; +function GetSucc(Node: PNode): PNode; inline; +function GetPred(Node: PNode): PNode; inline; +function ListLength(List: PList): Integer; + +function IsListEmpty(List: PList): Boolean; + +function IsMinListEmpty(List: PMinList): Boolean; +function IsMsgPortEmpty( mp: pMsgPort): Boolean; + +type + TNodeProcedure = procedure(Node:PNode); // Procedure for ForEachNode; + +procedure ForEachNode(List:PList; NodeProc: TNodeProcedure); +procedure ForEachNodeSafe(List:PList; NodeProc: TNodeProcedure); + + +implementation + +// C Macros +procedure SetNodeName(Node: PNode; Name: PChar); inline; +begin + if Assigned(Node) then + Node^.ln_Name := Name; +end; + +function GetNodeName(Node: PNode): PChar; inline; +begin + if Assigned(Node) then + GetNodeName := Node^.ln_Name; +end; + +procedure NewList(List: PList); inline; +begin + if Assigned(List) then + begin + List^.lh_TailPred := PNode(List); + List^.lh_Tail := nil; + List^.lh_Head := @List^.lh_Tail; + end; +end; + +function GetHead(List: PList): PNode; inline; +begin + GetHead := nil; + if Assigned(List) then + begin + if Assigned(List^.lh_Head^.ln_Succ) then + GetHead := List^.lh_Head; + end; +end; + +function GetTail(List: PList): PNode; inline; +begin + GetTail := nil; + if Assigned(List) then + begin + if Assigned(List^.lh_TailPred^.ln_Pred) then + GetTail := List^.lh_TailPred; + end; +end; + +function GetSucc(Node: PNode): PNode; inline; +begin + GetSucc := nil; + if Assigned(Node) then + if Assigned(Node^.ln_Succ) then + if Assigned(Node^.ln_Succ^.ln_Succ) then + GetSucc := Node^.ln_Succ; +end; + +function GetPred(Node: PNode): PNode; inline; +begin + GetPred := nil; + if Assigned(Node) then + if Assigned(Node^.ln_Pred) then + if Assigned(Node^.ln_Pred^.ln_Pred) then + GetPred := Node^.ln_Pred; +end; + +procedure ForEachNode(List:PList; NodeProc: TNodeProcedure); +var + i: Integer; + Node: PNode; +begin + if not Assigned(List) or not Assigned(NodeProc) then + Exit; + Node := GetHead(List); + for i := 0 to ListLength(List) do + begin + if not Assigned(Node) then + Exit; + NodeProc(Node); + Node := GetSucc(Node); + end; +end; + +procedure ForEachNodeSafe(List:PList; NodeProc: TNodeProcedure); +var + i: Integer; + Node: PNode; + NextNode: PNode; +begin + if not Assigned(List) or not Assigned(NodeProc) then + Exit; + Node := GetHead(List); + if not Assigned(Node) then + Exit; + while Assigned(Node) do + begin + if not Assigned(Node) then + Exit; + NextNode := GetSucc(Node); + NodeProc(Node); + Node := NextNode; + end; +end; + +function ListLength(List: PList): Integer; +var + Current: PNode; + Next: PNode; +begin + Current := List^.lh_Head; + Next := Current^.ln_Succ; + ListLength := 0; + if Assigned(Current) and Assigned(Next) then + while Next = Current^.ln_Succ do + begin + Current := Next; + Next := Current^.ln_Succ; + Inc(ListLength); + if (not Assigned(Current)) or (not Assigned(Next)) then + Exit; + end; +end; + +function IsListEmpty(List: PList): Boolean; inline; +begin + IsListEmpty := True; + if Assigned(List) then + IsListEmpty := List^.lh_TailPred = PNode(List); +end; + +function IsMinListEmpty(List: PMinList): Boolean; +begin + IsMinListEmpty := True; + if Assigned(List) then + IsMinListEmpty := List^.mlh_TailPred = PMinNode(List); +end; + +function IsMsgPortEmpty(Mp: PMsgPort): Boolean; +begin + IsMsgPortEmpty := True; + if Assigned(mp) then + IsMsgPortEmpty := mp^.mp_MsgList.lh_TailPred = PNode(@(mp^.mp_MsgList)); +end; + +function BitMask(no :ShortInt): LongInt; +begin + BitMask := 1 shl no; +end; + +end. (* UNIT EXEC *) + + + + + diff --git a/packages/arosunits/src/hardware.pas b/packages/arosunits/src/hardware.pas new file mode 100644 index 0000000000..b078280fae --- /dev/null +++ b/packages/arosunits/src/hardware.pas @@ -0,0 +1,588 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + hardware definitions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{ + registers and bits in the Complex Interface Adapter (CIA) chip +} + +unit hardware; + +interface + +uses + Exec; + +{ + * ciaa is on an ODD Pointer (e.g. the low Byte) -- $bfe001 + * ciab is on an EVEN Pointer (e.g. the high Byte) -- $bfd000 + * + * do this to get the definitions: + * extern struct CIA ciaa, ciab; +} + +Type + + pCIA = ^tCIA; + tCIA = record + ciapra : Byte; + pad0 : Array [0..254] of Byte; + ciaprb : Byte; + pad1 : Array [0..254] of Byte; + ciaddra : Byte; + pad2 : Array [0..254] of Byte; + ciaddrb : Byte; + pad3 : Array [0..254] of Byte; + ciatalo : Byte; + pad4 : Array [0..254] of Byte; + ciatahi : Byte; + pad5 : Array [0..254] of Byte; + ciatblo : Byte; + pad6 : Array [0..254] of Byte; + ciatbhi : Byte; + pad7 : Array [0..254] of Byte; + ciatodlow : Byte; + pad8 : Array [0..254] of Byte; + ciatodmid : Byte; + pad9 : Array [0..254] of Byte; + ciatodhi : Byte; + pad10 : Array [0..254] of Byte; + unusedreg : Byte; + pad11 : Array [0..254] of Byte; + ciasdr : Byte; + pad12 : Array [0..254] of Byte; + ciaicr : Byte; + pad13 : Array [0..254] of Byte; + ciacra : Byte; + pad14 : Array [0..254] of Byte; + ciacrb : Byte; + end; + + +Const + +{ interrupt control register bit numbers } + + CIAICRB_TA = 0; + CIAICRB_TB = 1; + CIAICRB_ALRM = 2; + CIAICRB_SP = 3; + CIAICRB_FLG = 4; + CIAICRB_IR = 7; + CIAICRB_SETCLR = 7; + +{ control register A bit numbers } + + CIACRAB_START = 0; + CIACRAB_PBON = 1; + CIACRAB_OUTMODE = 2; + CIACRAB_RUNMODE = 3; + CIACRAB_LOAD = 4; + CIACRAB_INMODE = 5; + CIACRAB_SPMODE = 6; + CIACRAB_TODIN = 7; + +{ control register B bit numbers } + + CIACRBB_START = 0; + CIACRBB_PBON = 1; + CIACRBB_OUTMODE = 2; + CIACRBB_RUNMODE = 3; + CIACRBB_LOAD = 4; + CIACRBB_INMODE0 = 5; + CIACRBB_INMODE1 = 6; + CIACRBB_ALARM = 7; + +{ interrupt control register masks } + + CIAICRF_TA = $01; + CIAICRF_TB = $02; + CIAICRF_ALRM = $04; + CIAICRF_SP = $08; + CIAICRF_FLG = $10; + CIAICRF_IR = $80; + CIAICRF_SETCLR = $80; + +{ control register A register masks } + + CIACRAF_START = $01; + CIACRAF_PBON = $02; + CIACRAF_OUTMODE = $04; + CIACRAF_RUNMODE = $08; + CIACRAF_LOAD = $10; + CIACRAF_INMODE = $20; + CIACRAF_SPMODE = $40; + CIACRAF_TODIN = $80; + +{ control register B register masks } + + CIACRBF_START = $01; + CIACRBF_PBON = $02; + CIACRBF_OUTMODE = $04; + CIACRBF_RUNMODE = $08; + CIACRBF_LOAD = $10; + CIACRBF_INMODE0 = $20; + CIACRBF_INMODE1 = $40; + CIACRBF_ALARM = $80; + +{ control register B INMODE masks } + + CIACRBF_IN_PHI2 = 0; + CIACRBF_IN_CNT = CIACRBF_INMODE0; + CIACRBF_IN_TA = CIACRBF_INMODE1; + CIACRBF_IN_CNT_TA = CIACRBF_INMODE0 + CIACRBF_INMODE1; + +{ + * Port definitions -- what each bit in a cia peripheral register is tied to + } + +{ ciaa port A (0xbfe001) } + + CIAB_GAMEPORT1 = 7; { gameport 1, pin 6 (fire button*) } + CIAB_GAMEPORT0 = 6; { gameport 0, pin 6 (fire button*) } + CIAB_DSKRDY = 5; { disk ready* } + CIAB_DSKTRACK0 = 4; { disk on track 00* } + CIAB_DSKPROT = 3; { disk write protect* } + CIAB_DSKCHANGE = 2; { disk change* } + CIAB_LED = 1; { led light control (0==>bright) } + CIAB_OVERLAY = 0; { memory overlay bit } + +{ ciaa port B (0xbfe101) -- parallel port } + +{ ciab port A (0xbfd000) -- serial and printer control } + + CIAB_COMDTR = 7; { serial Data Terminal Ready* } + CIAB_COMRTS = 6; { serial Request to Send* } + CIAB_COMCD = 5; { serial Carrier Detect* } + CIAB_COMCTS = 4; { serial Clear to Send* } + CIAB_COMDSR = 3; { serial Data Set Ready* } + CIAB_PRTRSEL = 2; { printer SELECT } + CIAB_PRTRPOUT = 1; { printer paper out } + CIAB_PRTRBUSY = 0; { printer busy } + +{ ciab port B (0xbfd100) -- disk control } + + CIAB_DSKMOTOR = 7; { disk motorr* } + CIAB_DSKSEL3 = 6; { disk select unit 3* } + CIAB_DSKSEL2 = 5; { disk select unit 2* } + CIAB_DSKSEL1 = 4; { disk select unit 1* } + CIAB_DSKSEL0 = 3; { disk select unit 0* } + CIAB_DSKSIDE = 2; { disk side select* } + CIAB_DSKDIREC = 1; { disk direction of seek* } + CIAB_DSKSTEP = 0; { disk step heads* } + +{ ciaa port A (0xbfe001) } + + CIAF_GAMEPORT1 = 128; + CIAF_GAMEPORT0 = 64; + CIAF_DSKRDY = 32; + CIAF_DSKTRACK0 = 16; + CIAF_DSKPROT = 8; + CIAF_DSKCHANGE = 4; + CIAF_LED = 2; + CIAF_OVERLAY = 1; + +{ ciaa port B (0xbfe101) -- parallel port } + +{ ciab port A (0xbfd000) -- serial and printer control } + + CIAF_COMDTR = 128; + CIAF_COMRTS = 64; + CIAF_COMCD = 32; + CIAF_COMCTS = 16; + CIAF_COMDSR = 8; + CIAF_PRTRSEL = 4; + CIAF_PRTRPOUT = 2; + CIAF_PRTRBUSY = 1; + +{ ciab port B (0xbfd100) -- disk control } + + CIAF_DSKMOTOR = 128; + CIAF_DSKSEL3 = 64; + CIAF_DSKSEL2 = 32; + CIAF_DSKSEL1 = 16; + CIAF_DSKSEL0 = 8; + CIAF_DSKSIDE = 4; + CIAF_DSKDIREC = 2; + CIAF_DSKSTEP = 1; + + +Type + + pAudChannel = ^tAudChannel; + tAudChannel = record + ac_ptr : Pointer; { ptr to start of waveform data } + ac_len : Word; { length of waveform in words } + ac_per : Word; { sample period } + ac_vol : Word; { volume } + ac_dat : Word; { sample pair } + ac_pad : Array [0..1] of Word; { unused } + end; + + pSpriteDef = ^tSpriteDef; + tSpriteDef = record + pos : Word; + ctl : Word; + dataa : Word; + datab : Word; + end; + + pCustom = ^tCustom; + tCustom = record + bltddat : Word; + dmaconr : Word; + vposr : Word; + vhposr : Word; + dskdatr : Word; + joy0dat : Word; + joy1dat : Word; + clxdat : Word; + adkconr : Word; + pot0dat : Word; + pot1dat : Word; + potinp : Word; + serdatr : Word; + dskbytr : Word; + intenar : Word; + intreqr : Word; + dskpt : Pointer; + dsklen : Word; + dskdat : Word; + refptr : Word; + vposw : Word; + vhposw : Word; + copcon : Word; + serdat : Word; + serper : Word; + potgo : Word; + joytest : Word; + strequ : Word; + strvbl : Word; + strhor : Word; + strlong : Word; + bltcon0 : Word; + bltcon1 : Word; + bltafwm : Word; + bltalwm : Word; + bltcpt : Pointer; + bltbpt : Pointer; + bltapt : Pointer; + bltdpt : Pointer; + bltsize : Word; + pad2d : Byte; + bltcon0l : Byte; + bltsizv : Word; + bltsizh : Word; + bltcmod : Word; + bltbmod : Word; + bltamod : Word; + bltdmod : Word; + pad34 : Array [0..3] of Word; + bltcdat : Word; + bltbdat : Word; + bltadat : Word; + pad3b : Array [0..2] of Word; + deniseid : Word; + dsksync : Word; + cop1lc : Longint; + cop2lc : Longint; + copjmp1 : Word; + copjmp2 : Word; + copins : Word; + diwstrt : Word; + diwstop : Word; + ddfstrt : Word; + ddfstop : Word; + dmacon : Word; + clxcon : Word; + intena : Word; + intreq : Word; + adkcon : Word; + aud : Array [0..3] of tAudChannel; + bplpt : Array [0..7] of Pointer; + bplcon0 : Word; + bplcon1 : Word; + bplcon2 : Word; + bplcon3 : Word; + bpl1mod : Word; + bpl2mod : Word; + bplcon4 : Word; + clxcon2 : Word; + bpldat : Array [0..7] of Word; + sprpt : Array [0..7] of Pointer; + spr : Array [0..7] of tSpriteDef; + color : Array [0..31] of Word; + htotal : Word; + hsstop : Word; + hbstrt : Word; + hbstop : Word; + vtotal : Word; + vsstop : Word; + vbstrt : Word; + vbstop : Word; + sprhstrt : Word; + sprhstop : Word; + bplhstrt : Word; + bplhstop : Word; + hhposw : Word; + hhposr : Word; + beamcon0 : Word; + hsstrt : Word; + vsstrt : Word; + hcenter : Word; + diwhigh : Word; + padf3 : Array [0..10] of Word; + fmode : Word; + end; + +CONST +{ defines for beamcon register } + VARVBLANK = $1000; { Variable vertical blank enable } + LOLDIS = $0800; { long line disable } + CSCBLANKEN = $0400; { redirect composite sync } + VARVSYNC = $0200; { Variable vertical sync enable } + VARHSYNC = $0100; { Variable horizontal sync enable } + VARBEAM = $0080; { variable beam counter enable } + DISPLAYDUAL = $0040; { use UHRES pointer AND standard pointers } + DISPLAYPAL = $0020; { set decodes to generate PAL display } + VARCSYNC = $0010; { Variable composite sync enable } + CSBLANK = $0008; { Composite blank out to CSY* pin } + CSYNCTRUE = $0004; { composite sync TRUE signal } + VSYNCTRUE = $0002; { vertical sync TRUE } + HSYNCTRUE = $0001; { horizontal sync TRUE } + +{ new defines for bplcon0 } + USE_BPLCON3 = 1; + +{ new defines for bplcon2 } + BPLCON2_ZDCTEN = 1024; { colormapped genlock bit } + BPLCON2_ZDBPEN = 2048; { use bitplane as genlock bits } + BPLCON2_ZDBPSEL0 = 4096; { three bits to select one } + BPLCON2_ZDBPSEL1 = 8192; { of 8 bitplanes in } + BPLCON2_ZDBPSEL2 = 16384; { ZDBPEN genlock mode } + +{ defines for bplcon3 register } + BPLCON3_EXTBLNKEN = 1; { external blank enable } + BPLCON3_EXTBLKZD = 2; { external blank ored into trnsprncy } + BPLCON3_ZDCLKEN = 4; { zd pin outputs a 14mhz clock} + BPLCON3_BRDNTRAN = 16; { border is opaque } + BPLCON3_BRDNBLNK = 32; { border is opaque } + + +Const + + ADKB_SETCLR = 15; { standard set/clear bit } + ADKB_PRECOMP1 = 14; { two bits of precompensation } + ADKB_PRECOMP0 = 13; + ADKB_MFMPREC = 12; { use mfm style precompensation } + ADKB_UARTBRK = 11; { force uart output to zero } + ADKB_WORDSYNC = 10; { enable DSKSYNC register matching } + ADKB_MSBSYNC = 9; { (Apple GCR Only) sync on MSB for reading } + ADKB_FAST = 8; { 1 -> 2 us/bit (mfm), 2 -> 4 us/bit (gcr) } + ADKB_USE3PN = 7; { use aud chan 3 to modulate period of ?? } + ADKB_USE2P3 = 6; { use aud chan 2 to modulate period of 3 } + ADKB_USE1P2 = 5; { use aud chan 1 to modulate period of 2 } + ADKB_USE0P1 = 4; { use aud chan 0 to modulate period of 1 } + ADKB_USE3VN = 3; { use aud chan 3 to modulate volume of ?? } + ADKB_USE2V3 = 2; { use aud chan 2 to modulate volume of 3 } + ADKB_USE1V2 = 1; { use aud chan 1 to modulate volume of 2 } + ADKB_USE0V1 = 0; { use aud chan 0 to modulate volume of 1 } + + ADKF_SETCLR = $8000; + ADKF_PRECOMP1 = $4000; + ADKF_PRECOMP0 = $2000; + ADKF_MFMPREC = $1000; + ADKF_UARTBRK = $0800; + ADKF_WORDSYNC = $0400; + ADKF_MSBSYNC = $0200; + ADKF_FAST = $0100; + ADKF_USE3PN = $0080; + ADKF_USE2P3 = $0040; + ADKF_USE1P2 = $0020; + ADKF_USE0P1 = $0010; + ADKF_USE3VN = $0008; + ADKF_USE2V3 = $0004; + ADKF_USE1V2 = $0002; + ADKF_USE0V1 = $0001; + + ADKF_PRE000NS = 0; { 000 ns of precomp } + ADKF_PRE140NS = ADKF_PRECOMP0; { 140 ns of precomp } + ADKF_PRE280NS = ADKF_PRECOMP1; { 280 ns of precomp } + ADKF_PRE560NS = ADKF_PRECOMP0 + ADKF_PRECOMP1; { 560 ns of precomp } + + +Const + + HSIZEBITS = 6; + VSIZEBITS = 16 - HSIZEBITS; + HSIZEMASK = $3F; { 2^6 - 1 } + VSIZEMASK = $3FF; { 2^10 - 1 } + + MAXBYTESPERROW = 128; + +{ definitions for blitter control register 0 } + + ABC = $80; + ABNC = $40; + ANBC = $20; + ANBNC = $10; + NABC = $08; + NABNC = $04; + NANBC = $02; + NANBNC = $01; + +{ some commonly used operations } + + A_OR_B = ABC + ANBC + NABC + ABNC + ANBNC + NABNC; + A_OR_C = ABC + NABC + ABNC + ANBC + NANBC + ANBNC; + A_XOR_C = NABC + ABNC + NANBC + ANBNC; + A_TO_D = ABC + ANBC + ABNC + ANBNC; + + BC0B_DEST = 8; + BC0B_SRCC = 9; + BC0B_SRCB = 10; + BC0B_SRCA = 11; + BC0F_DEST = $100; + BC0F_SRCC = $200; + BC0F_SRCB = $400; + BC0F_SRCA = $800; + + BC1F_DESC = 2; { blitter descend direction } + + DEST = $100; + SRCC = $200; + SRCB = $400; + SRCA = $800; + + ASHIFTSHIFT = 12; { bits to right align ashift value } + BSHIFTSHIFT = 12; { bits to right align bshift value } + +{ definations for blitter control register 1 } + + LINEMODE = $01; + FILL_OR = $08; + FILL_XOR = $10; + FILL_CARRYIN = $04; + ONEDOT = $02; { one dot per horizontal line } + OVFLAG = $20; + SIGNFLAG = $40; + BLITREVERSE = $02; + + SUD = $10; + SUL = $08; + AUL = $04; + + OCTANT8 = 24; + OCTANT7 = 4; + OCTANT6 = 12; + OCTANT5 = 28; + OCTANT4 = 20; + OCTANT3 = 8; + OCTANT2 = 0; + OCTANT1 = 16; + +type + PBltNode = ^TBltNode; + TBltNode = record + n: Pbltnode; + function_: Pointer; + Stat: Byte; + BltSize: SmallInt; + BeamSync: smallint; + CleanUp: Pointer; + end; + +Const + +{ write definitions for dmaconw } + + DMAF_SETCLR = $8000; + DMAF_AUDIO = $000F; { 4 bit mask } + DMAF_AUD0 = $0001; + DMAF_AUD1 = $0002; + DMAF_AUD2 = $0004; + DMAF_AUD3 = $0008; + DMAF_DISK = $0010; + DMAF_SPRITE = $0020; + DMAF_BLITTER = $0040; + DMAF_COPPER = $0080; + DMAF_RASTER = $0100; + DMAF_MASTER = $0200; + DMAF_BLITHOG = $0400; + DMAF_ALL = $01FF; { all dma channels } + +{ read definitions for dmaconr } +{ bits 0-8 correspnd to dmaconw definitions } + + DMAF_BLTDONE = $4000; + DMAF_BLTNZERO = $2000; + + DMAB_SETCLR = 15; + DMAB_AUD0 = 0; + DMAB_AUD1 = 1; + DMAB_AUD2 = 2; + DMAB_AUD3 = 3; + DMAB_DISK = 4; + DMAB_SPRITE = 5; + DMAB_BLITTER = 6; + DMAB_COPPER = 7; + DMAB_RASTER = 8; + DMAB_MASTER = 9; + DMAB_BLITHOG = 10; + DMAB_BLTDONE = 14; + DMAB_BLTNZERO = 13; + + +Const + + INTB_SETCLR = 15; { Set/Clear control bit. Determines if bits } + { written with a 1 get set or cleared. Bits } + { written with a zero are allways unchanged } + INTB_INTEN = 14; { Master interrupt (enable only ) } + INTB_EXTER = 13; { External interrupt } + INTB_DSKSYNC = 12; { Disk re-SYNChronized } + INTB_RBF = 11; { serial port Receive Buffer Full } + INTB_AUD3 = 10; { Audio channel 3 block finished } + INTB_AUD2 = 9; { Audio channel 2 block finished } + INTB_AUD1 = 8; { Audio channel 1 block finished } + INTB_AUD0 = 7; { Audio channel 0 block finished } + INTB_BLIT = 6; { Blitter finished } + INTB_VERTB = 5; { start of Vertical Blank } + INTB_COPER = 4; { Coprocessor } + INTB_PORTS = 3; { I/O Ports and timers } + INTB_SOFTINT = 2; { software interrupt request } + INTB_DSKBLK = 1; { Disk Block done } + INTB_TBE = 0; { serial port Transmit Buffer Empty } + + + INTF_SETCLR = $8000; + INTF_INTEN = $4000; + INTF_EXTER = $2000; + INTF_DSKSYNC = $1000; + INTF_RBF = $0800; + INTF_AUD3 = $0400; + INTF_AUD2 = $0200; + INTF_AUD1 = $0100; + INTF_AUD0 = $0080; + INTF_BLIT = $0040; + INTF_VERTB = $0020; + INTF_COPER = $0010; + INTF_PORTS = $0008; + INTF_SOFTINT = $0004; + INTF_DSKBLK = $0002; + INTF_TBE = $0001; + +IMPLEMENTATION + +end. diff --git a/packages/arosunits/src/icon.pas b/packages/arosunits/src/icon.pas new file mode 100755 index 0000000000..1a4a21e7f8 --- /dev/null +++ b/packages/arosunits/src/icon.pas @@ -0,0 +1,301 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + icon.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit icon; + +{$mode delphi} + +interface + +uses + exec, workbench,utility,amigados, agraphics, intuition; +//,datatypes; + +const + ICONNAME : PChar = 'icon.library'; + + ICONA_Dummy = TAG_USER + $9000; // Start of icon.library tags + ICONA_ErrorCode = ICONA_Dummy + 1; // Errorcode (PLongInt) + ICONA_ErrorTagItem = ICONA_Dummy + 75; //Points to the tag item that caused the error (^PTagItem). +{Global options for IconControlA()} + { Screen to use for remapping Workbench icons to (PScreen) } + ICONCTRLA_SetGlobalScreen = ICONA_Dummy + 2; + ICONCTRLA_GetGlobalScreen = ICONA_Dummy + 3; + { Icon color remapping precision; defaults to PRECISION_ICON (LongInt) } + ICONCTRLA_SetGlobalPrecision = ICONA_Dummy + 4; + ICONCTRLA_GetGlobalPrecision = ICONA_Dummy + 5; + { Icon frame size dimensions (PRectange) } + ICONCTRLA_SetGlobalEmbossRect = ICONA_Dummy + 6; + ICONCTRLA_GetGlobalEmbossRect = ICONA_Dummy + 7; + { Render image without frame (BOOL) } + ICONCTRLA_SetGlobalFrameless = ICONA_Dummy + 8; + ICONCTRLA_GetGlobalFrameless = ICONA_Dummy + 9; + { Enable NewIcons support (BOOL) } + ICONCTRLA_SetGlobalNewIconsSupport = ICONA_Dummy + 10; + ICONCTRLA_GetGlobalNewIconsSupport = ICONA_Dummy + 11; + { Enable color icon support (BOOL) } + ICONCTRLA_SetGlobalColorIconSupport = ICONA_Dummy + 77; + ICONCTRLA_GetGlobalColorIconSupport = ICONA_Dummy + 78; + { Set/Get the hook to be called when identifying a file (PHook) } + ICONCTRLA_SetGlobalIdentifyHook = ICONA_Dummy + 12; + ICONCTRLA_GetGlobalIdentifyHook = ICONA_Dummy + 13; + { Set/get the maximum length of a file/drawer name supported + by icon.library (LONG). } + ICONCTRLA_SetGlobalMaxNameLength = ICONA_Dummy + 67; + ICONCTRLA_GetGlobalMaxNameLength = ICONA_Dummy + 68; + +{ Per icon local options for IconControlA() } + { Get the icon rendering masks (PLANEPTR) } + ICONCTRLA_GetImageMask1 = ICONA_Dummy + 14; + ICONCTRLA_GetImageMask2 = ICONA_Dummy + 15; + { Transparent image color; set to -1 if opaque } + ICONCTRLA_SetTransparentColor1 = ICONA_Dummy + 16; + ICONCTRLA_GetTransparentColor1 = ICONA_Dummy + 17; + ICONCTRLA_SetTransparentColor2 = ICONA_Dummy + 18; + ICONCTRLA_GetTransparentColor2 = ICONA_Dummy + 19; + { Image color palette (PColorRegister) } + ICONCTRLA_SetPalette1 = ICONA_Dummy + 20; + ICONCTRLA_GetPalette1 = ICONA_Dummy + 21; + ICONCTRLA_SetPalette2 = ICONA_Dummy + 22; + ICONCTRLA_GetPalette2 = ICONA_Dummy + 23; + { Size of image color palette (LongInt) } + ICONCTRLA_SetPaletteSize1 = ICONA_Dummy + 24; + ICONCTRLA_GetPaletteSize1 = ICONA_Dummy + 25; + ICONCTRLA_SetPaletteSize2 = ICONA_Dummy + 26; + ICONCTRLA_GetPaletteSize2 = ICONA_Dummy + 27; + { Image data; one by per pixel (PBYTE) } + ICONCTRLA_SetImageData1 = ICONA_Dummy + 28; + ICONCTRLA_GetImageData1 = ICONA_Dummy + 29; + ICONCTRLA_SetImageData2 = ICONA_Dummy + 30; + ICONCTRLA_GetImageData2 = ICONA_Dummy + 31; + { Render image without frame (BOOL) } + ICONCTRLA_SetFrameless = ICONA_Dummy + 32; + ICONCTRLA_GetFrameless = ICONA_Dummy + 33; + { Enable NewIcons support (BOOL) } + ICONCTRLA_SetNewIconsSupport = ICONA_Dummy + 34; + ICONCTRLA_GetNewIconsSupport = ICONA_Dummy + 35; + { Icon aspect ratio (PBYTE) } + ICONCTRLA_SetAspectRatio = ICONA_Dummy + 36; + ICONCTRLA_GetAspectRatio = ICONA_Dummy + 37; + { Icon dimensions; valid only for palette mapped icon images (LongInt) } + ICONCTRLA_SetWidth = ICONA_Dummy + 38; + ICONCTRLA_GetWidth = ICONA_Dummy + 39; + ICONCTRLA_SetHeight = ICONA_Dummy + 40; + ICONCTRLA_GetHeight = ICONA_Dummy + 41; + { Check whether the icon is palette mapped (PLongInt). } + ICONCTRLA_IsPaletteMapped = ICONA_Dummy + 42; + { Get the screen the icon is attached to (^PScreen). } + ICONCTRLA_GetScreen = ICONA_Dummy + 43; + { Check whether the icon has a real select image (PLongInt). } + ICONCTRLA_HasRealImage2 = ICONA_Dummy + 44; + { Check whether the icon is of the NewIcon type (PLongInt). } + ICONCTRLA_IsNewIcon = ICONA_Dummy + 79; + { Check whether this icon was allocated by icon.library + or if consists solely of a statically allocated + struct DiskObject. (PLongInt).} + ICONCTRLA_IsNativeIcon = ICONA_Dummy + 80; + +{ Icon Aspect Handling} + + { Icon aspect ratio is not known. } + ICON_ASPECT_RATIO_UNKNOWN = 0; + +{ Tags for use with GetIconTagList() } + + { Default icon type to retrieve (LongInt) } + ICONGETA_GetDefaultType = ICONA_Dummy+45; + { Retrieve default icon for the given name (PChar) } + ICONGETA_GetDefaultName = ICONA_Dummy + 46; + { Return a default icon if the requested icon + file cannot be found (BOOL).} + ICONGETA_FailIfUnavailable = ICONA_Dummy + 47; + { If possible, retrieve a palette mapped icon (BOOL). } + ICONGETA_GetPaletteMappedIcon = ICONA_Dummy + 48; + { Set if the icon returned is a default icon (PLongBool). } + ICONGETA_IsDefaultIcon = ICONA_Dummy + 49; + { Remap the icon to the default screen, if possible (BOOL). } + ICONGETA_RemapIcon = ICONA_Dummy + 50; + { Generate icon image masks (BOOL). } + ICONGETA_GenerateImageMasks = ICONA_Dummy + 51; + { Label text to be assigned to the icon (PChar). } + ICONGETA_Label = ICONA_Dummy + 52; + { Screen to remap the icon to (PScreen). } + ICONGETA_Screen = ICONA_Dummy + 69; + +{ Tags for use with PutIconTagList() } + + { Notify Workbench of the icon being written (BOOL) } + ICONPUTA_NotifyWorkbench = ICONA_Dummy + 53; + { Store icon as the default for this type (LongInt) } + ICONPUTA_PutDefaultType = ICONA_Dummy + 54; + { Store icon as a default for the given name (PChar) } + ICONPUTA_PutDefaultName = ICONA_Dummy + 55; + { When storing a palette mapped icon, don't save the + the original planar icon image with the file. Replace + it with a tiny replacement image.} + ICONPUTA_DropPlanarIconImage = ICONA_Dummy + 56; + { Don't write the chunky icon image data to disk. } + ICONPUTA_DropChunkyIconImage = ICONA_Dummy + 57; + { Don't write the NewIcons tool types to disk. } + ICONPUTA_DropNewIconToolTypes = ICONA_Dummy + 58; + { If this tag is enabled, the writer will examine the + icon image data to find out whether it can compress + it more efficiently. This may take extra time and + is not generally recommended.} + ICONPUTA_OptimizeImageSpace = ICONA_Dummy + 59; + { Don't write the entire icon file back to disk, + only change the do^.do_CurrentX/do^.do_CurrentY + members.} + ICONPUTA_OnlyUpdatePosition = ICONA_Dummy + 72; + { Before writing a palette mapped icon back to disk, + icon.library will make sure that the original + planar image data is stored in the file. If you + don't want that to happen, set this option to + FALSE. This will allow you to change the planar icon + image data written back to disk.} + ICONPUTA_PreserveOldIconImages = ICONA_Dummy + 84; + +{ For use with the file identification hook. } +type + PIconIdentifyMsg = ^TIconIdentifyMsg; + TIconIdentifyMsg = record + { Libraries that are already opened for your use. } + iim_SysBase : PLibrary; + iim_DOSBase : PLibrary; + iim_UtilityBase : PLibrary; + iim_IconBase : PLibrary; + { File context information. } + iim_FileLock : BPTR; // Lock on the object to return an icon for. + iim_ParentLock : BPTR; // Lock on the object's parent directory, if available. + iim_FIB : PFileInfoBlock;// Already initialized for you. + iim_FileHandle : BPTR; // If non-NULL, pointer to the file to examine, + // positioned right at the first byte, ready + // for you to use. + iim_Tags : PTagItem; // Tags passed to GetIconTagList(). + end; + +{ Tags for use with DupDiskObjectA() } +const + ICONDUPA_DuplicateDrawerData = ICONA_Dummy + 60; // Duplicate do_DrawerData + ICONDUPA_DuplicateImages = ICONA_Dummy + 61; // Duplicate the Image structures. + ICONDUPA_DuplicateImageData = ICONA_Dummy + 62; // Duplicate the image data (Image->ImageData) itself. + ICONDUPA_DuplicateDefaultTool = ICONA_Dummy + 63; // Duplicate the default tool. + ICONDUPA_DuplicateToolTypes = ICONA_Dummy + 64; // Duplicate the tool types list. + ICONDUPA_DuplicateToolWindow = ICONA_Dummy + 65; // Duplicate the tool window. + ICONDUPA_ActivateImageData = ICONA_Dummy + 82;{ If the icon to be duplicated is in fact a palette mapped + icon which has never been set up to be displayed on the + screen, turn the duplicate into that palette mapped icon.} + +{ Tags for use with DrawIconStateA() and GetIconRectangleA(). } + ICONDRAWA_DrawInfo = ICONA_Dummy + 66; // Drawing information to use (PDrawInfo). + ICONDRAWA_Frameless = ICONA_Dummy + 70; // Draw the icon without the surrounding frame (BOOL). + ICONDRAWA_EraseBackground = ICONA_Dummy + 71; // Erase the background before drawing a frameless icon (BOOL). + ICONDRAWA_Borderless = ICONA_Dummy + 83; // Draw the icon without the surrounding border and frame (BOOL). + +{ Reserved tags; don't use! } + ICONA_Reserved1 = ICONA_Dummy + 73; + ICONA_Reserved2 = ICONA_Dummy + 74; + ICONA_Reserved3 = ICONA_Dummy + 76; + ICONA_Reserved4 = ICONA_Dummy + 81; + ICONA_Reserved5 = ICONA_Dummy + 85; + ICONA_Reserved6 = ICONA_Dummy + 86; + ICONA_Reserved7 = ICONA_Dummy + 87; + ICONA_Reserved8 = ICONA_Dummy + 88; +{ The last Tag} + ICONA_LAST_TAG = ICONA_Dummy + 88; + + +var + IconBase: PLibrary; + +function AddFreeList(FreeList: PFreeList; const Mem: APTR; Size: ULONG): BOOL; syscall IconBase 12; +function BumpRevision(NewName: PChar; const OldName: PChar): PChar; syscall IconBase 18; +function DeleteDiskObject(const Name: PChar): BOOL; syscall IconBase 23; +function FindToolType(const ToolTypeArray: PPChar; const TypeName: STRPTR): STRPTR; syscall IconBase 16; +procedure FreeDiskObject(DiskObj: PDiskObject); syscall IconBase 15; +procedure FreeFreeList(FreeList: PFreeList); syscall IconBase 9; +function GetDefDiskObject(Typ: LongInt): PDiskObject; syscall IconBase 20; +function GetDiskObject(const Name: STRPTR): PDiskObject; syscall IconBase 13; +function GetDiskObjectNew(const Name : PChar): PDiskObject; syscall IconBase 22; +function MatchToolValue(const TypeString: PChar; const Value: PChar): BOOL; syscall IconBase 17; +function PutDefDiskObject(const Icon: PDiskObject): BOOL; syscall IconBase 21; +function PutDiskObject(const Name: STRPTR; const Icon: PDiskObject): BOOL; syscall IconBase 14; + +{ version 44 } +function DupDiskObjectA(const Icon: PDiskObject; const Tags: PTagItem): PDiskObject; syscall IconBase 25; +function IconControlA(Icon: PDiskObject; const Tags: PTagItem): ULONG; syscall IconBase 26; +procedure DrawIconStateA(Rp: PRastPort; const Icon: PDiskObject; const Label_: STRPTR; + LeftEdge: LongInt; TopEdge: LongInt; State: ULONG; const Tags: PTagItem); syscall IconBase 27; +function GetIconRectangleA(Rp: PRastPort; const Icon: PDiskObject; const Label_: PChar; + Rect: PRectangle; const Tags: PTagItem): BOOL; syscall IconBase 28; +function NewDiskObject(Type_: ULONG): PDiskObject; syscall IconBase 29; +function GetIconTagList(const Name: STRPTR; const Tags: PTagItem): PDiskObject; syscall IconBase 30; +function PutIconTagList(const Name: STRPTR; const Icon: PDiskObject; const Tags: PTagItem): BOOL; syscall IconBase 31; +function LayoutIconA(Icon: PDiskObject; Screen: PScreen; Tags: PTagItem): BOOL; syscall IconBase 32; +procedure ChangeToSelectedIconColor(Cr: Pointer); syscall IconBase 33; //TODO: pColorRegister // 33 + +{macros} +function PACK_ICON_ASPECT_RATIO(Num, Den: LongInt): LongInt; +procedure UNPACK_ICON_ASPECT_RATIO(Aspect: LongInt; out Num, Den: LongInt); + +type + TToolTypeArray= array of string; + +function GetToolTypes(Filename: string): TToolTypeArray; + + +implementation + +function GetToolTypes(Filename: string): TToolTypeArray; +var + DObj: PDiskObject; + Tooltype: PPChar; + Idx: Integer; +begin + SetLength(Result, 0); + DObj := GetDiskObject(PChar(FileName)); + if not Assigned(Dobj) then + Exit; + Tooltype := DObj^.do_Tooltypes; + while Assigned(ToolType^) do + begin + Idx := Length(Result); + SetLength(Result, Idx + 1); + Result[Idx] := ToolType^; + Inc(ToolType); + end; + FreeDiskObject(DObj); +end; + +function PACK_ICON_ASPECT_RATIO(Num, Den: LongInt): LongInt; +begin + PACK_ICON_ASPECT_RATIO := (Num shl 4) or Den; +end; + +procedure UNPACK_ICON_ASPECT_RATIO(Aspect: LongInt; out Num, Den: LongInt); +begin + Num := (Aspect shr 4) and $F; + Den := Aspect and $15; +end; + +initialization + IconBase := OpenLibrary(ICONNAME, 40); +finalization + CloseLibrary(IconBase); +end. + + + + diff --git a/packages/arosunits/src/iffparse.pas b/packages/arosunits/src/iffparse.pas new file mode 100755 index 0000000000..942f13cb8d --- /dev/null +++ b/packages/arosunits/src/iffparse.pas @@ -0,0 +1,278 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + iffparse.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit iffparse; + +interface + +{$mode objfpc} + +uses exec, clipboard, utility; + + +const + IFFPARSENAME : PChar = 'iffparse.library'; + +{ + * Struct associated with an active IFF stream. + * "iff_Stream" is a value used by the client's read/write/seek functions - + * it will not be accessed by the library itself and can have any value + * (could even be a pointer or a BPTR). + } +Type + PIFFHandle = ^TIFFHandle; + TIFFHandle = record + iff_Stream, + iff_Flags : LongWord; + iff_Depth : LongInt; { Depth of context stack. } + { There are private fields hiding here. } + end; + +{ + * Bit masks for "iff_Flags" field. + } +const + IFFF_READ = 0; { read mode - default } + IFFF_WRITE = 1; { write mode } + IFFF_RWBITS = (IFFF_READ + IFFF_WRITE); { read/write bits } + IFFF_FSEEK = 2; { forward seek only } + IFFF_RSEEK = 4; { random seek } + IFFF_RESERVED = $FFFF0000; { Don't touch these bits. } + +{ + * When the library calls your stream handler, you'll be passed a Pointer + * to this structure as the "message packet". + } +type + PIFFStreamCmd = ^TIFFStreamCmd; + TIFFStreamCmd = record + sc_Command : LongInt; { Operation to be performed (IFFCMD_) } + sc_Buf : Pointer; { Pointer to data buffer } + sc_NBytes : LongInt; { Number of bytes to be affected } + end; +{ + * A node associated with a context on the iff_Stack. Each node + * represents a chunk, the stack representing the current nesting + * of chunks in the open IFF file. Each context node has associated + * local context items in the (private) LocalItems list. The ID, type, + * size and scan values describe the chunk associated with this node. + } + PContextNode = ^TContextNode; + TContextNode = record + cn_Node : TMinNode; + cn_ID, + cn_Type, + cn_Size, { Size of this chunk } + cn_Scan : LongInt; { # of bytes read/written so far } + { There are private fields hiding here. } + end; + +{ + * Local context items live in the ContextNode's. Each class is identified + * by its lci_Ident code and has a (private) purge vector for when the + * parent context node is popped. + } + PLocalContextItem = ^TLocalContextItem; + TLocalContextItem = record + lci_Node : TMinNode; + lci_ID, + lci_Type, + lci_Ident : LongWord; + { There are private fields hiding here. } + end; + +{ + * StoredProperty: a local context item containing the data stored + * from a previously encountered property chunk. + } + PStoredProperty = ^TStoredProperty; + TStoredProperty = record + sp_Size : LongInt; + sp_Data : Pointer; + end; + +{ + * Collection Item: the actual node in the collection list at which + * client will look. The next pointers cross context boundaries so + * that the complete list is accessable. + } + PCollectionItem = ^TCollectionItem; + TCollectionItem = record + ci_Next : PCollectionItem; + ci_Size : LongInt; + ci_Data : Pointer; + end; + +{ + * Structure returned by OpenClipboard(). You may do CMD_POSTs and such + * using this structure. However, once you call OpenIFF(), you may not + * do any more of your own I/O to the clipboard until you call CloseIFF(). + } + PClipboardHandle = ^TClipBoardHandle; + TClipboardHandle = record + cbh_Req : TIOClipReq; + cbh_CBport, + cbh_SatisfyPort : TMsgPort; + end; + +{ + * IFF return codes. Most functions return either zero for success or + * one of these codes. The exceptions are the read/write functions which + * return positive values for number of bytes or records read or written, + * or a negative error code. Some of these codes are not errors per sae, + * but valid conditions such as EOF or EOC (end of Chunk). + } +const + IFFERR_EOF = -1 ; { Reached logical end of file } + IFFERR_EOC = -2 ; { About to leave context } + IFFERR_NOSCOPE = -3 ; { No valid scope for property } + IFFERR_NOMEM = -4 ; { Internal memory alloc failed} + IFFERR_READ = -5 ; { Stream read error } + IFFERR_WRITE = -6 ; { Stream write error } + IFFERR_SEEK = -7 ; { Stream seek error } + IFFERR_MANGLED = -8 ; { Data in file is corrupt } + IFFERR_SYNTAX = -9 ; { IFF syntax error } + IFFERR_NOTIFF = -10; { Not an IFF file } + IFFERR_NOHOOK = -11; { No call-back hook provided } + IFF_RETURN2CLIENT = -12; { Client handler normal return} + +{ + MAKE_ID(a,b,c,d) \ + ((LongWord) (a)<<24 | (LongWord) (b)<<16 | (LongWord) (c)<<8 | (LongWord) (d)) + } +{ + * Universal IFF identifiers. + } + ID_FORM = 1179603533; + ID_LIST = 1279873876; + ID_CAT = 1128354848; + ID_PROP = 1347571536; + ID_NULL = 538976288; + +{ + * Ident codes for universally recognized local context items. + } + IFFLCI_PROP = 1886547824; + IFFLCI_COLLECTION = 1668246636; + IFFLCI_ENTRYHANDLER = 1701734500; + IFFLCI_EXITHANDLER = 1702389860; + + +{ + * Control modes for ParseIFF() function. + } + IFFPARSE_SCAN = 0; + IFFPARSE_STEP = 1; + IFFPARSE_RAWSTEP = 2; + +{ + * Control modes for StoreLocalItem(). + } + IFFSLI_ROOT = 1; { Store in default context } + IFFSLI_TOP = 2; { Store in current context } + IFFSLI_PROP = 3; { Store in topmost FORM OR LIST } + +{ + * "Flag" for writing functions. If you pass this value in as a size + * to PushChunk() when writing a file, the parser will figure out the + * size of the chunk for you. (Chunk sizes >= 2**31 are forbidden by the + * IFF specification, so this works.) + } + IFFSIZE_UNKNOWN = -1; + +{ + * Possible call-back command values. (Using 0 as the value for IFFCMD_INIT + * was, in retrospect, probably a bad idea.) + } + IFFCMD_INIT = 0; { Prepare the stream for a session } + IFFCMD_CLEANUP = 1; { Terminate stream session } + IFFCMD_READ = 2; { Read bytes from stream } + IFFCMD_WRITE = 3; { Write bytes to stream } + IFFCMD_SEEK = 4; { Seek on stream } + IFFCMD_ENTRY = 5; { You just entered a new context } + IFFCMD_EXIT = 6; { You're about to leave a context } + IFFCMD_PURGELCI= 7; { Purge a LocalContextItem } + +{ Backward compatibility. Don't use these in new code. } + IFFSCC_INIT = IFFCMD_INIT; + IFFSCC_CLEANUP = IFFCMD_CLEANUP; + IFFSCC_READ = IFFCMD_READ; + IFFSCC_WRITE = IFFCMD_WRITE; + IFFSCC_SEEK = IFFCMD_SEEK; + +var IFFParseBase: PLibrary; + +function AllocIFF: PIFFHandle; syscall IFFParseBase 5; +function AllocLocalItem(Typ: LongInt; Id: LongInt; Ident: LongInt; DataSize: LongInt): PLocalContextItem; syscall IFFParseBase 31; +procedure CloseClipboard(ClipHandle: PClipboardHandle); syscall IFFParseBase 42; +procedure CloseIFF(Iff: PIFFHandle); syscall IFFParseBase 8; +function CollectionChunk(Iff: PIFFHandle; Typ: LongInt; Id: LongInt): LongInt; syscall IFFParseBase 23; +function CollectionChunks(Iff : PIFFHandle;const PropArray: PLongInt; NumPairs: LongInt): LongInt; syscall IFFParseBase 24; +function CurrentChunk(const Iff: PIFFHandle): PContextNode; syscall IFFParseBase 29; +function EntryHandler(Iff: PIFFHandle; Typ: LongInt; Id: LongInt; Position: LongInt; Handler: PHook; Obj: Pointer): LongInt; syscall IFFParseBase 17; +function ExitHandler(Iff: PIFFHandle; Typ: LongInt; Id: LongInt; Position: LongInt; Handler: PHook; Obj: Pointer): LongInt; syscall IFFParseBase 18; +function FindCollection(const Iff: PIFFHandle; Typ: LongInt; Id: LongInt): PCollectionItem; syscall IFFParseBase 27; +function FindLocalItem(const Iff: PIFFHandle; Typ: LongInt; Id: LongInt; Ident: LongInt): PLocalContextItem; syscall IFFParseBase 35; +function FindProp(const Iff: PIFFHandle; Typ: LongInt; Id: LongInt): PStoredProperty; syscall IFFParseBase 26; +function FindPropContext(const Iff: PIFFHandle): PContextNode; syscall IFFParseBase 28; +procedure FreeIFF(Iff: PIFFHandle); syscall IFFParseBase 9; +procedure FreeLocalItem(LocalItem: PLocalContextItem); syscall IFFParseBase 34; +function GoodID(Id: LongInt): LongInt; syscall IFFParseBase 43; +function GoodType(Typ: LongInt): LongInt; syscall IFFParseBase 44; +function IDtoStr(Id: LongInt; Buf: PChar): PChar; syscall IFFParseBase 45; +procedure InitIFF(Iff: PIFFHandle; Flags: LongInt;const StreamHook: PHook); syscall IFFParseBase 38; +procedure InitIFFasClip(Iff: PIFFHandle); syscall IFFParseBase 40; +procedure InitIFFasDOS(Iff: PIFFHandle); syscall IFFParseBase 39; +function LocalItemData(const LocalItem: PLocalContextItem): Pointer; syscall IFFParseBase 32; +function OpenClipboard(unitNumber: LongInt): PClipboardHandle; syscall IFFParseBase 41; +function OpenIFF(Iff: PIFFHandle; rwMode: LongInt): LongInt; syscall IFFParseBase 6; +function ParentChunk(const contextNode: PContextNode): PContextNode; syscall IFFParseBase 30; +function ParseIFF(Iff: PIFFHandle; control: LongInt): LongInt; syscall IFFParseBase 7; +function PopChunk(Iff: PIFFHandle): LongInt; syscall IFFParseBase 15; +function PropChunk(Iff: PIFFHandle; Typ: LongInt; Id: LongInt): LongInt; syscall IFFParseBase 19; +function PropChunks(Iff: PIFFHandle;const PropArray: PLongInt; NumPairs: LongInt): LongInt; syscall IFFParseBase 20; +function PushChunk(Iff: PIFFHandle; Typ: LongInt; Id: LongInt; size: LongInt): LongInt; syscall IFFParseBase 14; +function ReadChunkBytes(Iff: PIFFHandle; Buf: Pointer; numBytes: LongInt): LongInt; syscall IFFParseBase 10; +function ReadChunkRecords(Iff: PIFFHandle; Buf: Pointer; bytesPerRecord: LongInt; numRecords: LongInt): LongInt; syscall IFFParseBase 12; +procedure SetLocalItemPurge(LocalItem: PLocalContextItem;const purgeHook: PHook); syscall IFFParseBase 33; +function StopChunk(Iff: PIFFHandle; Typ: LongInt; Id: LongInt): LongInt; syscall IFFParseBase 21; +function StopChunks(Iff: PIFFHandle;const PropArray: PLongInt; NumPairs: LongInt): LongInt; syscall IFFParseBase 22; +function StopOnExit(Iff: PIFFHandle; Typ: LongInt; Id: LongInt): LongInt; syscall IFFParseBase 25; +procedure StoreItemInContext(Iff: PIFFHandle; LocalItem: PLocalContextItem; contextNode: PContextNode); syscall IFFParseBase 37; +function StoreLocalItem(Iff: PIFFHandle; LocalItem: PLocalContextItem; Position: LongInt): LongInt; syscall IFFParseBase 36; +function WriteChunkBytes(Iff: PIFFHandle;const Buf: Pointer; NumBytes: LongInt): LongInt; syscall IFFParseBase 11; +function WriteChunkRecords(Iff: PIFFHandle;const Buf: Pointer; BytesPerRecord: LongInt; NumRecords: LongInt): LongInt; syscall IFFParseBase 13; + +function Make_ID(str: String): LongInt; + +implementation + +function Make_ID(str: String): LongInt; +begin + Make_ID:= (LongInt(Ord(Str[1])) shl 24) or + (LongInt(Ord(Str[2])) shl 16 ) or + (LongInt(Ord(Str[3])) shl 8 ) or (LongInt(Ord(Str[4]))); +end; + +initialization + IFFParseBase := OpenLibrary(IFFPARSENAME, 0); +finalization + CloseLibrary(IFFParseBase); +end. (* UNIT IFFPARSE *) + + + + + diff --git a/packages/arosunits/src/inputevent.pas b/packages/arosunits/src/inputevent.pas new file mode 100644 index 0000000000..c3d0102473 --- /dev/null +++ b/packages/arosunits/src/inputevent.pas @@ -0,0 +1,284 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + input event structures + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit inputevent; + +INTERFACE + +uses exec, utility, timer; + +const + +{------ constants -------------------------------------------------} + +{ --- InputEvent.ie_Class --- } +{ A NOP input event } + IECLASS_NULL = $00; +{ A raw keycode from the keyboard device } + IECLASS_RAWKEY = $01; +{ The raw mouse report from the game port device } + IECLASS_RAWMOUSE = $02; +{ A private console event } + IECLASS_EVENT = $03; +{ A Pointer Position report } + IECLASS_POINTERPOS = $04; +{ A timer event } + IECLASS_TIMER = $06; +{ select button pressed down over a Gadget (address in ie_EventAddress) } + IECLASS_GADGETDOWN = $07; +{ select button released over the same Gadget (address in ie_EventAddress) } + IECLASS_GADGETUP = $08; +{ some Requester activity has taken place. See Codes REQCLEAR and REQSET } + IECLASS_REQUESTER = $09; +{ this is a Menu Number transmission (Menu number is in ie_Code) } + IECLASS_MENULIST = $0A; +{ User has selected the active Window's Close Gadget } + IECLASS_CLOSEWINDOW = $0B; +{ this Window has a new size } + IECLASS_SIZEWINDOW = $0C; +{ the Window pointed to by ie_EventAddress needs to be refreshed } + IECLASS_REFRESHWINDOW = $0D; +{ new preferences are available } + IECLASS_NEWPREFS = $0E; +{ the disk has been removed } + IECLASS_DISKREMOVED = $0F; +{ the disk has been inserted } + IECLASS_DISKINSERTED = $10; +{ the window is about to be been made active } + IECLASS_ACTIVEWINDOW = $11; +{ the window is about to be made inactive } + IECLASS_INACTIVEWINDOW = $12; +{ extended-function pointer position report (V36) } + IECLASS_NEWPOINTERPOS = $13; +{ Help key report during Menu session (V36) } + IECLASS_MENUHELP = $14; +{ the Window has been modified with move, size, zoom, or change (V36) } + IECLASS_CHANGEWINDOW = $15; + + + +{ the last class } + + IECLASS_MAX = $15; + +{ --- InputEvent.ie_SubClass --- } +{ IECLASS_NEWPOINTERPOS } +{ like IECLASS_POINTERPOS } + IESUBCLASS_COMPATIBLE = $00; +{ ie_EventAddress points to struct IEPointerPixel } + IESUBCLASS_PIXEL = $01; +{ ie_EventAddress points to struct IEPointerTablet } + IESUBCLASS_TABLET = $02; + +{ pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS, + * and IESUBCLASS_PIXEL. + * + * You specify a screen and pixel coordinates in that screen + * at which you'd like the mouse to be positioned. + * Intuition will try to oblige, but there will be restrictions + * to positioning the pointer over offscreen pixels. + * + * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL. + } +Type + + pIEPointerPixel = ^tIEPointerPixel; + tIEPointerPixel = record + iepp_Screen : Pointer; { pointer to an open screen } + iepp_Position : record + x,y : smallint; + end; + END; + +{ pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS, + * and IESUBCLASS_TABLET. + * + * You specify a range of values and a value within the range + * independently for each of X and Y (the minimum value of + * the ranges is always normalized to 0). + * + * Intuition will position the mouse proportionally within its + * natural mouse position rectangle limits. + * + * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET. + } + + pIEPointerTablet = ^tIEPointerTablet; + tIEPointerTablet = record + iept_Range : record { 0 is min, these are max } + x,y : Word; + end; + iept_Value : record { between 0 AND iept_Range } + x,y : Word; + end; + iept_Pressure : Word; { -128 to 127 (unused, set to 0) } + END; + +{ The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass + * IESUBCLASS_NEWTABLET points at an IENewTablet structure. + * + * + * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET. + } + + pIENewTablet = ^tIENewTablet; + tIENewTablet = record + { Pointer to a hook you wish to be called back through, in + * order to handle scaling. You will be provided with the + * width and height you are expected to scale your tablet + * to, perhaps based on some user preferences. + * If NULL, the tablet's specified range will be mapped directly + * to that width and height for you, and you will not be + * called back. + } + ient_CallBack : pHook; + + { Post-scaling coordinates and fractional coordinates. + * DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN! + * Your driver will be called back and provided information + * about the width and height of the area to scale the + * tablet into. It should scale the tablet coordinates + * (perhaps based on some preferences controlling aspect + * ratio, etc.) and place the scaled result into these + * fields. The ient_ScaledX and ient_ScaledY fields are + * in screen-pixel resolution, but the origin ( [0,0]-point ) + * is not defined. The ient_ScaledXFraction and + * ient_ScaledYFraction fields represent sub-pixel position + * information, and should be scaled to fill a UWORD fraction. + } + ient_ScaledX, ient_ScaledY, + ient_ScaledXFraction, ient_ScaledYFraction : WORD; + + { Current tablet coordinates along each axis: } + ient_TabletX, ient_TabletY : ULONG; + + { Tablet range along each axis. For example, if ient_TabletX + * can take values 0-999, ient_RangeX should be 1000. + } + ient_RangeX, ient_RangeY : ULONG; + + { Pointer to tag-list of additional tablet attributes. + * See <intuition/intuition.h> for the tag values. + } + ient_TagList : pTagItem; + end; + + +CONST +{ --- InputEvent.ie_Code --- } +{ IECLASS_RAWKEY } + IECODE_UP_PREFIX = $80; + IECODE_KEY_CODE_FIRST = $00; + IECODE_KEY_CODE_LAST = $77; + IECODE_COMM_CODE_FIRST = $78; + IECODE_COMM_CODE_LAST = $7F; + +{ IECLASS_ANSI } + IECODE_C0_FIRST = $00; + IECODE_C0_LAST = $1F; + IECODE_ASCII_FIRST = $20; + IECODE_ASCII_LAST = $7E; + IECODE_ASCII_DEL = $7F; + IECODE_C1_FIRST = $80; + IECODE_C1_LAST = $9F; + IECODE_LATIN1_FIRST = $A0; + IECODE_LATIN1_LAST = $FF; + +{ IECLASS_RAWMOUSE } + IECODE_LBUTTON = $68; { also uses IECODE_UP_PREFIX } + IECODE_RBUTTON = $69; + IECODE_MBUTTON = $6A; + IECODE_NOBUTTON = $FF; + +{ IECLASS_EVENT } + IECODE_NEWACTIVE = $01; { active input window changed } + IECODE_NEWSIZE = $02; { resize of window } + IECODE_REFRESH = $03; { refresh of window } + +{ IECLASS_REQUESTER Codes } +{ REQSET is broadcast when the first Requester (not subsequent ones) opens + * in the Window + } + IECODE_REQSET = $01; +{ REQCLEAR is broadcast when the last Requester clears out of the Window } + IECODE_REQCLEAR = $00; + + +{ --- InputEvent.ie_Qualifier --- } + IEQUALIFIER_LSHIFT = $0001; + IEQUALIFIER_RSHIFT = $0002; + IEQUALIFIER_CAPSLOCK = $0004; + IEQUALIFIER_CONTROL = $0008; + IEQUALIFIER_LALT = $0010; + IEQUALIFIER_RALT = $0020; + IEQUALIFIER_LCOMMAND = $0040; + IEQUALIFIER_RCOMMAND = $0080; + IEQUALIFIER_NUMERICPAD = $0100; + IEQUALIFIER_REPEAT = $0200; + IEQUALIFIER_INTERRUPT = $0400; + IEQUALIFIER_MULTIBROADCAST = $0800; + IEQUALIFIER_MIDBUTTON = $1000; + IEQUALIFIER_RBUTTON = $2000; + IEQUALIFIER_LEFTBUTTON = $4000; + IEQUALIFIER_RELATIVEMOUSE = $8000; + + IEQUALIFIERB_LSHIFT = 0; + IEQUALIFIERB_RSHIFT = 1; + IEQUALIFIERB_CAPSLOCK = 2; + IEQUALIFIERB_CONTROL = 3; + IEQUALIFIERB_LALT = 4; + IEQUALIFIERB_RALT = 5; + IEQUALIFIERB_LCOMMAND = 6; + IEQUALIFIERB_RCOMMAND = 7; + IEQUALIFIERB_NUMERICPAD = 8; + IEQUALIFIERB_REPEAT = 9; + IEQUALIFIERB_INTERRUPT = 10; + IEQUALIFIERB_MULTIBROADCAST = 11; + IEQUALIFIERB_MIDBUTTON = 12; + IEQUALIFIERB_RBUTTON = 13; + IEQUALIFIERB_LEFTBUTTON = 14; + IEQUALIFIERB_RELATIVEMOUSE = 15; + + +{------ InputEvent ------------------------------------------------} + + type + pInputEvent = ^tInputEvent; + tInputEvent = record + ie_NextEvent : pInputEvent; + ie_Class : BYTE; + ie_SubClass : BYTE; + ie_Code : WORD; + ie_Qualifier : WORD; + ie_position : record + case longint of + 0 : ( ie_xy : record + ie_x : smallint; + ie_y : smallint; + end ); + 1 : ( ie_addr : APTR ); + 2 : ( ie_dead : record + ie_prev1DownCode : BYTE; + ie_prev1DownQual : BYTE; + ie_prev2DownCode : BYTE; + ie_prev2DownQual : BYTE; + end ); + end; + ie_TimeStamp : tTimeVal; + end; + +IMPLEMENTATION + +end. diff --git a/packages/arosunits/src/intuition.pas b/packages/arosunits/src/intuition.pas new file mode 100644 index 0000000000..851e180c3b --- /dev/null +++ b/packages/arosunits/src/intuition.pas @@ -0,0 +1,3695 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + intuition.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} +unit Intuition; + +{$mode objfpc} + +{$define INTUI_V36_NAMES_ONLY} + +interface + +uses + Exec, Utility, AGraphics, InputEvent, Timer, Layers, Keymap; + + +type +{ IntuiText is a series of strings that start with a screen location + (always relative to the upper-left corner of something) and then the + text of the string. The text is null-terminated.} + PIntuiText = ^TIntuiText; + TIntuiText = record + FrontPen, + BackPen: Byte; // the pen numbers for the rendering + DrawMode: Byte; // the mode for rendering the text + LeftEdge: SmallInt; // relative start location for the text + TopEdge: SmallInt; // relative start location for the text + ITextFont: PTextAttr; // if nil, you accept the default + IText: PChar; // pointer to null-terminated text + NextText: PIntuiText; // continuation to TxWrite another text + end; + + PStringExtend = ^TStringExtend; + TStringExtend = record + // display specifications + Font: PTextFont; // must be an open Font (not TextAttr) + Pens: array[0..1] of Byte; // color of text/background + ActivePens: array[0..1] of Byte; // colors when gadget is active + // edit specifications + InitialModes: LongWord; // initial mode flags, below + EditHook: PHook; // IF non-nil, must supply WorkBuffer + WorkBuffer: STRPTR; // must be as large as StringInfo.Buffer + Reserved: array[0..3] of LongWord; // set to 0 + end; + +{ Data type Border, used for drawing a series of lines which is intended for use as a border drawing, but which may, in fact, be used to render any + arbitrary vector shape. The routine DrawBorder sets up the RastPort with the appropriate variables, then does a Move to the first coordinate, then does Draws + to the subsequent coordinates. After all the Draws are done, if NextBorder is non-zero we call DrawBorder recursively} +type + PBorder = ^TBorder; + TBorder = record + LeftEdge, + TopEdge: SmallInt; // initial offsets from the origin + FrontPen, + BackPen: Byte; // pens numbers for rendering + DrawMode: Byte; // mode for rendering + Count: ShortInt; // number of XY pairs + XY: PSmallInt; // vector coordinate pairs rel to LeftTop + NextBorder: PBorder; // pointer to any other Border too + end; + +type + PMenuItem = ^TMenuItem; + TMenuItem = record + NextItem: PMenuItem; // pointer to next in chained list + LeftEdge, + TopEdge: SmallInt; // position of the select box + Width, + Height: SmallInt; // dimensions of the select box + Flags: Word; // see the defines below + MutualExclude: LongInt; // set bits mean this item excludes that + ItemFill: APTR; // points to Image, IntuiText, or nil + SelectFill: APTR; // points to Image, IntuiText, or nil when this item is pointed to by the cursor and the items highlight mode HIGHIMAGE is selected, this alternate image will be displayed + Command: Char; // only if appliprog sets the COMMSEQ flag + SubItem: PMenuItem; // if non-nil, DrawMenu shows "->" + NextSelect: Word; // The NextSelect field represents the menu number of next selected item (when user has drag-selected several items) + end; +const + // Flags set by the Application + CHECKIT = 1 shl 0; // whether to check this item if selected + ITEMTEXT = 1 shl 1; // set if textual, clear if graphical item + COMMSEQ = 1 shl 2; // set if there's an command sequence + MENUTOGGLE = 1 shl 3; // set to toggle the check of a menu item + ITEMENABLED = 1 shl 4; // set if this item is enabled + // these are the SPECIAL HIGHLIGHT FLAG state meanings + HIGHIMAGE = $0000; // use the user's "select image" + HIGHCOMP = 1 shl 6; // highlight by complementing the selectbox + HIGHBOX = 1 shl 7; // highlight by "boxing" the selectbox + HIGHFLAGS = $00C0; // see definitions below for these bits + HIGHNONE = $00C0; // don't highlight + // Flags set by both Application and intuition + Checked = 1 shl 8; // if CHECKIT, then set this when selected + // Flags set by Intuition (Read Only) + ISDRAWN = 1 shl 12; // this item's subs are currently drawn + HIGHITEM = 1 shl 13; // this item is currently highlighted + MENUTOGGLED = 1 shl 14; // this item was already toggled + + NOMENU = $001F; + NOITEM = $003F; + NOSUB = $001F; + MENUNULL = $FFFF; + +{ these defines are for the COMMSEQ and CHECKIT menu stuff. If CHECKIT, + I'll use a generic Width (for all resolutions) for the CheckMark. + If COMMSEQ, likewise I'll use this generic stuff} + CHECKWIDTH = 19; + LOWCHECKWIDTH = 13; + COMMWIDTH = 27; + LOWCOMMWIDTH = 16; + +type + PMenu = ^TMenu; + TMenu = record + NextMenu: PMenu; // same level + LeftEdge, + TopEdge: SmallInt; // position of the select box + Width, + Height: SmallInt; // dimensions of the select box + Flags: Word; // see flag definitions below (MENUENABLED, MIDRAWN) + MenuName: PChar; // text for this Menu Header + FirstItem: PMenuItem; // pointer to first in chain + JazzX, // these mysteriously-named variables are for internal use only + JazzY, + BeatX, + BeatY: SmallInt; + end; + +const + // FLAGS SET BY BOTH THE APPLIPROG AND INTUITION + MENUENABLED = 1 shl 0; // whether or not this menu is enabled + // FLAGS SET BY INTUITION } + MIDRAWN = 1 shl 8; // this menu's items are currently drawn + +type + PGadget = ^TGadget; + TGadget = record + NextGadget: PGadget; // next gadget in the list + + LeftEdge, + TopEdge: SmallInt; // "hit box" of gadget + Width, + Height: SmallInt; // "hit box" of gadget + + Flags: Word; // see below for list of defines GFLG_* + Activation: Word; // see below for list of defines GACT_* + GadgetType: Word; // see below for defines GTYP_* + + GadgetRender: APTR; // appliprog can specify that the Gadget be rendered as either as Border + // or an Image. This variable points to which (or equals nil if there's nothing to be rendered about this Gadget) + SelectRender: APTR; // appliprog can specify "highlighted" imagery rather than algorithmic this can point to either Border or Image data + GadgetText: PIntuiText; // text for this gadget + + MutualExclude: IPTR; // obsolete + + SpecialInfo: APTR; // pointer to a structure of special data required by Proportional, String and LongInt Gadgets + GadgetID: Word; // user-definable ID field + UserData: APTR; // ptr to general purpose User data (ignored by In) + end; + + PExtGadget = ^TExtGadget; + TExtGadget = record + // The first fields match struct Gadget exactly + NextGadget: PExtGadget; // Matches struct Gadget + LeftEdge, TopEdge, // Matches struct Gadget + Width, Height: SmallInt; // Matches struct Gadget + Flags, // Matches struct Gadget + Activation, // Matches struct Gadget + GadgetType: Word; // Matches struct Gadget + GadgetRender, // Matches struct Gadget + SelectRender: APTR; // Matches struct Gadget + GadgetText: PIntuiText; // Matches struct Gadget + MutualExclude: IPTR; // Matches struct Gadget + SpecialInfo: APTR; // Matches struct Gadget + GadgetID: Word; // Matches struct Gadget + UserData: APTR; // Matches struct Gadget + + // These fields only exist if GFLG_EXTENDED is set + MoreFlags: LongWord; // see GMORE_* flags below + BoundsLeftEdge, // Bounding extent for gadget, valid + BoundsTopEdge, // only if GMORE_BOUNDS is set. The + BoundsWidth, // GFLG_RELxxx flags affect these + BoundsHeight: SmallInt; // coordinates as well. + end; +const +// Gadget.Flags values + // combinations in these bits describe the highlight technique to be used + + GFLG_GADGHCOMP = $0000; // Complement the select box + GFLG_GADGHBOX = 1 shl 0; // Draw a box around the image + GFLG_GADGHIMAGE = 1 shl 1; // Blast in this alternate image + GFLG_GADGHNONE = $0003; // don't highlight + GFLG_GADGHIGHBITS = $0003; + GFLG_GADGIMAGE = 1 shl 2; // set IF GadgetRender AND SelectRender point to an Image structure, clear if they point to Border structures + { combinations in these next two bits specify to which corner the gadget's Left & Top coordinates are relative. If relative to Top/Left, + these are "normal" coordinates (everything is relative to something in this universe). + Gadget positions and dimensions are relative to the window or requester which contains the gadget} + GFLG_RELBOTTOM = 1 shl 3; // vert. pos. is relative to bottom edge + GFLG_RELRIGHT = 1 shl 4; // horiz. pos. is relative to right edge + GFLG_RELWIDTH = 1 shl 5; // width is relative to req/window + GFLG_RELHEIGHT = 1 shl 6; // height is relative to req/window + GFLG_SELECTED = 1 shl 7; // you may initialize AND look at this + GFLG_DISABLED = 1 shl 8; // the GFLG_DISABLED flag is initialized by you and later set by Intuition according to your calls to On/OffGadget(). It specifies whether or not this Gadget is currently disabled from being selected + GFLG_TABCYCLE = 1 shl 9; // (string OR custom) gadget participates in cycling activation with Tab or Shift-Tab + GFLG_STRINGEXTEND = 1 shl 10; // this String Gadget has StringExtend + GFLG_IMAGEDISABLE = 1 shl 11; // Gadget's image knows how to do disabled rendering + GFLG_LABELITEXT = $0000; // GadgetText points to IntuiText + GFLG_LABELSTRING = 1 shl 12; // GadgetText points to (PChar) + GFLG_LABELIMAGE = 1 shl 13; // GadgetText points to Image (object) + GFLG_LABELMASK = $3000; + GFLG_RELSPECIAL = 1 shl 14; // custom gadget has special relativity. Gadget box values are absolutes, but can be changed via the GM_LAYOUT method. + GFLG_EXTENDED = 1 shl 15; // Gadget is extended + +{GFLG_RELSPECIAL allows custom gadget implementors to + make gadgets whose position and size depend in an arbitrary way + on their window's dimensions. The GM_LAYOUT method will be invoked + for such a gadget (or any other GREL_xxx gadget) at suitable times, + such as when the window opens or the window's size changes. + + GFLG_STRINGEXTEND. We discovered that V34 doesn't properly + ignore the value we had chosen for the Gadget->Activation flag + GACT_STRINGEXTEND. NEVER SET THAT FLAG WHEN RUNNING UNDER V34. + The Gadget->Flags bit GFLG_STRINGEXTEND is provided as a synonym which is + safe under V34, and equivalent to GACT_STRINGEXTEND under V37. + (Note that the two flags are not numerically equal) + + GFLG_IMAGEDISABLE. This flag is automatically set if + the custom image of this gadget knows how to do disabled rendering + (more specifically, if its IA_SupportsDisable attribute is TRUE). + Intuition uses this to defer the ghosting to the image-class, + instead of doing it itself (the old compatible way). + Do not set this flag yourself - Intuition will do it for you. + + GFLG_EXTENDED. If set, this bit means that the Gadget is actually + a struct ExtGadget, with new fields and flags. All V39 boopsi + gadgets are ExtGadgets. Never ever attempt to read the extended + fields of a gadget if this flag is not set. + + GACT_FOLLOWMOUSE flag, when set, specifies that you want to receive + reports on mouse movements while this gadget is active. + You probably want to set the GACT_IMMEDIATE flag when using + GACT_FOLLOWMOUSE, since that's the only reasonable way you have of + learning why Intuition is suddenly sending you a stream of mouse + movement events. If you don't set GACT_RELVERIFY, you'll get at + least one Mouse Position event. + } + +// Gadget.Activation flag values + GACT_RELVERIFY = 1 shl 0; // Set if you want to verify that the pointer was still over the gadget when the select button was released. Will cause an IDCMP_GADGETUP message to be sent if so. + GACT_IMMEDIATE = 1 shl 1; // when set, informs the caller that the gadget was activated when it was activated. This flag works in conjunction with the GACT_RELVERIFY flag + GACT_ENDGADGET = 1 shl 2; // when set, tells the system that this gadget, when selected, causes the Requester to be ended. Requesters that are ended are erased and unlinked from the system. + GACT_FOLLOWMOUSE = 1 shl 3; + // if any of the BORDER flags are set in a Gadget that's included in the Gadget list when a Window is opened, the corresponding Border will be adjusted to make room for the Gadget + GACT_RIGHTBORDER = 1 shl 4; + GACT_LEFTBORDER = 1 shl 5; + GACT_TOPBORDER = 1 shl 6; + GACT_BOTTOMBORDER = 1 shl 7; + GACT_TOGGLESELECT = 1 shl 8; // this bit for toggle-select mode + // should properly be in StringInfo, but aren't + GACT_STRINGLEFT = $0000; // NOTE WELL: that this has value zero + GACT_STRINGCENTER = 1 shl 9; + GACT_STRINGRIGHT = 1 shl 10; + GACT_LONGINT = 1 shl 11; // this String Gadget is for Long Ints + GACT_ALTKEYMAP = 1 shl 12; // this String has an alternate keymap + GACT_STRINGEXTEND = 1 shl 13; // this String Gadget has StringExtend NOTE: NEVER SET GACT_STRINGEXTEND IF YOU ARE RUNNING ON LESS THAN V36! SEE GFLG_STRINGEXTEND (ABOVE) INSTEAD + GACT_BOOLEXTEND = 1 shl 13; // this Boolean Gadget has a BoolInfo + GACT_ACTIVEGADGET = 1 shl 14; // this gadget is "active". This flag is maintained by Intuition, and you cannot count on its value persisting + // while you do something on your program's task. It can only be trusted by people implementing custom gadgets + GACT_BORDERSNIFF = 1 shl 15; // neither set nor rely on this bit + +// GADGET TYPES + {These are the Gadget type definitions for the variable GadgetType + gadget number type MUST start from one. NO TYPES OF ZERO ALLOWED. + first comes the mask for Gadget flags reserved for Gadget typing} + GTYP_GADGETTYPE = $FC00; // all Gadget Global type flags (padded) + GTYP_SYSTYPEMASK = $00F0; + // system gadgets + GTYP_SIZING = $0010; + GTYP_WDRAGGING = $0020; + GTYP_SDRAGGING = $0030; + GTYP_WDEPTH = $0040; + GTYP_SDEPTH = $0050; + GTYP_WZOOM = $0060; + GTYP_SUNUSED = $0070; + GTYP_CLOSE = $0080; + // application gadgets + GTYP_REQGADGET = 1 shl 12; // 1 = this is a Requester Gadget + GTYP_GZZGADGET = 1 shl 13; // 1 = for WFLG_GIMMEZEROZERO borders + GTYP_SCRGADGET = 1 shl 14; // 1 = ScreenGadget, 0 = WindowGadget + GTYP_SYSGADGET = 1 shl 15; // 1 = Allocated by the system, 0 = by app. + GTYP_BOOLGADGET = $0001; + GTYP_GADGET0002 = $0002; + GTYP_PROPGADGET = $0003; + GTYP_STRGADGET = $0004; + GTYP_CUSTOMGADGET = $0005; + GTYP_GTYPEMASK = $0007; //mask you can apply to tell what class of gadget this is. The possible classes follow. + +{ Gadgets which have the GFLG_EXTENDED flag set are + * actually ExtGadgets, which have more flags. The GMORE_xxx + * identifiers describe those flags. For GMORE_SCROLLRASTER, see + * important information in the ScrollWindowRaster() autodoc. + * NB: GMORE_SCROLLRASTER must be set before the gadget is + * added to a window. + } + GMORE_BOUNDS = 1 shl 0; // ExtGadget has valid Bounds + GMORE_GADGETHELP = 1 shl 1; // This gadget responds to gadget help + GMORE_SCROLLRASTER = 1 shl 2; // This (custom) gadget uses ScrollRaster + GMORE_BOOPSIGADGET = 1 shl 3; // some internal boopsi classes changes the gadget type during execution (ie propgclass), so GTYP_CUSTOMGADGET doesn´t work (dariusb) + +type + // Bool Gadget This is the special data needed by an Extended Boolean Gadget Typically this structure will be pointed to by the Gadget field SpecialInfo + PBoolInfo = ^TBoolInfo; + TBoolInfo = record + Flags: Word; // defined below (BOOLMASK) + Mask: PWord; // bit mask for highlighting and selecting mask must follow the same rules as an Image + // plane. It's width and height are determined by the width and height of the gadget's select box. (i.e. Gadget.Width and .Height). + Reserved: LongWord; // set to 0 + end; +const +// set BoolInfo.Flags to this flag bit. in the future, additional bits might mean more stuff hanging off of BoolInfo.Reserved. + BOOLMASK = 1 shl 0; // extension is for masked gadget +type + // Proportional Gadget this is the special data required by the proportional Gadget typically, this data will be pointed to by the Gadget variable SpecialInfo + PPropInfo = ^TPropInfo; + TPropInfo = record + Flags: Word; // general purpose flag bits (see defines below) + + { You initialize the Pot variables before the Gadget is added to + the system. Then you can look here for the current settings + any time, even while User is playing with this Gadget. To + adjust these after the Gadget is added to the System, use + ModifyProp(); The Pots are the actual proportional settings, + where a value of zero means zero and a value of MAXPOT means + that the Gadget is set to its maximum setting.} + HorizPot: Word; // 16-bit FixedPoint horizontal quantity percentage + VertPot: Word; // 16-bit FixedPoint vertical quantity percentage + { the 16-bit FixedPoint Body variables describe what percentage of + the entire body of stuff referred to by this Gadget is actually + shown at one time. This is used with the AUTOKNOB routines, + to adjust the size of the AUTOKNOB according to how much of + the data can be seen. This is also used to decide how far + to advance the Pots when User hits the Container of the Gadget. + For instance, if you were controlling the display of a 5-line + Window of text with this Gadget, and there was a total of 15 + lines that could be displayed, you would set the VertBody value to + (MAXBODY / (TotalLines / DisplayLines)) = MAXBODY / 3. + Therefore, the AUTOKNOB would fill 1/3 of the container, and + if User hits the Cotainer outside of the knob, the pot would + advance 1/3 (plus or minus) If there's no body to show, or + the total amount of displayable info is less than the display area, + set the Body variables to the MAX. To adjust these after the + Gadget is added to the System, use ModifyProp();} + HorizBody: Word; // horizontal Body + VertBody: Word; // vertical Body + // these are the variables that Intuition sets and maintains + CWidth: Word; // Container width (with any relativity absoluted) + CHeight: Word; // Container height (with any relativity absoluted) + HPotRes, + VPotRes: Word; // pot increments + LeftBorder: Word; // Container borders + TopBorder: Word; // Container borders + end; + +const +// Flags BITS + AUTOKNOB = 1 shl 0; // this flag sez: gimme that old auto-knob NOTE: if you do not use an AUTOKNOB for a proportional gadget, + // you are currently limited to using a single Image of your own design: Intuition won't handle a linked list + // of images as a proportional gadget knob. + FREEHORIZ = 1 shl 1; // IF set, the knob can move horizontally + FREEVERT = 1 shl 2; // IF set, the knob can move vertically + PROPBORDERLESS = 1 shl 3; // IF set, no border will be rendered + KNOBHIT = 1 shl 8; // set when this Knob is hit + PROPNEWLOOK = 1 shl 4; // set this IF you want to get the new look + + KNOBHMIN = 6; // minimum horizontal size of the Knob + KNOBVMIN = 4; // minimum vertical size of the Knob + MAXBODY = $FFFF; // maximum body value + MAXPOT = $FFFF; // maximum pot value + +type + // StringInfo this is the special data required by the string Gadget typically, this data will be pointed to by the Gadget variable SpecialInfo + PStringInfo = ^TStringInfo; + TStringInfo = record + // you initialize these variables, and then Intuition maintains them + Buffer: PChar; // the buffer containing the start and final string + UndoBuffer: PChar; // optional buffer for undoing current entry + BufferPos: SmallInt; // character position in Buffer + MaxChars: SmallInt; // max number of chars in Buffer (including #0) + DispPos: SmallInt; // Buffer position of first displayed character + // Intuition initializes and maintains these variables for you + UndoPos: SmallInt; // character position in the undo buffer + NumChars: SmallInt; // number of characters currently in Buffer + DispCount: SmallInt; // number of whole characters visible in Container + CLeft, + CTop: SmallInt; // topleft offset of the container + { you can initialize this variable before the gadget is submitted to + Intuition, and then examine it later to discover what LongInt + the user has entered (if the user never plays with the gadget, + the value will be unchanged from your initial setting)} + Extension: PStringExtend; + _LongInt: LongInt; + { If you want this Gadget to use your own Console keymapping, you + set the ALTKEYMAP bit in the Activation flags of the Gadget, and then + set this variable to point to your keymap. If you don't set the + ALTKEYMAP, you'll get the standard ASCII keymapping.} + AltKeyMap: PKeymap; + end; + +type + PImage = ^TImage; + PWindow = ^TWindow; + PScreen = ^TScreen; +// Requesters The following struct is used for standard intuition requesters (not to be mixed up with asl or easy requesters). See intuition.library/Request() for more information. + PRequester = ^TRequester; + TRequester = record + // the ClipRect and BitMap and used for rendering the requester + OlderRequest: PRequester; + LeftEdge, + TopEdge: SmallInt; // dimensions of the entire box + Width, + Height: SmallInt; // dimensions of the entire box + RelLeft, + RelTop: SmallInt; // for Pointer relativity offsets + + ReqGadget: PGadget; // First gadget of the requester + ReqBorder: PBorder; // First border of the requester + ReqText: PIntuiText; // First intuitext of the requester + + Flags: Word; // see definitions below + BackFill: Byte; // pen number for back-plane fill before draws + + ReqLayer: PLayer; // Layer in place of clip rect + + ReqPad1: array [0..31] of Byte; // Private + + { If the BitMap plane pointers are non-zero, this tells the system + that the image comes pre-drawn (if the appliprog wants to define + it's own box, in any shape or size it wants!); this is OK by + Intuition as long as there's a good correspondence between + the image and the specified Gadgets} + ImageBMap: PBitMap; // you may use this to fill the requester with your own image + RWindow: PWindow; // window, which the requester belongs to + ReqImage: PImage; // corresponds to USEREQIMAGE (see below) + ReqPad2: array[0..31] of ShortInt; // PRIVATE + end; + +{ The Timage.PlanePick and PlaneOnOff variables work much the same way as the equivalent GELS Bob variables. It's a space-saving + mechanism for image data. Rather than defining the image data for every plane of the RastPort, you need define data only + for the planes that are not entirely zero or one. As you define your Imagery, you will often find that most of the planes + ARE just as color selectors. For instance, if you're designing a two-color Gadget to use colors two and three, and the Gadget + will reside in a five-plane display, bit plane zero of your imagery would be all ones, bit plane one would have data that + describes the imagery, and bit planes two through four would be all zeroes. Using these flags allows you to avoid wasting all + that memory in this way: first, you specify which planes you want your data to appear in using the PlanePick variable. For + each bit set in the variable, the next "plane" of your image data is blitted to the display. For each bit clear in this + variable, the corresponding bit in PlaneOnOff is examined. If that bit is clear, a "plane" of zeroes will be used. + If the bit is set, ones will go out instead. So, for our example: + Gadget.PlanePick = $02; + Gadget.PlaneOnOff = $01; + Note that this also allows for generic Gadgets, like the System Gadgets, which will work in any number of bit planes. + Note also that if you want an Image that is only a filled rectangle, you can get this by setting PlanePick to zero + (pick no planes of data) and set PlaneOnOff to describe the pen color of the rectangle.} + +// This is a brief image structure for very simple transfers of image data to a RastPort + TImage = record + LeftEdge: SmallInt; // starting offset relative to some origin + TopEdge: SmallInt; // starting offsets relative to some origin + Width: SmallInt; // pixel size (though data is Word-aligned) + Height: SmallInt; + Depth: SmallInt; // pixel sizes + ImageData: PWord; // pointer to the actual Word-aligned bits + PlanePick, + PlaneOnOff: Byte; + NextImage: PImage; // if not nil, Intuition presumes that it points to another Image structure with another Image to be rendered + end; + +{ If your window sets WA_TabletMessages to TRUE, then it will receive extended IntuiMessages (struct ExtIntuiMessage) whose eim_TabletData + field points at a TabletData structure. This structure contains additional information about the input event.} + PTabletData = ^TTabletData; + TTabletData = record + td_XFraction, // Sub-pixel position of tablet, in screen coordinates, scaled to fill a Word fraction: + td_YFraction: Word; + td_TabletX, + td_TabletY: LongWord; // Current tablet coordinates along each axis + td_RangeX, + td_RangeY: LongWord; // Tablet range along each axis. For example, if td_TabletX can take values 0-999, td_RangeX should be 1000. + td_TagList: PTagItem; // Pointer to tag-list of additional tablet attributes. TABLETA_* + end; + +{ If a tablet driver supplies a hook for ient_CallBack, it will be invoked in the standard hook manner. A0 will point to the Hook + itself, A2 will point to the InputEvent that was sent, and A1 will point to a TabletHookData structure. The InputEvent's + ie_EventAddress field points at the IENewTablet structure that the driver supplied. + Based on the thd_Screen, thd_Width, and thd_Height fields, the driver should scale the ient_TabletX and ient_TabletY fields and store the + result in ient_ScaledX, ient_ScaledY, ient_ScaledXFraction, and ient_ScaledYFraction. + The tablet hook must currently return NULL. This is the only acceptable return-value.} + PTabletHookData = ^TTabletHookData; + TTabletHookData = record + thd_Screen: PScreen; // Pointer to the active screen: Note: if there are no open screens, thd_Screen will be nil. + thd_Width, // thd_Width and thd_Height will then describe an NTSC 64$400 screen. Please scale accordingly. + thd_Height: LongWord; // The width and height (measured in pixels of the active screen)that your are to scale to: + thd_ScreenChanged: LongInt; // Non-zero if the screen or something about the screen changed since the last time you were invoked: + end; + + PIntuiMessage = ^TIntuiMessage; + TIntuiMessage = record + ExecMessage: TMessage; + IClass: LongWord; // the Class bits correspond directly with the IDCMP Flags, except for the special bit LONELYMESSAGE (defined below) + Code: Word; // the Code field is for special values like MENU number + Qualifier: Word; // the Qualifier field is a copy of the current InputEvent's Qualifier + IAddress: APTR; // IAddress contains particular addresses for Intuition functions, like the pointer to the Gadget or the Screen + + MouseX, // when getting mouse movement reports, any event you get will have the the mouse coordinates in these variables. + MouseY: SmallInt; // the coordinates are relative to the upper-left corner of your Window (GIMMEZEROZERO notwithstanding) + Seconds, // the time values are copies of the current system clock time. + Micros: LongWord; // Micros are in units of microseconds, Seconds in seconds. + + IDCMPWindow: PWindow; // the IDCMPWindow variable will always have the Pointer of the Window of this IDCMP + SpecialLink: PIntuiMessage; // system-use variable + end; + +{ All IntuiMessages are now slightly extended. The ExtIntuiMessage + structure has an additional field for tablet data, which is usually + nil. If a tablet driver which is sending IESUBCLASS_NEWTABLET + events is installed in the system, windows with the WA_TabletMessages + property set will find that eim_TabletData points to the TabletData + structure. Applications must first check that this field is non-NULL; + it will be nil for certain kinds of message, including mouse activity + generated from other than the tablet (i.e. the keyboard equivalents + or the mouse itself). + NOTE: This structure is subject to grow in the future. Making + assumptions about its size is A BAD IDEA.} + + PExtIntuiMessage = ^TExtIntuiMessage; + TExtIntuiMessage = record + eim_IntuiMessage: TIntuiMessage; + eim_TabletData: PTabletData; + end; + + // A data structure common in Intuition processing + PIBox = ^TIBox; + TIBox = record + Left, + Top, + Width, + Height: SmallInt; + end; + +// Window + TWindow = record + NextWindow: PWindow; // for the linked list in a screen + + LeftEdge, + TopEdge: SmallInt; // screen dimensions of window + Width, + Height: SmallInt; // screen dimensions of window +{$ifdef AROS_FLAVOUR_BINCOMPAT} + MouseX, + MouseY: SmallInt; // relative to upper-left of window +{$else} + MouseY, + MouseX: SmallInt; // relative to upper-left of window +{$endif} + MinWidth, + MinHeight: SmallInt; // minimum sizes + MaxWidth, + MaxHeight: Word; // maximum sizes + + Flags: LongWord; // see below for defines + MenuStrip: PMenu; // the strip of Menu headers + Title: PChar; // the title text for this window + FirstRequest: PRequester; // all active Requesters + DMRequest: PRequester; // double-click Requester + ReqCount: SmallInt; // count of reqs blocking Window + WScreen: PScreen; // this Window's Screen + RPort: PRastPort; { this Window's very own RastPort } + { the border variables describe the window border. If you specify + GIMMEZEROZERO when you open the window, then the upper-left of the + ClipRect for this window will be upper-left of the BitMap (with correct + offsets when in SuperBitMap mode; you MUST select GIMMEZEROZERO when + using SuperBitMap). If you don't specify ZeroZero, then you save + memory (no allocation of RastPort, Layer, ClipRect and associated + Bitmaps), but you also must offset all your writes by BorderTop, + BorderLeft and do your own mini-clipping to prevent writing over the + system gadgets} + BorderLeft, + BorderTop, + BorderRight, + BorderBottom: ShortInt; + BorderRPort: PRastPort; + { You supply a linked-list of Gadgets for your Window. + This list DOES NOT include system gadgets. You get the standard + window system gadgets by setting flag-bits in the variable Flags (see + the bit definitions below)} + FirstGadget: PGadget; + Parent, + Descendant: PWindow; // these are for opening/closing the windows + + // sprite data iformation for your own Pointer set these AFTER you Open the Window by calling SetPointer() + _Pointer: PWord; // sprite data + PtrHeight: ShortInt; // sprite height (not including sprite padding) + PtrWidth: ShortInt; // sprite width (must be less than or equal to 16) + XOffset, + YOffset: ShortInt; // sprite offsets + + // the IDCMP Flags and User's and Intuition's Message Ports + IDCMPFlags: LongWord; // User-selected flags + UserPort, + WindowPort: PMsgPort; + MessageKey: PIntuiMessage; + + DetailPen, + BlockPen: Byte; // for bar/border/gadget rendering + CheckMark: PImage; // the CheckMark is a pointer to the imagery that will be used when rendering MenuItems of this Window that want to be checkmarked if this is equal to NULL, you'll get the default imagery + ScreenTitle: PChar; // if non-nil, Screen title when Window is active + + { These variables have the mouse coordinates relative to the + inner-Window of GIMMEZEROZERO Windows. This is compared with the + MouseX and MouseY variables, which contain the mouse coordinates + relative to the upper-left corner of the Window, GIMMEZEROZERO + notwithstanding} + GZZMouseX: SmallInt; + GZZMouseY: SmallInt; + GZZWidth: SmallInt; // these variables contain the width and height of the inner-Window of GIMMEZEROZERO Windows + GZZHeight: SmallInt; + + ExtData: PByte; + UserData: PSmallInt; // general-purpose pointer to User data extension + + WLayer: PLayer; + IFont: PTextFont; + + MoreFlags: LongWord; + + RelLeftEdge: SmallInt; // relative coordinates of the window to its parent window. If it is + RelTopEdge: SmallInt; // a window on the screen then these are the same as LeftEdge and TopEdge. + + FirstChild: PWindow; // pointer to first child + PrevChild: PWindow; // if window is a child of a window + NextChild: PWindow; // then they are concatenated here. + Parent2: PWindow; // parent of this window + // Data beyond this point are Intuition Private. DO NOT USE + end; + + TScreen = record + NextScreen: PScreen; // linked list of screens + FirstWindow: PWindow; // linked list Screen's Windows + + LeftEdge, + TopEdge: SmallInt; // parameters of the screen + Width, + Height: SmallInt; // parameters of the screen + +{$ifdef AROS_FLAVOUR_BINCOMPAT} + MouseY, + MouseX: SmallInt; // position relative to upper-left +{$else} + MouseX, + MouseY: SmallInt; // position relative to upper-left +{$endif} + + Flags: Word; // see definitions below + Title: PChar; // null-terminated Title text + DefaultTitle: PChar; // for Windows without ScreenTitle + + // Bar sizes for this Screen and all Window's in this Screen + BarHeight, + BarVBorder, + BarHBorder, + MenuVBorder, + MenuHBorder: ShortInt; + WBorTop, + WBorLeft, + WBorRight, + WBorBottom: ShortInt; + + Font: PTextAttr; // this screen's default font + + // the display data structures for this Screen (note the prefix S) + ViewPort: TViewPort; // describing the Screen's display + RastPort: TRastPort; // describing Screen rendering + BitMap: TBitMap; // extra copy of RastPort BitMap obsolete + LayerInfo: TLayer_Info; // each screen gets a LayerInfo + + // You supply a linked-list of Gadgets for your Screen. This list DOES NOT include system Gadgets. You get the standard system Screen Gadgets by default + FirstGadget: PGadget; + + DetailPen, + BlockPen: Byte; // for bar/border/gadget rendering + + // the following variable(s) are maintained by Intuition to support the DisplayBeep() color flashing technique + SaveColor0: Word; + BarLayer: PLayer; // This layer is for the Screen and Menu bars + ExtData: Pointer; + UserData: Pointer; + { general-purpose pointer to User data extension + **** Data below this point are SYSTEM PRIVATE ****} + end; + +const +// IDCMP Classes + // Please refer to the Autodoc for OpenWindow() and to the Rom Kernel Manual for full details on the IDCMP classes. + IDCMP_SIZEVERIFY = 1 shl 0; + IDCMP_NEWSIZE = 1 shl 1; + IDCMP_REFRESHWINDOW = 1 shl 2; + IDCMP_MOUSEBUTTONS = 1 shl 3; + IDCMP_MOUSEMOVE = 1 shl 4; + IDCMP_GADGETDOWN = 1 shl 5; + IDCMP_GADGETUP = 1 shl 6; + IDCMP_REQSET = 1 shl 7; + IDCMP_MENUPICK = 1 shl 8; + IDCMP_CLOSEWINDOW = 1 shl 9; + IDCMP_RAWKEY = 1 shl 10; + IDCMP_REQVERIFY = 1 shl 11; + IDCMP_REQCLEAR = 1 shl 12; + IDCMP_MENUVERIFY = 1 shl 13; + IDCMP_NEWPREFS = 1 shl 14; + IDCMP_DISKINSERTED = 1 shl 15; + IDCMP_DISKREMOVED = 1 shl 16; + IDCMP_WBENCHMESSAGE = 1 shl 17; // System use only + IDCMP_ACTIVEWINDOW = 1 shl 18; + IDCMP_INACTIVEWINDOW = 1 shl 19; + IDCMP_DELTAMOVE = 1 shl 20; + IDCMP_VANILLAKEY = 1 shl 21; + IDCMP_INTUITICKS = 1 shl 22; + IDCMP_IDCMPUPDATE = 1 shl 23; // for notifications from "boopsi" gadgets + IDCMP_MENUHELP = 1 shl 24; // for getting help key report during menu session + IDCMP_CHANGEWINDOW = 1 shl 25; // for notification of any move/size/zoom/change window + IDCMP_GADGETHELP = 1 shl 26; + IDCMP_LONELYMESSAGE = 1 shl 31; { the IDCMP Flags do not use this special bit, which is cleared when + Intuition sends its special message to the Task, and set when Intuition + gets its Message back from the Task. Therefore, I can check here to + find out fast whether or not this Message is available for me to send } + +// IDCMP Codes + // This group of codes is for the IDCMP_CHANGEWINDOW message + CWCODE_MOVESIZE = 0; // Window was moved and/or sized + CWCODE_DEPTH = 1; // Window was depth-arranged + // This group of codes is for the IDCMP_MENUVERIFY function + MENUHOT = 1; // IntuiWants verification OR MENUCANCEL + MENUCANCEL = 2; // HOT Reply of this cancels Menu operation + MENUWAITING = 3; // Intuition simply wants a ReplyMsg() ASAP + // These are internal tokens to represent state of verification attempts shown here as a clue. + OKOK = 1; // guy didn't care + OKABORT = 4; // window rendered question moot + OKCANCEL = 2; // window sent cancel reply + // This group of codes is for the IDCMP_WBENCHMESSAGE messages + WBENCHOPEN = 1; + WBENCHCLOSE = 2; + +type + PNewWindow = ^TNewWindow; + TNewWindow = record + LeftEdge, + TopEdge: SmallInt; // screen dimensions of window + Width, + Height: SmallInt; // screen dimensions of window + + DetailPen, + BlockPen: Byte; // for bar/border/gadget rendering + + IDCMPFlags: LongWord; // User-selected IDCMP flags + Flags: LongWord; // see Window struct for defines + + FirstGadget: PGadget; { You supply a linked-list of Gadgets for your Window. + This list DOES NOT include system Gadgets. You get the standard + system Window Gadgets by setting flag-bits in the variable Flags (see + the bit definitions under the Window structure definition)} + CheckMark: PImage; { the CheckMark is a pointer to the imagery that will be used when + rendering MenuItems of this Window that want to be checkmarked + if this is equal to NULL, you'll get the default imagery} + Title: PChar; // the title text for this window + Screen: PScreen; { the Screen pointer is used only if you've defined a CUSTOMSCREEN and + want this Window to open in it. If so, you pass the Pointer of the + Custom Screen structure in this variable. Otherwise, this variable + is ignored and doesn't have to be initialized.} + BitMap: PBitMap; { SUPER_BITMAP Window? If so, put the Pointer of your BitMap structure + in this variable. If not, this variable is ignored and doesn't have + to be initialized} + { the values describe the minimum and maximum sizes of your Windows. + these matter only if you've chosen the WINDOWSIZING Gadget option, + which means that you want to let the User to change the size of + this Window. You describe the minimum and maximum sizes that the + Window can grow by setting these variables. You can initialize + any one these to zero, which will mean that you want to duplicate + the setting for that dimension (if MinWidth == 0, MinWidth will be + set to the opening Width of the Window). + You can change these settings later using SetWindowLimits(). + If you haven't asked for a SIZING Gadget, you don't have to + initialize any of these variables.} + MinWidth, + MinHeight: SmallInt; // minimums + MaxWidth, + MaxHeight: Word; // maximums + + WType: Word; { the type variable describes the Screen in which you want this Window to + open. The type value can either be CUSTOMSCREEN or one of the + system standard Screen Types such as WBENCHSCREEN. See the + type definitions under the Screen structure} + end; + + +{ The following structure is the future NewWindow. Compatibility + issues require that the size of NewWindow not change. + Data in the common part (NewWindow) indicates the the extension + fields are being used. + NOTE WELL: This structure may be subject to future extension. + Writing code depending on its size is not allowed. + } + PExtNewWindow = ^TExtNewWindow; + TExtNewWindow = record + LeftEdge, + TopEdge: SmallInt; + Width, + Height: SmallInt; + + DetailPen, + BlockPen: Byte; + + IDCMPFlags: LongWord; + Flags: LongWord; + + FirstGadget: PGadget; + CheckMark: PImage; + Title: PChar; + WScreen: PScreen; + WBitMap: PBitMap; + + MinWidth, + MinHeight: SmallInt; + MaxWidth, + MaxHeight: Word; + + { the type variable describes the Screen in which you want this Window to + open. The type value can either be CUSTOMSCREEN or one of the + system standard Screen Types such as WBENCHSCREEN. See the + type definitions under the Screen structure. + A new possible value for this field is PUBLICSCREEN, which + defines the window as a 'visitor' window. See below for + additional information provided.} + WType: Word; + + { if the NewWindow Flag value WFLG_NW_EXTENDED is set, then + this field is assumed to point to an array ( or chain of arrays) + of TagItem structures. See also ExtNewScreen for another + use of TagItems to pass optional data. + see below for tag values and the corresponding data.} + Extension: PTagItem; + end; + +const + TAG_DONE = 0; { terminates array of TagItems. ti_Data unused } + TAG_END = TAG_DONE; + +{ The TagItem ID's (ti_Tag values) for OpenWindowTagList() follow. + They are values in a TagItem array passed as extension/replacement + values for the data in NewWindow. OpenWindowTagList() can actually + work well with a nil NewWindow pointer. } + WA_Dummy = TAG_USER + 99; { $80000063 } + // these tags simply override NewWindow parameters + WA_Left = WA_Dummy + 1; + WA_Top = WA_Dummy + 2; + WA_Width = WA_Dummy + 3; + WA_Height = WA_Dummy + 4; + WA_DetailPen = WA_Dummy + 5; + WA_BlockPen = WA_Dummy + 6; + WA_IDCMP = WA_Dummy + 7; + WA_Flags = WA_Dummy + 8; // "bulk" initialization of NewWindow.Flags + WA_Gadgets = WA_Dummy + 9; + WA_Checkmark = WA_Dummy + 10; + WA_Title = WA_Dummy + 11; // means you don't have to call SetWindowTitles after you open your window + WA_ScreenTitle = WA_Dummy + 12; + WA_CustomScreen = WA_Dummy + 13; + WA_SuperBitMap = WA_Dummy + 14; + // also implies WFLG_SUPER_BITMAP property + WA_MinWidth = WA_Dummy + 15; + WA_MinHeight = WA_Dummy + 16; + WA_MaxWidth = WA_Dummy + 17; + WA_MaxHeight = WA_Dummy + 18; + WA_InnerWidth = WA_Dummy + 19; + WA_InnerHeight = WA_Dummy + 20; { You can specify the dimensions of the interior region of your window, independent of what the border widths will be. You probably want + to also specify WA_AutoAdjust to allow Intuition to move your window or even shrink it so that it is completely on screen.} + WA_PubScreenName = WA_Dummy + 21; // declares that you want the window to open as a visitor on the public screen whose name is pointed to by (PChar) ti_Data} + WA_PubScreen = WA_Dummy + 22; { open as a visitor window on the public screen whose Pointer is in (PScreen) ti_Data. To ensure that this screen remains open, you + should either be the screen's owner, have a window open on the screen, or use LockPubScreen().} + WA_PubScreenFallBack = WA_Dummy + 23; { A Boolean, specifies whether a visitor window should "fall back" to the default public screen + (or Workbench) if the named public screen isn't available} + WA_WindowName = WA_Dummy + 24; + WA_Colors = WA_Dummy + 25 unimplemented; + { a ColorSpec array for colors to be set when this window is active. This is not implemented, and may not be, since the default + values to restore would be hard to track. We'd like to at least support per-window colors for the mouse pointer sprite.} + WA_Zoom = WA_Dummy + 26; { ti_Data points to an array of four Word's, the initial Left/Top/Width/Height values of the "alternate" zoom position/dimensions. + It also specifies that you want a Zoom gadget for your window, whether or not you have a sizing gadget.} + WA_MouseQueue = WA_Dummy + 27; // ti_Data contains initial value for the mouse message backlog limit for this window + WA_BackFill = WA_Dummy + 28; // provides a "backfill hook" for your window's layer. + WA_RptQueue = WA_Dummy + 29; // initial value of repeat key backlog limit + WA_SizeGadget = WA_Dummy + 30; // These Boolean tag items are alternatives to the NewWindow.Flags boolean flags with similar names. + WA_DragBar = WA_Dummy + 31; + WA_DepthGadget = WA_Dummy + 32; + WA_CloseGadget = WA_Dummy + 33; + WA_Backdrop = WA_Dummy + 34; + WA_ReportMouse = WA_Dummy + 35; + WA_NoCareRefresh = WA_Dummy + 36; + WA_Borderless = WA_Dummy + 37; + WA_Activate = WA_Dummy + 38; + WA_RMBTrap = WA_Dummy + 39; + WA_WBenchWindow = WA_Dummy + 40; // PRIVATE!! + WA_SimpleRefresh = WA_Dummy + 41; // only specify if True + WA_SmartRefresh = WA_Dummy + 42; // only specify if True + WA_SizeBRight = WA_Dummy + 43; + WA_SizeBBottom = WA_Dummy + 44; + WA_AutoAdjust = WA_Dummy + 45; // shift or squeeze the window's position and dimensions to fit it on screen. + WA_GimmeZeroZero = WA_Dummy + 46; // equiv. to NewWindow.Flags WFLG_GIMMEZEROZERO + WA_MenuHelp = WA_Dummy + 47; // Enables IDCMP_MENUHELP: Pressing HELP during menus will return IDCMP_MENUHELP message. + WA_NewLookMenus = WA_Dummy + 48; // Set to True if you want NewLook menus + WA_AmigaKey = WA_Dummy + 49; // Pointer to image for Amiga-key equiv in menus + WA_NotifyDepth = WA_Dummy + 50; // Requests IDCMP_CHANGEWINDOW message when window is depth arranged (imsg^.Code = CWCODE_DEPTH) + // WA_Dummy + 51 is obsolete + WA_Pointer = WA_Dummy + 52; { Allows you to specify a custom pointer for your window. ti_Data points to a pointer object you obtained via + "pointerclass". NULL signifies the default pointer. This tag may be passed to OpenWindowTags() or SetWindowPointer().} + WA_BusyPointer = WA_Dummy + 53; { ti_Data is boolean. Set to True to request the standard busy pointer. This tag may be passed to OpenWindowTags() or SetWindowPointer().} + WA_PointerDelay = WA_Dummy + 54; { ti_Data is boolean. Set to True to request that the changing of the pointer be slightly delayed. The change + will be called off if you call NewSetPointer() before the delay expires. This allows you to post a busy-pointer even if you think + the busy-time may be very Word, without fear of a flashing pointer. This tag may be passed to OpenWindowTags() or SetWindowPointer().} + WA_TabletMessages = WA_Dummy + 55; { ti_Data is a boolean. Set to True to request that tablet information be included in IntuiMessages sent to your window. + Requires that something (i.e. a tablet driver) feed IESUBCLASS_NEWTABLET InputEvents into the system. For a pointer to the TabletData, + examine the ExtIntuiMessage^.eim_TabletData field. It is UNSAFE to check this field when running on pre-V39 systems. It's always + safe to check this field under V39 and up, though it may be nil.} + WA_HelpGroup = WA_Dummy + 56; { When the active window has gadget help enabled, other windows of the same HelpGroup number will also get GadgetHelp. This allows GadgetHelp + to work for multi-windowed applications. Use GetGroupID() to get an ID number. Pass this number as ti_Data to all your windows. See also the HelpControl() function.} + WA_HelpGroupWindow = WA_Dummy + 57; { When the active window has gadget help enabled, other windows of the same HelpGroup will also get GadgetHelp. This allows GadgetHelp to work + for multi-windowed applications. As an alternative to WA_HelpGroup, you can pass a pointer to any other window of the same group to join its help + group. Defaults to NULL, which has no effect. See also the HelpControl() function.} + WA_ToolBox = WA_Dummy + 58; // (LongBool) Make this window a Toolbox window + + // AROS specific tags + WA_Priority = WA_Dummy + 100; + WA_Parent = WA_Dummy + 101; // (PWindow) Make the window a child of the parent Window + WA_InFrontOf = WA_Dummy + 102; + WA_Behind = WA_Dummy + 103; + WA_Visible = WA_Dummy + 104; // (LongBool) Make window visible. default True + WA_Shape = WA_Dummy + 105; // (PRegion) + WA_ShapeHook = WA_Dummy + 106; // (PHook) + +// --- Flags requested at OpenWindow() time by the application + WFLG_SIZEGADGET = 1 shl 0; // include sizing system-gadget + WFLG_DRAGBAR = 1 shl 1; // include dragging system-gadget + WFLG_DEPTHGADGET = 1 shl 2; // include depth arrangement gadget + WFLG_CLOSEGADGET = 1 shl 3; // include close-box system-gadget + WFLG_SIZEBRIGHT = 1 shl 4; // size gadget uses right border + WFLG_SIZEBBOTTOM = 1 shl 5; // size gadget uses bottom border + // refresh modes combinations of the WFLG_REFRESHBITS select the refresh type + WFLG_SMART_REFRESH = 0; + WFLG_SIMPLE_REFRESH = 1 shl 6; + WFLG_SUPER_BITMAP = 1 shl 7; + WFLG_OTHER_REFRESH = (1 shl 6) or (1 shl 7); + WFLG_REFRESHBITS = WFLG_OTHER_REFRESH; + + WFLG_BACKDROP = 1 shl 8; // this is a backdrop window + WFLG_REPORTMOUSE = 1 shl 9; // to hear about every mouse move + WFLG_GIMMEZEROZERO = 1 shl 10; // a GimmeZeroZero window + WFLG_BORDERLESS = 1 shl 11; // to get a Window sans border + WFLG_ACTIVATE = 1 shl 12; // when Window opens, it's Active + // Private + WFLG_WINDOWACTIVE = 1 shl 13; // this window is the active one + WFLG_INREQUEST = 1 shl 14; // this window is in request mode + WFLG_MENUSTATE = 1 shl 15; // Window is active with Menus on + // Other User Flags + WFLG_RMBTRAP = 1 shl 16; // Catch RMB events for your own + WFLG_NOCAREREFRESH = 1 shl 17; // not to be bothered with REFRESH + WFLG_NW_EXTENDED = 1 shl 18; // extension data provided see struct ExtNewWindow + + WFLG_NEWLOOKMENUS = 1 shl 21; // window has NewLook menus + + // These flags are set only by Intuition. YOU MAY NOT SET THEM YOURSELF! + WFLG_WINDOWREFRESH = 1 shl 24; // Window is currently refreshing + WFLG_WBENCHWINDOW = 1 shl 25; // WorkBench tool ONLY Window + WFLG_WINDOWTICKED = 1 shl 26; // only one timer tick at a time + WFLG_VISITOR = 1 shl 27; // visitor window + WFLG_ZOOMED = 1 shl 28; // identifies "zoom state" + WFLG_HASZOOM = 1 shl 29; // windowhas a zoom gadget + WFLG_TOOLBOX = 1 shl 30; + // Other Window Values + DEFAULTMOUSEQUEUE = 5; // no more mouse messages + // see struct IntuiMessage for the IDCMP Flag definitions + + // HelpControl() flags: HC_GADGETHELP - Set this flag to enable Gadget-Help for one or more windows. + HC_GADGETHELP = 1; + +const +// Flags for TRequester.Flags + // set by Application + POINTREL = 1 shl 0; // if POINTREL set, TopLeft is relative to pointer to the coordinates of either the pointer or the window + PREDRAWN = 1 shl 1; // If set, ImageBMap points to a custom bitmap + NOISYREQ = 1 shl 2; // Requester doesn't filter input + SIMPLEREQ = 1 shl 4; // If set, a SIMPLEREFRESH layer is used + USEREQIMAGE = 1 shl 5; // render linked list ReqImage after BackFill but before gadgets and text + NOREQBACKFILL = 1 shl 6; // don't bother filling requester with Requester.BackFill pen + // Read only Flags set by Intuition + REQOFFWINDOW = 1 shl 12; // part of one of the Gadgets was offwindow + REQACTIVE = 1 shl 13; // this requester is active + SYSREQUEST = 1 shl 14; // this requester caused by system + DEFERREFRESH = 1 shl 15; // this Requester stops a Refresh broadcast + + +{ Intuition supports the IESUBCLASS_NEWTABLET subclass of the IECLASS_NEWPOINTERPOS event. The ie_EventAddress of such an event points to a TabletData structure (see below). + The TabletData structure contains certain elements including a taglist.The taglist can be used for special tablet parameters. A tablet driver + should include only those tag-items the tablet supports. An application can listen for any tag-items that interest it. Note: an application + must set the WA_TabletMessages attribute to TRUE to receive this extended information in its IntuiMessages. + The definitions given here MUST be followed. Pay careful attention + to normalization and the interpretation of signs. + Note: a stylus that supports tilt should use the TABLETA_AngleX + and TABLETA_AngleY attributes. Tilting the stylus so the tip + points towards increasing or decreasing X is actually a rotation + around the Y-axis. Thus, if the stylus tip points towards + positive X, then that tilt is represented as a negative + TABLETA_AngleY. Likewise, if the stylus tip points towards + positive Y, that tilt is represented by positive TABLETA_AngleX.} +const + TABLETA_Dummy = TAG_USER + $3A000; + TABLETA_TabletZ = TABLETA_Dummy + $01; // the current value of the tablet in the Z direction. This unsigned value should typically be in the natural units of the + // tablet. You should also provide TABLETA_RangeZ. + TABLETA_RangeZ = TABLETA_Dummy + $02; // the maximum value of the tablet in the Z direction. Normally specified along with TABLETA_TabletZ, this allows the + // application to scale the actual Z value across its range. + TABLETA_AngleX = TABLETA_Dummy + $03; // the angle of rotation or tilt about the X-axis. This number should be normalized to fill a signed long LongInt. Positive + // values imply a clockwise rotation about the X-axis when viewing from +X towards the origin. + TABLETA_AngleY = TABLETA_Dummy + $04; // the angle of rotation or tilt about the Y-axis. This number should be normalized to fill a signed long LongInt. Positive + // values imply a clockwise rotation about the Y-axis when viewing from +Y towards the origin. + TABLETA_AngleZ = TABLETA_Dummy + $05; // the angle of rotation or tilt about the Z axis. This number should be normalized to fill a signed long LongInt. Positive + // values imply a clockwise rotation about the Z-axis when viewing from +Z towards the origin. + TABLETA_Pressure = TABLETA_Dummy + $06; { the pressure reading of the stylus. The pressure should be normalized to fill a signed long LongInt. Typical devices + won't generate negative pressure, but the possibility is not precluded. The pressure threshold which is considered to cause a button-click is + expected to be set in a Preferences program supplied by the tablet vendor. The tablet driver would send IECODE_LBUTTON-type events as + the pressure crossed that threshold.} + TABLETA_ButtonBits = TABLETA_Dummy + $07; // ti_Data is a long LongInt whose bits are to be interpreted at the state of the first 32 buttons of the tablet. + TABLETA_InProximity = TABLETA_Dummy + $08; { ti_Data is a boolean. For tablets that support proximity, they should send the (TABLETA_InProximity,FALSE) tag item + when the stylus is out of proximity. One possible use we can forsee is a mouse-blanking commodity which keys off this to blank the + mouse. When this tag is absent, the stylus is assumed to be in proximity.} + TABLETA_ResolutionX = TABLETA_Dummy + $09; // ti_Data is an unsigned long LongInt which is the x-axis resolution in dots per inch. + TABLETA_ResolutionY = TABLETA_Dummy + $0A; // ti_Data is an unsigned long LongInt which is the y-axis resolution in dots per inch. + +type + // this structure is used for remembering what memory has been allocated to date by a given routine, + // so that a premature abort or systematic exit can deallocate memory cleanly, easily, and completely + PRemember = ^TRemember; + TRemember = record + NextRemember: PRemember; + RememberSize: LongWord; + Memory: PByte; + end; + +// How to tell Intuition about RGB values for a color table entry. } + PColorSpec = ^TColorSpec; + TColorSpec = record + ColorIndex: SmallInt; // -1 terminates an array of ColorSpec + Red: Word; // only the _bottom_ 4 bits recognized + Green: Word; // only the _bottom_ 4 bits recognized + Blue: Word; // only the _bottom_ 4 bits recognized + end; + +// Easy Requester Specification see also autodocs for EasyRequest and BuildEasyRequest NOTE: This structure may grow in size in the future + PEasyStruct = ^TEasyStruct; + TEasyStruct = record + es_StructSize: LongWord; // should be sizeof (TEasyStruct) Note that this size may change, if you update the includes! Do not use absolute values as the size of pointers may vary on different platforms! + es_Flags: LongWord; // should be 0 for now + es_Title: PChar; // title of requester window + es_TextFormat: PChar; // 'printf' style formatting string + es_GadgetFormat: PChar; // Text of the gadgets, separated by |'s + end; + +const +// These are the AlertNumber defines. if you are calling DisplayAlert() the AlertNumber you supply must have the ALERT_TYPE bits set to one of these patterns + ALERT_TYPE = $80000000; + RECOVERY_ALERT = $00000000; // the system can recover from this + DEADEND_ALERT = $80000000; // no recovery possible, this is it + +{ When you're defining IntuiText for the Positive and Negative Gadgets created by a call to AutoRequest(), these defines will get you + reasonable-looking text. The only field without a define is the IText field; you decide what text goes with the Gadget} + AUTOFRONTPEN = 0; + AUTOBACKPEN = 1; + AUTODRAWMODE = JAM2; + AUTOLEFTEDGE = 6; + AUTOTOPEDGE = 3; + AUTOITEXTFONT = nil; + AUTONEXTTEXT = nil; + +// RAWMOUSE Codes and Qualifiers (Console OR <IDCMP) + SELECTDOWN = IECODE_LBUTTON; + SELECTUP = IECODE_LBUTTON or IECODE_UP_PREFIX; + MENUDOWN = IECODE_RBUTTON; + MENUUP = IECODE_RBUTTON or IECODE_UP_PREFIX; + MIDDLEDOWN = IECODE_MBUTTON; + MIDDLEUP = IECODE_MBUTTON or IECODE_UP_PREFIX; + ALTLEFT = IEQUALIFIER_LALT; + ALTRIGHT = IEQUALIFIER_RALT; + AMIGALEFT = IEQUALIFIER_LCOMMAND; + AMIGARIGHT = IEQUALIFIER_RCOMMAND; + AMIGAKEYS = AMIGALEFT or AMIGARIGHT; + + CURSORUP = $4C; + CURSORDOWN = $4D; + CURSORRIGHT = $4E; + CURSORLEFT = $4F; + + KEYCODE_Q = $10; + KEYCODE_Z = $31; + KEYCODE_X = $32; + KEYCODE_V = $34; + KEYCODE_B = $35; + KEYCODE_N = $36; + KEYCODE_M = $37; + KEYCODE_LESS = $38; + KEYCODE_GREATER = $39; + +const +// these are the display modes for which we have corresponding parameter settings in the config arrays + HIRESPICK = $0000; + LOWRESPICK = $0001; + DMODECOUNT = $0002; // how many modes there are + // these are the system Gadget defines + HIRESGADGET = 0; + LOWRESGADGET = 1; + RESCOUNT = 2; + + UPFRONTGADGET = 0; + DOWNBACKGADGET = 1; + SIZEGADGET = 2; + CLOSEGADGET = 3; + DRAGGADGET = 4; + SUPFRONTGADGET = 5; + SDOWNBACKGADGET = 6; + SDRAGGADGET = 7; + GADGETCOUNT = 8; + + EVENTMAX = 10; // size of event array + +type + // This is a packet of information for graphics rendering. It originates with a Screen, and is gotten using GetScreenDrawInfo( screen ); + PDrawInfo = ^TDrawInfo; + TDrawInfo = record + dri_Version: Word; // will be DRI_VERSION + dri_NumPens: Word; // guaranteed to be >= numDrIPens + dri_Pens: PWord; // pointer to pen array + dri_Font: PTextFont; // screen default font + dri_Depth: Word; // (initial) depth of screen bitmap + + dri_Resolution: record + x: Word; // from DisplayInfo database for initial display mode + y: Word; + end; + + dri_Flags: LongWord; // defined below (DIRF_*) + + dri_CheckMark: PImage; // pointer to scaled checkmark image Will be nil if DRI_VERSION < 2 + dri_AmigaKey: PImage; // pointer to scaled Amiga-key image Will be NULL if DRI_VERSION < 2 + + dri_Reserved: array[0..4] of LongWord; // avoid recompilation ;^) + end; + +const + + // If you find dri_Version >= DRI_VERSION, you know this structure has at least the fields defined in this version of the include file + DRI_VERSION = 2; + // dri_Flags + DRIF_NEWLOOK = 1 shl 0; // specified SA_Pens, full treatment + DRIF_DIRECTCOLOR = 1 shl 1; + // rendering pen number indexes into DrawInfo.dri_Pens[] + DETAILPEN = 0; // compatible Intuition rendering pens + BLOCKPEN = 1; // compatible Intuition rendering pens + TEXTPEN = 2; // text on background + SHINEPEN = 3; // bright edge on 3D objects + SHADOWPEN = 4; // dark edge on 3D objects + FILLPEN = 5; // active-window/selected-gadget fill + FILLTEXTPEN = 6; // text over FILLPEN + BACKGROUNDPEN = 7; // always color 0 + HIGHLIGHTTEXTPEN = 8; // special color text, on background + // Only present if DRI_VERSION >= 2 + BARDETAILPEN = 9; // text/detail in screen-bar/menus + BARBLOCKPEN = 10; // screen-bar/menus fill + BARTRIMPEN = 11; // trim under screen-bar + NUMDRIPENS = 12; + +//It is sometimes useful to specify that a pen value is to be the complement of color zero to three. The "magic" numbers serve that purpose: + PEN_C3 = $FEFC; // Complement of color 3 + PEN_C2 = $FEFD; // Complement of color 2 + PEN_C1 = $FEFE; // Complement of color 1 + PEN_C0 = $FEFF; // Complement of color 0 + +// values for ChangeDecoration ID param + DECORATION_SET = $8001; + DECORATION_DEFAULT = $8000; + +// OpenScreen error codes, which are returned in the (optional) LongIng pointed to by ti_Data for the SA_ErrorCode tag item + OSERR_NOMONITOR = 1; // named monitor spec not available + OSERR_NOCHIPS = 2; // you need newer custom chips + OSERR_NOMEM = 3; // couldn't get normal memory + OSERR_NOCHIPMEM = 4; // couldn't get chipmem + OSERR_PUBNOTUNIQUE = 5; // public screen name already used + OSERR_UNKNOWNMODE = 6; // don't recognize mode asked for + OSERR_TOODEEP = 7; + OSERR_ATTACHFAIL = 8; + OSERR_NOTAVAILABLE = 9; + +// The SCREENTYPE bits are reserved for describing various Screen types available under Intuition. + // The screen flags have the suffix "_f" added to avoid conflicts with routine names. + // Screen^.Flags and (Ext)NewScreen^.Type + WBENCHSCREEN_f = 1 shl 0; // Ta Da! The Workbench + PUBLICSCREEN_f = 1 shl 1; + CUSTOMSCREEN_f = $000F; // for that special look + SCREENTYPE_f = $000F; // all the screens types available + // Screen^.Flags + SHOWTITLE_f = 1 shl 4; // this gets set by a call to ShowTitle() + BEEPING_f = 1 shl 5; // set when Screen is beeping + CUSTOMBITMAP_f = 1 shl 6; // if you are supplying your own BitMap + SCREENBEHIND_f = 1 shl 7; // if you want your screen to open behind already open screens + SCREENQUIET_f = 1 shl 8; // if you do not want Intuition to render into your screen (gadgets, title) + SCREENHIRES = 1 shl 9; // do no use lowres gadgets (private) + PENSHARED = 1 shl 10; // Screen opener set (SA_SharePens,True) + NS_EXTENDED = 1 shl 12; // ExtNewScreen.Extension is valid + AUTOSCROLL = 1 shl 14; // screen is to autoscoll + + STDSCREENHEIGHT = -1; // supply in NewScreen.Height + STDSCREENWIDTH = -1; // supply in NewScreen.Width + +const + // Screen attribute tag ID's. These are used in the ti_Tag field of TagItem arrays passed to OpenScreenTagList() (or in the ExtNewScreen.Extension field). + SA_Dummy = TAG_USER + 32; + // these items specify items equivalent to fields in NewScreen + SA_Left = SA_Dummy + 1; + SA_Top = SA_Dummy + 2; + SA_Width = SA_Dummy + 3; + SA_Height = SA_Dummy + 4; // traditional screen positions and dimensions + SA_Depth = SA_Dummy + 5; // screen bitmap depth + SA_DetailPen = SA_Dummy + 6; //serves as default for windows, too + SA_BlockPen = SA_Dummy + 7; + SA_Title = SA_Dummy + 8; // default screen title + SA_Colors = SA_Dummy + 9; // ti_Data is an array of struct ColorSpec, terminated by ColorIndex = -1. Specifies initial screen palette colors. + SA_ErrorCode = SA_Dummy + 10; // ti_Data points to LONG error code (values below) + SA_Font = SA_Dummy + 11; // equiv. to NewScreen.Font + SA_SysFont = SA_Dummy + 12; // Selects one of the preferences system fonts: 0 - old DefaultFont, fixed-width 1 - WB Screen preferred font + SA_Type = SA_Dummy + 13; // equiv. to NewScreen.type + SA_BitMap = SA_Dummy + 14; // ti_Data is pointer to custom BitMap. This implies type of CUSTOMBITMAP + SA_PubName = SA_Dummy + 15; // presence of this tag means that the screen is to be a public screen. Please specify BEFORE the two tags below + SA_PubSig = SA_Dummy + 16; + SA_PubTask = SA_Dummy + 17; // Task ID and signal for being notified that the last window has closed on a public screen. + SA_DisplayID = SA_Dummy + 18; // ti_Data is new extended display ID + SA_DClip = SA_Dummy + 19; // ti_Data points to a rectangle which defines screen display clip region + SA_Overscan = SA_Dummy + 20; { was S_STDDCLIP. Set to one of the OSCAN_* specifiers below to get a system standard + overscan region for your display clip, screen dimensions (unless otherwise specified), + and automatically centered position (partial support only so far). + If you use this, you shouldn't specify SA_DClip. SA_Overscan is for "standard" + overscan dimensions, SA_DClip is for your custom numeric specifications.} + SA_ShowTitle = SA_Dummy + 22; // boolean equivalent to flag SHOWTITLE + SA_Behind = SA_Dummy + 23; // boolean equivalent to flag SCREENBEHIND + SA_Quiet = SA_Dummy + 24; // boolean equivalent to flag SCREENQUIET + SA_AutoScroll = SA_Dummy + 25; // boolean equivalent to flag AUTOSCROLL + SA_Pens = SA_Dummy + 26; // pointer to ~0 terminated UWORD array, as found in struct DrawInfo + SA_FullPalette = SA_Dummy + 27; // boolean: initialize color table to entire preferences palette, rather than compatible pens 0-3, 17-19, with remaining palette as returned by GetColorMap() + SA_ColorMapEntries = SA_Dummy + 28; {Allows you to override the number of entries in the ColorMap for your screen. Intuition + normally allocates (1 shl depth) or 32, whichever is more, but you may require even more if you + use certain graphics.library features (eg. palette-banking).} + SA_Parent = SA_Dummy + 29; // Pointer to a "parent" screen to attach this one to. Attached screens slide and depth-arrange together. + SA_Draggable = SA_Dummy + 30; // Boolean tag allowing non-draggable screens. Do not use without good reason! (Defaults to True). + SA_Exclusive = SA_Dummy + 31; { Boolean tag allowing screens that won't share the display. Use sparingly! Starting with 3.01, + attached screens may be SA_Exclusive. Setting SA_Exclusive for each screen will produce an + exclusive family. (Defaults to FALSE).} + SA_SharePens = SA_Dummy + 32; { For those pens in the screen's DrawInfo^.dri_Pens, Intuition obtains them in shared mode (see + graphics.library/ObtainPen()). For compatibility, Intuition obtains the other pens of a public + screen as PEN_EXCLUSIVE. Screens that wish to manage the pens themselves should generally set + this tag to True. This instructs Intuition to leave the other pens unallocated.} + SA_BackFill = SA_Dummy + 33; // provides a "backfill hook" for your screen's Layer_Info. See layers.library/InstallLayerInfoHook() + SA_Interleaved = SA_Dummy + 34; // Boolean tag requesting that the bitmap allocated for you be interleaved. (Defaults to False). + SA_Colors32 = SA_Dummy + 35; { Tag to set the screen's initial palette colors at 32 bits-per-gun. ti_Data is a pointer + to a table to be passed to the graphics.library/LoadRGB32() function. This format supports both runs of color + registers and sparse registers. See the autodoc for that function for full details. Any color set here has + precedence over the same register set by SA_Colors.} + SA_VideoControl = SA_Dummy + 36; // Pointer to a taglist that Intuition will pass to graphics.library/VideoControl(), upon opening the screen. + SA_FrontChild = SA_Dummy + 37; // Pointer to an already open screen that is to be the child of the screen being opened. The child screen will be moved to the front of its family. + SA_BackChild = SA_Dummy + 38; // Pointer to an already open screen that is to be the child of the screen being opened. The child screen will be moved to the back of its family. + SA_LikeWorkbench = SA_Dummy + 39; // 1 = request a screen which is just like the Workbench. This gives you the same screen mode, depth, size, colors, etc., as the Workbench screen. + SA_Reserved = SA_Dummy + 40; // Reserved for private Intuition use + + SA_MinimizeISG = SA_Dummy + 41; { For compatibility, Intuition always ensures that the inter-screen gap is at least three non-interlaced lines. If your application + would look best with the smallest possible inter-screen gap, set ti_Data to True. If you use the new graphics VideoControl() + VC_NoColorPaletteLoad tag for your screen's ViewPort, you should also set this tag.} + SA_ID = SA_Dummy + 42; +// this is an obsolete tag included only for compatibility with V35 interim release for the A2024 and Viking monitors + NSTAG_EXT_VPMODE = TAG_USER + 1; + + // SA_Overscan + OSCAN_TEXT = 1; // entirely visible + OSCAN_STANDARD = 2; // just past edges + OSCAN_MAX = 3; // as much as possible + OSCAN_VIDEO = 4; // even more than is possible + +type + PNewScreen = ^TNewScreen; + TNewScreen = record + LeftEdge, + TopEdge, + Width, + Height, + Depth: SmallInt; // screen dimensions + + DetailPen, + BlockPen: Byte; // for bar/border/gadget rendering + + ViewModes: Word; // the Modes for the ViewPort (and View) + SType: Word; // the Screen type (see defines above) (Type in C-Include) + + Font: PTextAttr; // this Screen's default text attributes + DefaultTitle: PChar; // the default title for this Screen + Gadgets: PGadget; // your own Gadgets for this Screen + + { if you are opening a CUSTOMSCREEN and already have a BitMap + that you want used for your Screen, you set the flags CUSTOMBITMAP in + the type field and you set this variable to point to your BitMap + structure. The structure will be copied into your Screen structure, + after which you may discard your own BitMap if you want} + CustomBitMap: PBitMap; + end; + + PExtNewScreen = ^TExtNewScreen; + TExtNewScreen = record + LeftEdge, + TopEdge, + Width, + Height, + Depth: SmallInt; + DetailPen, + BlockPen: Byte; + ViewModes: Word; + ens_Type: Word; { type in C-Includes } + Font: PTextAttr; + DefaultTitle: PChar; + Gadgets: PGadget; + CustomBitMap: PBitMap; + Extension: PTagItem; // ExtNewScreen specific extension SA_* + end; + +// Public Shared Screen Node +{ This is the representative of a public shared screen. + This is an internal data structure, but some functions may + present a copy of it to the calling application. In that case, + be aware that the screen pointer of the structure can NOT be + used safely, since there is no guarantee that the referenced + screen will remain open and a valid data structure. + Never change one of these.} + PPubScreenNode = ^TPubScreenNode; + TPubScreenNode = record + psn_Node: TNode; // ln_Name is screen name + psn_Screen: PScreen; + psn_Flags: Word; // below (PSNF_*) + psn_Size: SmallInt; // includes name buffer + psn_VisitorCount: SmallInt; // how many visitor windows + psn_SigTask: PTask; // who to signal when visitors gone + psn_SigBit: Byte; // which signal + end; + +const + // psn_Flags + PSNF_PRIVATE = 1 shl 0; + // Maximum length of public screen names. The buffers containing these strings must have a length of MAXPUBSCREENNAME+1. + MAXPUBSCREENNAME = 139; // names no longer, please + // pub screen modes + SHANGHAI = 1 shl 0; // put workbench windows on pub screen + POPPUBSCREEN = 1 shl 1; // pop pub screen to front when visitor opens + +{Intuition has new screen depth-arrangement and movement + functions called ScreenDepth() and ScreenPosition() respectively. + These functions permit the old behavior of ScreenToFront(), + ScreenToBack(), and MoveScreen(). ScreenDepth() also allows + independent depth control of attached screens. ScreenPosition() + optionally allows positioning screens even though they were opened + (SA_Draggable, False). + For ScreenDepth(), specify one of SDEPTH_TOFRONT or SDEPTH_TOBACK, + and optionally also SDEPTH_INFAMILY. + NOTE: ONLY THE OWNER OF THE SCREEN should ever specify + SDEPTH_INFAMILY. Commodities, "input helper" programs, + or any other program that did not open a screen should never + use that flag. (Note that this is a style-behavior + requirement; there is no technical requirement that the + task calling this function need be the task which opened + the screen).} + SDEPTH_TOFRONT = 0; // Bring screen to front + SDEPTH_TOBACK = 1; // Send screen to back + SDEPTH_INFAMILY = 2; // Move an attached screen with respect to other screens of its family + + +{ For ScreenPosition(), specify one of SPOS_RELATIVE, SPOS_ABSOLUTE, or SPOS_MAKEVISIBLE to describe the kind of screen positioning you + wish to perform. You may additionally set SPOS_FORCEDRAG along with any of the above. Set this if you wish to reposition an (SA_Draggable,False) + screen that you opened. + NOTE: ONLY THE OWNER OF THE SCREEN should ever specify SPOS_FORCEDRAG. Commodities, "input helper" programs, or any other program that did not + open a screen should never use that flag. + } + + SPOS_RELATIVE = 0; // The x1 and y1 parameters to ScreenPosition() describe the offset in coordinates you wish to move the screen by. Coordinates are relative + SPOS_ABSOLUTE = 1 shl 0; // The x1 and y1 parameters to ScreenPosition() describe the absolute coordinates you wish to move the screen to. Coordinates are expressed as absolutes, not relatives. + SPOS_MAKEVISIBLE = 1 shl 1; // Coordinates describe a box on the screen you wish to be made visible by autoscrolling + // (x1,y1)-(x2,y2) describes a rectangle on the screen which you would like autoscrolled into view. + SPOS_FORCEDRAG = 1 shl 2; // Move non-draggable screen, You may additionally set SPOS_FORCEDRAG along with any of the above. + // Set this if you wish to reposition an (SA_Draggable, False) screen that you opened. + +{ Intuition supports double-buffering in screens, with friendly interaction with menus and certain gadgets. + For each buffer, you need to get one of these structures from the AllocScreenBuffer() call. Never allocate your own ScreenBuffer structures! + The sb_DBufInfo field is for your use. See the graphics.library AllocDBufInfo() autodoc for details.} +type + PScreenBuffer = ^TScreenBuffer; + TScreenBuffer = record + sb_BitMap: PBitMap; // BitMap of this buffer + sb_DBufInfo: PDBufInfo; // DBufInfo for this buffer + end; + +const +// These are the flags that may be passed to AllocScreenBuffer(). + SB_SCREEN_BITMAP = 1; + SB_COPY_BITMAP = 2; + +const + + // these are the definitions for the printer configurations + FILENAME_SIZE = 30; // Filename size + DEVNAME_SIZE = 16; + POINTERSIZE = (1 + 16 + 1) * 2; // Size of Pointer data buffer + +{ These defines are for the default font size. These actually describe the + height of the defaults fonts. The default font type is the topaz + font, which is a fixed width font that can be used in either + eighty-column or sixty-column mode. The Preferences structure reflects + which is currently selected by the value found in the variable FontSize, + which may have either of the values defined below. These values actually + are used to select the height of the default font. By changing the + height, the resolution of the font changes as well.} + TOPAZ_EIGHTY = 8; + TOPAZ_SIXTY = 9; +type + PPreferences = ^TPreferences; + TPreferences = record + FontHeight: ShortInt; // height for system default font + PrinterPort: Byte; // printer port connection constant describing what's hooked up to the port + BaudRate: Word; // baud rate for the serial port + + // various timing rates + KeyRptSpeed: Ttimeval; // repeat speed for keyboard + KeyRptDelay: Ttimeval; // Delay before keys repeat + DoubleClick: Ttimeval; // Interval allowed between clicks + + // Intuition Mouse-Pointer data + PointerMatrix: array[0..POINTERSIZE - 1] of Word; // Definition of pointer sprite + XOffset: ShortInt; // X-Offset for active 'bit' + YOffset: ShortInt; // Y-Offset for active 'bit' + color17: Word; // + color18: Word; // Colours for sprite pointer + color19: Word; // + PointerTicks: Word; // Sensitivity of the pointer + + // Workbench Screen colors + color0: Word; // + color1: Word; // Standard default colours + color2: Word; // Used in the Workbench + color3: Word; // + + // positioning data for the Intuition View + ViewXOffset: ShortInt; // Offset for top lefthand corner + ViewYOffset: ShortInt; // X and Y dimensions + ViewInitX, + ViewInitY: SmallInt; // View initial offset values + + EnableCLI: LongBool; // CLI availability switch + + // printer configurations + PrinterType: Word; // printer type + PrinterFilename: array[0..FILENAME_SIZE - 1] of char; // file for printer + + // print format and quality configurations + PrintPitch: Word; // print pitch + PrintQuality: Word; // print quality + PrintSpacing: Word; // number of lines per inch + PrintLeftMargin: Word; // left margin in characters + PrintRightMargin: Word; // right margin in characters + PrintImage: Word; // positive or negative + PrintAspect: Word; // horizontal or vertical + PrintShade: Word; // b&w, half-tone, or color + PrintThreshold: SmallInt; // darkness ctrl for b/w dumps + + // print paper descriptors + PaperSize: Word; // paper size + PaperLength: Word; // paper length in number of lines + PaperType: Word; // continuous or single sheet + + // Serial device settings: These are six nibble-fields in three bytes (these look a little strange so the defaults will map out to zero) + SerRWBits: Byte; // upper nibble = (8-number of read bits), lower nibble = (8-number of write bits) + SerStopBuf: Byte; // upper nibble = (number of stop bits - 1), lower nibble = (table value for BufSize) + SerParShk: Byte; // upper nibble = (value for Parity setting), lower nibble = (value for Handshake mode) + LaceWB: Byte; // if workbench is to be interlaced + + // temp file for printer + Pad: array[0..11] of Byte; + PrtDevName: array [0..DEVNAME_SIZE - 1] of char; // Device used by printer.device (leave out the ".device") + + DefaultPrtUnit: Byte; // Default unit opened by printer.device + DefaultSerUnit: Byte; // Default serial unit + + RowSizeChange: ShortInt; // Affect NormalDisplayRows/Columns + ColumnSizeChange: ShortInt; + + PrintFlags: Word; // user preference flags + PrintMaxWidth: Word; // max width of printed picture in 10ths/inch + PrintMaxHeight: Word; // max height of printed picture in 10ths/inch + PrintDensity: Byte; // print density + PrintXOffset: Byte; // offset of printed picture in 10ths/inch + + wb_Width: Word; // override default workbench width + wb_Height: Word; // override default workbench height + wb_Depth: Byte; // override default workbench depth + + ext_size: Byte; // extension information -- do not touch! + // extension size in blocks of 64 bytes DO NOT TOUCH + end; + +const + // Workbench Interlace (use one bit) + LACEWB = 1 shl 0; + LW_RESERVED = 1; // internal use only + SCREEN_DRAG = 1 shl 14; + MOUSE_ACCEL = 1 shl 15; + // PrinterPort + PARALLEL_PRINTER = $00; + SERIAL_PRINTER = $01; + // BaudRate + BAUD_110 = $00; + BAUD_300 = $01; + BAUD_1200 = $02; + BAUD_2400 = $03; + BAUD_4800 = $04; + BAUD_9600 = $05; + BAUD_19200 = $06; + BAUD_MIDI = $07; + // PaperType + ptFANFOLD = $00; + ptSingle = $80; + // PrintPitch + PICA = $000; + ELITE = $400; + FINE = $800; + // PrintQuality + DRAFT = $000; + LETTER = $100; + // PrintSpacing + SIX_LPI = $000; + EIGHT_LPI = $200; + // Print Image + IMAGE_POSITIVE = $00; + IMAGE_NEGATIVE = $01; + // PrintAspect + ASPECT_HORIZ = $00; + ASPECT_VERT = $01; + // PrintShade + SHADE_BW = $00; + SHADE_GREYSCALE = $01; + SHADE_COLOR = $02; + // PaperSize + US_LETTER = $00; + US_LEGAL = $10; + N_TRACTOR = $20; + W_TRACTOR = $30; + CUSTOM_PAPER = $40; + // European sizes + EURO_A0 = $50; // European size A0: 841 x 1189 + EURO_A1 = $60; // European size A1: 594 x 841 + EURO_A2 = $70; // European size A2: 420 x 594 + EURO_A3 = $80; // European size A3: 297 x 420 + EURO_A4 = $90; // European size A4: 210 x 297 + EURO_A5 = $A0; // European size A5: 148 x 210 + EURO_A6 = $B0; // European size A6: 105 x 148 + EURO_A7 = $C0; // European size A7: 74 x 105 + EURO_A8 = $D0; // European size A8: 52 x 74 + // PrinterType + CUSTOM_NAME = $00; + ALPHA_P_101 = $01; + BROTHER_15XL = $02; + CBM_MPS1000 = $03; + DIAB_630 = $04; + DIAB_ADV_D25 = $05; + DIAB_C_150 = $06; + EPSON = $07; + EPSON_JX_80 = $08; + OKIMATE_20 = $09; + QUME_LP_20 = $0A; + HP_LASERJET = $0B; + HP_LASERJET_PLUS = $0C; + // Serial Input Buffer Sizes + SBUF_512 = $00; + SBUF_1024 = $01; + SBUF_2048 = $02; + SBUF_4096 = $03; + SBUF_8000 = $04; + SBUF_16000 = $05; + // Serial Bit Masks + SREAD_BITS = $F0; // for SerRWBits + SWRITE_BITS = $0F; + + SSTOP_BITS = $F0; // for SerStopBuf + SBUFSIZE_BITS = $0F; + + SPARITY_BITS = $F0; // for SerParShk + SHSHAKE_BITS = $0F; + // Serial Parity (upper nibble, after being shifted by macro SPARNUM()) + SPARITY_NONE = 0; + SPARITY_EVEN = 1; + SPARITY_ODD = 2; + SPARITY_MARK = 3; + SPARITY_SPACE = 4; + // Serial Handshake Mode (lower nibble, after masking using macro SHANKNUM()) + SHSHAKE_XON = 0; + SHSHAKE_RTS = 1; + SHSHAKE_NONE = 2; + // new defines for PrintFlags + CORRECT_RED = $0001; // color correct red shades + CORRECT_GREEN = $0002; // color correct green shades + CORRECT_BLUE = $0004; // color correct blue shades + + CENTER_IMAGE = $0008; // center image on paper + + IGNORE_DIMENSIONS = $0000; // ignore max width/height settings + BOUNDED_DIMENSIONS = $0010; // use max width/height as boundaries + ABSOLUTE_DIMENSIONS = $0020; // use max width/height as absolutes + PIXEL_DIMENSIONS = $0040; // use max width/height as prt pixels + MULTIPLY_DIMENSIONS = $0080; // use max width/height as multipliers + + INTEGER_SCALING = $0100; // force integer scaling + + ORDERED_DITHERING = $0000; // ordered dithering + HALFTONE_DITHERING = $0200; // halftone dithering + FLOYD_DITHERING = $0400; // Floyd-Steinberg dithering + + ANTI_ALIAS = $0800; // anti-alias image + GREY_SCALE2 = $1000; // for use with hi-res monitor + + // masks used for checking bits + CORRECT_RGB_MASK = CORRECT_RED or CORRECT_GREEN or CORRECT_BLUE; + DIMENSIONS_MASK = BOUNDED_DIMENSIONS or ABSOLUTE_DIMENSIONS or PIXEL_DIMENSIONS or MULTIPLY_DIMENSIONS; + DITHERING_MASK = HALFTONE_DITHERING or FLOYD_DITHERING; + +{ Be sure to protect yourself against someone modifying these data as you look at them. This is done by calling: + lock = LockIBase(0), which returns an Integer. When done call UnlockIBase(lock) where lock is what LockIBase() returned.} +type + // IntuitionBase should never be directly modified by programs + PIntuitionBase = ^TIntuitionBase; + TIntuitionBase = record + LibNode: TLibrary; + + ViewLord: TView; + + ActiveWindow: PWindow; + ActiveScreen: PScreen; + FirstScreen: PScreen; { for linked list of all screens, the FirstScreen variable points to the frontmost Screen. + Screens are then maintained in a front to back order using Screen.NextScreen } + Flags: LongWord; // see definitions below +{$ifdef AROS_FLAVOUR_BINCOMPAT} + MouseX, + MouseY: SmallInt; // mouse position relative to View +{$else} + MouseY, + MouseX: SmallInt; // mouse position relative to View +{$endif} + + Seconds: LongWord; // timestamp of most current input event + Micros: LongWord; // timestamp of most current input event + + // I told you this was private. The data beyond this point has changed, is changing, and will continue to change. + end; + +{ Package of information passed to custom and 'boopsi' + gadget 'hook' functions. This structure is READ ONLY.} +type + PGadgetInfo = ^TGadgetInfo; + + TGadgetInfo = record + gi_Screen: PScreen; // ScreenPtr + gi_Window: PWindow; // nil for screen gadgets + gi_Requester: PRequester; // nil IF not GTYP_REQGADGET + gi_RastPort: PRastPort; // rendering information: don't use these without cloning/locking. Official way is to call ObtainRPort() + gi_Layer: PLayer; // LayerPtr + { copy of dimensions of screen/window/g00/req(/group) + that gadget resides in. Left/Top of this box is + offset from window mouse coordinates to gadget coordinates + screen gadgets: 0,0 (from screen coords) + window gadgets (no g00): 0,0 + GTYP_GZZGADGETs (borderlayer): 0,0 + GZZ innerlayer gadget: borderleft, bordertop + Requester gadgets: reqleft, reqtop} + gi_Domain: TIBox; + gi_Pens: record + DetailPen: Byte; + BlockPen: Byte; + end; + gi_DrInfo: PDrawInfo; // the Detail and Block pens in gi_DrInfo^.dri_Pens[] are for the screen. Use the above for window-sensitive colors. + gi_Reserved: array[0..5] of LongWord; // reserved space: this structure is extensible anyway, but using these saves some recompilation + end; + +{ system private data structure for now + prop gadget extra info} + PPGX = ^TPGX; + TPGX = record + pgx_Container: TIBox; + pgx_NewKnob: TIBox; + end; + +{** User visible handles on objects, classes, messages **} +type + Object_ = LongWord; + PObject_ = ^Object_; + PPObject_ = ^PObject_; + ClassID = STRPTR; + +{ you can use this type to point to a 'generic' message, + in the object-oriented programming parlance. Based on + the value of 'MethodID', you dispatch to processing + for the various message types. The meaningful parameter + packet structure definitions are defined below.} + PMsg = ^TMsg; + TMsg = record + MethodID: LongWord; + end; + +{ Class id strings for Intuition classes. + There's no real reason to use the uppercase constants + over the lowercase strings, but this makes a good place + to list the names of the built-in classes.} +const + ROOTCLASS: ClassID = 'rootclass'; // classusr.h + IMAGECLASS: ClassID = 'imageclass'; // imageclass.h + FRAMEICLASS: ClassID = 'frameiclass'; + SYSICLASS: ClassID = 'sysiclass'; + FILLRECTCLASS: ClassID = 'fillrectclass'; + GADGETCLASS: ClassID = 'gadgetclass'; // gadgetclass.h + PROPGCLASS: ClassID = 'propgclass'; + STRGCLASS: ClassID = 'strgclass'; + BUTTONGCLASS: ClassID = 'buttongclass'; + FRBUTTONCLASS: ClassID = 'frbuttonclass'; + GROUPGCLASS: ClassID = 'groupgclass'; + ICCLASS: ClassID = 'icclass'; // icclass.h + MODELCLASS: ClassID = 'modelclass'; + ITEXTICLASS: ClassID = 'itexticlass'; + POINTERCLASS: ClassID = 'pointerclass'; // pointerclass.h + +// public classes existing only in AROS but not AmigaOS + MENUBARLABELCLASS: PChar = 'menubarlabelclass'; + WINDECORCLASS: PChar = 'windecorclass'; + SCRDECORCLASS: PChar = 'scrdecorclass'; + MENUDECORCLASS: PChar = 'menudecorclass'; + +{ Dispatched method ID's + NOTE: Applications should use Intuition entry points, not direct + DoMethod() calls, for NewObject, DisposeObject, SetAttrs, + SetGadgetAttrs, and GetAttr} + OM_Dummy = $100; + OM_NEW = OM_Dummy + 1; // 'object' parameter is 'true class' + OM_DISPOSE = OM_Dummy + 2; // delete self (no parameters) + OM_SET = OM_Dummy + 3; // set attributes (in tag list) + OM_GET = OM_Dummy + 4; // return single attribute value + OM_ADDTAIL = OM_Dummy + 5; // add self to a List (let root do it) + OM_REMOVE = OM_Dummy + 6; // remove self from list + OM_NOTIFY = OM_Dummy + 7; // send to self: notify dependents + OM_UPDATE = OM_Dummy + 8; // notification message from somebody + OM_ADDMEMBER = OM_Dummy + 9; // used by various classes with lists + OM_REMMEMBER = OM_Dummy + 10; // used by various classes with lists + +// Parameter 'Messages' passed to methods +type + // OM_NEW and OM_SET + PopSet = ^TopSet; + TopSet = record + MethodID: LongWord; + ops_AttrList: PTagItem; // new attributes + ops_GInfo: PGadgetInfo; // always there for gadgets, when SetGadgetAttrs() is used, but will be nil for OM_NEW + end; + + // OM_GET + PopGet = ^TopGet; + TopGet = record + MethodID, + opg_AttrID: LongWord; + opg_Storage: Pointer; // may be other types, but 'int' types are all LongWord + end; + + // OM_ADDTAIL + + PopAddTail = ^TopAddTail; + TopAddTail = record + MethodID: LongWord; + opat_List: PList; + end; + + // OM_ADDMEMBER, OM_REMMEMBER + PopMember = ^TopMember; + TopMember = record + MethodID: LongWord; + opam_Object: PObject_; + end; + TopAddMember = TopMember; + PopAddMember = ^TopAddMember; + + // OM_NOTIFY, and OM_UPDATE + PopUpdate = ^TopUpdate; + TopUpdate = record + MethodID: LongWord; + opu_AttrList: PTagItem; // new attributes + opu_GInfo: PGadgetInfo; // non-nil when SetGadgetAttrs OR notification resulting from gadget input occurs. + opu_Flags: LongWord; // defined below (OPUF_*) + end; + +{ this flag means that the update message is being issued from + something like an active gadget, a la GACT_FOLLOWMOUSE. When + the gadget goes inactive, it will issue a final update + message with this bit cleared. Examples of use are for + GACT_FOLLOWMOUSE equivalents for propgadclass, and repeat strobes + for buttons.} +const + OPUF_INTERIM = 1; // opu_Flags + +{ This structure is READ-ONLY, and allocated only by Intuition } +type + PIClass = ^TIClass; + TIClass = record // also used as Class + cl_Dispatcher: THook; + cl_Reserved: LongWord; // must be 0 + cl_Super: PIClass; // Super - Class + cl_ID: ClassID; + cl_InstOffset: Word; // where within an object is the instance data for this class? + cl_InstSize: Word; + + cl_UserData: IPTR; // per-class data of your choice, application specific + cl_SubclassCount: LongWord; // # of direct suclasses + cl_ObjectCount: LongWord; // # of objects, made from this class must be 0, if the class is to be deleted + cl_Flags: LongWord; // Flags (CLF_INLIST) + cl_ObjectSize: LongWord; // cl_InstOffset + cl_InstSize + SizeOf(_Object) + cl_MemoryPool: APTR; + end; + +const + CLF_INLIST = 1 shl 0; // class is in public class list (cl_Flags) + +{ We have this, the instance data of the root class, PRECEDING + the 'object'. This is so that Gadget objects are Gadget pointers, + and so on. If this structure grows, it will always have o_Class + at the end, so the macro OCLASS(o) will always have the same + offset back from the pointer returned from NewObject().} +type + P_Object = ^T_Object; + T_Object = record + o_Node: TMinNode; + o_Class: PIClass; + end; + +{ BOOPSI class libraries should use this structure as the base for their + library data. This allows developers to obtain the class pointer for + performing object-less inquiries. } + PClassLibrary = ^TClassLibrary; + TClassLibrary = record + cl_Lib: TLibrary; // Embedded library + cl_Pad: Word; // Align the structure + cl_Class: PIClass; // Class pointer + end; + +{ GadgetClass Attributes + Most subclasses of GadgetClass implement a subset of these attributes. Note + also that even if an attribute is signed as settable, some subclasses may + ignore this or even behave strange, if such an attribute is set, after they + were added to a window. Read the class documentation of the subclasses to + learn about such caveats. + + Many of these attributes correspond directly to a field of the Gadget + structure or to one flag for this structure. } +const + GA_Dummy = (TAG_USER + $30000); +// Gadget placing (in pixels). Of course, all GA_Rel attributes are mutually +// exclusive with their non relative equivalents. + GA_Left = (GA_Dummy + $0001); // [ISG] (LONG) Left edge of gadget. + GA_RelRight = (GA_Dummy + $0002); // [ISG] (LONG) Left edge of gadget, depending on right window border: Left=Win^.Width-this-1 + GA_Top = (GA_Dummy + $0003); // [ISG] (LONG) Top edge of gadget. + GA_RelBottom = (GA_Dummy + $0004); // [ISG] (LONG) Top edge of gadget, depending on bottom window border: Top=Win^.Height-this-1 + GA_Width = (GA_Dummy + $0005); // [ISG] (LONG) Width of gadget. + GA_RelWidth = (GA_Dummy + $0006); // [ISG] (LONG) Width of gadget, depending on window width: Width=Win^.Width-this + GA_Height = (GA_Dummy + $0007); // [ISG] (LONG) Height of gadget. + GA_RelHeight = (GA_Dummy + $0008); // [ISG] (LONG) Height of gadget, depending on window height: Height=Win^.Height-this + +// Gadget rendering + GA_Text = (GA_Dummy + $0009); // [IS.] (PChar) Label text. This is mutually exclusive with GA_IntuiText and GA_LabelImage. + // The next two attributes are mutually exclusive. + GA_Image = (GA_Dummy + $000A); // (PImage) Gadget imagry is an image + GA_Border = (GA_Dummy + $000B); // (PBorder) Gadget imagry is a border + GA_SelectRender = (GA_Dummy + $000C); { [IS.] (PImage) Gadgets' image in selected state. Note that if + this is nil and GA_Image is in fact an image object, GA_Image may be + tried to be drawn with IDS_SELECTED. So you do not need to fill this in, + if you wish to have a special selected image and GA_Image is an image + object that supports the selected state.} + GA_Highlight = (GA_Dummy + $000D); // [IS.] (LongWord) Takes GFLG_GADGH* flags as argument. Used to specify the highlighting technique. + GA_Disabled = (GA_Dummy + $000E); // [ISG] (LongBool) If this is set to true, the gadget is not selectable. Often this is visually represented by using a special disabled pattern. + +// Additional information. + GA_GZZGadget = (GA_Dummy + $000F); // [IS.] (LongBool) The Gadget is a GimmeZeroZero gadget. Default = False + GA_ID = (GA_Dummy + $0010); // (LongInt) Gadget ID assigned by the application (prevent double numbers) + GA_UserData = (GA_Dummy + $0011); // [ISG] (IPTR) Fill with whatever you want to. This field is ignored by the system. + GA_SpecialInfo = (GA_Dummy + $0012); { [IS.] (APTR) Pointer to additional information, needed by some gadgets + (like string or integer gadgets). This field should generally only be set + by subclasses of GadgetClass. Applications should keep their hands off it.} + +// Gadget activation. + GA_Selected = (GA_Dummy + $0013); // [ISG] (LongBool) Indicate whether the gadget is selected or not. Default = False + GA_EndGadget = (GA_Dummy + $0014); // [IS.] (LongBool) Only used for requester gadgets. This tells intuition that the requester is to be closed, when the gadget is released. Default = False + GA_Immediate = (GA_Dummy + $0015); // [IS.] (LongBool) If set the gadget responds immediatly, when the gadget is selected. Default = False + GA_RelVerify = (GA_Dummy + $0016); // [IS.] (LongBool) If set the gadget responds, when it is released from selected state. Default = False + GA_FollowMouse = (GA_Dummy + $0017); // [IS.] (LongBool) If this is set, the gadget receives information about the movement of the mouse as long as it is activated. Default = False + GA_RightBorder = (GA_Dummy + $0018); // [IS.] (LongBool) Indicate whether the gadget is in the right border or not. Default = False. + GA_LeftBorder = (GA_Dummy + $0019); // [IS.] (LongBool) Indicate whether the gadget is in the left border or not. Default = False. + GA_TopBorder = (GA_Dummy + $001A); // [IS.] (LongBool) Indicate whether the gadget is in the top border or not. Default = False. + GA_BottomBorder = (GA_Dummy + $001B); // [IS.] (LongBool) Indicate whether the gadget is in the bottom border or not. Default = False. + GA_ToggleSelect = (GA_Dummy + $001C); // [IS.] (LongBool) Indicate whether the gadget is toggle-selected or not. Default = False. + // The following two attributes are PRIVATE! + GA_SysGadget = (GA_Dummy + $001D); // [IS.] (LongBool) Set, if gadget is a system-gadget e.g. a standard window border gadget. Default = False. + GA_SysGType = (GA_Dummy + $001E); // [IS.] (LongWord) Reserved for system use to indicate the gadget type. + +// Gadget linking. + GA_Previous = (GA_Dummy + $001F); { [I..] (PGadget) Pointer to previous gadget. This is used to link + the current gadget into a gadget list, before this list is used. It can + not be used to add a gadget to a list of an open window or requester!} + GA_Next = (GA_Dummy + $0020); // [I..] (PGadget) Next gadget in the linked list. Currently not implemented. + GA_DrawInfo = (GA_Dummy + $0021); { [I..] (PDrawInfo) Some gadgets need a DrawInfo structure + to be able to perform correct rendering. Read the documentation of the + subclasses to learn, which need this attribute. To be on the safe side, + you can always supply it.} + // You should use at most ONE of GA_Text, GA_IntuiText, and GA_LabelImage + GA_IntuiText = (GA_Dummy + $0022); // [IS.] (PIntuiText) Label is an IntuiText. + GA_LabelImage = (GA_Dummy + $0023); // [IS.] (PObject_) Label is an image object. + GA_TabCycle = (GA_Dummy + $0024); // [IS.] (LongBool) If set to true that gadget participates in TAB handling, i.e. if tab is pressed, the next gadget is activated. + GA_GadgetHelp = (GA_Dummy + $0025); // [..G] (LongBool) If this is set by the gadget, the sends GADGETHELP messages. + GA_Bounds = (GA_Dummy + $0026); // [IS.] (PIBox) Bounds to be copied into the ExtGadget structure. + GA_RelSpecial = (GA_Dummy + $0027); { [IS.] (Long) This attribute should only be set by subclasses of + GadgetClass. Applications should keep their hands away! + If set this means, that GM_LAYOUT is called, when the window it is in is + opened or its size changes. This allows gadgets to make their own size + dependent on the size of the window. } + GA_TextAttr = GA_Dummy + 40; // [IS.] (PTextAttr) Indicate the font to use for the gadget. + GA_ReadOnly = GA_Dummy + 41; // (LongBool) Indicate that the gadget is read-only (non-selectable). Default = False + GA_Underscore = GA_Dummy + 42; // (Char) Underscore/escape character for keyboard shortcuts. Defaults = '_' + GA_ActivateKey = GA_Dummy + 43; // (PChar) Set/Get the gadgets shortcut/activation key(s) Default = nil + GA_BackFill = GA_Dummy + 44; // (PHook) Backfill pattern hook. Defaults to nil. + GA_GadgetHelpText = GA_Dummy + 45; // (PChar) RESERVERD/PRIVATE DO NOT USE. Default = nil + GA_UserInput = GA_Dummy + 46; // (LongBool) Notification tag indicates this notification is from the activite gadget receiving user input - an attempt to make IDCMPUPDATE more efficient. +// Aros Specifics + GA_LabelPlace = GA_Dummy + 100; { [I..] (LongInt) Choose the placing of the label. GadgetClass does not support + this directly. Its subclasses have to take care of that. For possible values see GV_* .} + +// Placetext values for GA_LabelPlace. + GV_LabelPlace_In = 1; + GV_LabelPlace_Left = 2; + GV_LabelPlace_Right = 3; + GV_LabelPlace_Above = 4; + GV_LabelPlace_Below = 5; + +//*** PropGClass + // This class defines a standard proportional gadget. + PGA_Dummy = TAG_USER + $31000; + PGA_Freedom = PGA_Dummy + 1; // [IS.] (LongWord) Define in which the direction gadget should stretch. Possible values are FREEVERT and FREEHORIZ + PGA_Borderless = PGA_Dummy + 2; // [IS.] (LongBool) If set, no border will be rendered. + // The following four attributes should not be used with PGA_Total, PGA_Visible and PGA_Top. + PGA_HorizPot = PGA_Dummy + 3; // [ISG] (Word) + PGA_HorizBody = PGA_Dummy + 4; // [ISG] (Word) + PGA_VertPot = PGA_Dummy + 5; // [ISG] (Word) + PGA_VertBody = PGA_Dummy + 6; // [ISG] (Word) + // The following three attributes should not be used with the PGA_*Pot and PGA_*Body attributes. + PGA_Total = PGA_Dummy + 7; // [IS.] (Word) The total number of positions in the gadget. + PGA_Visible = PGA_Dummy + 8; // [IS.] (Word) The number of visible positions in the gadget. + PGA_Top = PGA_Dummy + 9; // [ISG] (Word) The first visible position. + PGA_NewLook = PGA_Dummy + 10; // [IS.] (LongBool) If set, this indicated that the new look should be used for rendering. + PGA_DisplayHook = PGA_Dummy + 11; // [I.G] (PHook) Use this Hook to render the Gadget visuals + PGA_NotifyBehaviour = PGA_Dummy + 30; { [I..] (Word) If set to PG_BEHAVIOUR_NICE OM_NOTIFY messages are sent + also during OM_SET/OM_UPDATE, not just when user drags the knob, which is the default behaviour (PG_BEHAVIOUR_COMPATIBLE)} + PGA_RenderBehaviour = PGA_Dummy + 31; { [I..] (Word) If set to PG_BEHAVIOUR_NICE the gadget is re-rendered + during OM_SET/OM_UPDATE even when being a subclass of propgclass. + The default behaviour (PG_BEHAVIOUR_COMPATIBLE) is that subclasses + of propgclass don't render in OM_SET/OM_UPDATE } + // Flags for PGA_*Behaviour + PG_BEHAVIOUR_COMPATIBLE = 0; + PG_BEHAVIOUR_NICE = 1; + +// StrGClass StringGClass is just a normal "string" gadget. + STRINGA_Dummy = TAG_USER + $32000; + STRINGA_MaxChars = STRINGA_Dummy + 1; // [I..] (SmallInt) Maximum number of characters the string gadget accepts. Default SG_DEFAULTMAXCHARS. + STRINGA_Buffer = STRINGA_Dummy + 2; // [I..] (STRPTR) Buffer for storing the current string of the gadget. + STRINGA_UndoBuffer = STRINGA_Dummy + 3; // [I..] (STRPTR) Buffer for storing the old (undo) string of the gadget. + STRINGA_WorkBuffer = STRINGA_Dummy + 4; // [I..] (STRPTR) Buffer for the class to work with. + STRINGA_BufferPos = STRINGA_Dummy + 5; // [IS.] (SmallInt) Current position of cursor (relative to the beginning of the buffer). + STRINGA_DispPos = STRINGA_Dummy + 6; // [IS.] (SmallInt) FIXME + STRINGA_AltKeyMap = STRINGA_Dummy + 7; // [IS.] (PKeyMap) KeyMap to use + STRINGA_Font = STRINGA_Dummy + 8; // [IS.] (PTextFont) Font to use for displaying the string + STRINGA_Pens = STRINGA_Dummy + 9; // [IS.] (LongInt) The lower 16 bits specify the background-pen, the upper 16 bits the foreground-pen. The gadget is rendered, using these pens, if the gadget is inactive + STRINGA_ActivePens = STRINGA_Dummy + 10; // [IS.] (LongInt) Like STRINGA_Pens. These pens are used, if the gadget is active. + STRINGA_EditHook = STRINGA_Dummy + 11; // [I..] (PHook) FIXME + STRINGA_EditModes = STRINGA_Dummy + 12; // [IS.] (LongWord) FIXME + STRINGA_ReplaceMode = STRINGA_Dummy + 13; // [IS.] (BOOL) If this is TRUE, the current character is overwritten, if the use presses a key. Otherwise, the new character is inserted. + STRINGA_FixedFieldMode = STRINGA_Dummy + 14; // [IS.] (LongBool) FIXME + STRINGA_NoFilterMode = STRINGA_Dummy + 15; // [IS.] (LongBool) FIXME + STRINGA_Justification = STRINGA_Dummy + 16; // [IS.] (UWORD) Where should the text be justified? Use one of GACT_STRINGCENTER, GACT_STRINGLEFT and GACT_STRINGRIGHT + STRINGA_LongVal = STRINGA_Dummy + 17; // [ISG] (LONG) If this is set, the string gadget will only accept numeric values. Argument is the number, the string gadget is to be set to. When getting this attribute, this number is returned. + STRINGA_TextVal = STRINGA_Dummy + 18; // [ISG] (STRPTR) If this is set, the string gadget will accept strings. Argument is a string that is to be copied into the string gadget and its buffer. + STRINGA_ExitHelp = STRINGA_Dummy + 19; // [IS.] (BOOL) If this is set, pressing the "Help" key, while the gadget is active, will unselect the gadget. + + SG_DEFAULTMAXCHARS = 128; // Default, if STRINGA_MaxChars is not set. + + // Gadget Layout related attributes + LAYOUTA_Dummy = TAG_USER + $38000; + LAYOUTA_LayoutObj = LAYOUTA_Dummy + 1; + LAYOUTA_Spacing = LAYOUTA_Dummy + 2; + LAYOUTA_Orientation = LAYOUTA_Dummy + 3; // Orientation LORIENT_* + LAYOUTA_ChildMaxWidth = LAYOUTA_Dummy + 4; // (BOOL) Child objects are of equal width. Should default to True for gadgets with a horizontal orientation. + LAYOUTA_ChildMaxHeight = LAYOUTA_Dummy + 5; // (BOOL) Child objects are of equal height. Should default to True for gadgets with a vertical orientation. + // orientation values for LAYOUTA_Orientation + LORIENT_NONE = 0; + LORIENT_HORIZ = 1; + LORIENT_VERT = 2; + +// Gadget Method ID's + GM_Dummy = -1; // not used for anything + GM_HITTEST = 0; // return GMR_GADGETHIT IF you are clicked on (whether or not you are disabled). + GM_RENDER = 1; // draw yourself, in the appropriate state + GM_GOACTIVE = 2; // you are now going to be fed input + GM_HANDLEINPUT = 3; // handle that input + GM_GOINACTIVE = 4; // whether or not by choice, you are done + GM_HELPTEST = 5; // Will you send gadget help if the mouse is at the specified coordinates? See below for possible GMR_ values. } + GM_LAYOUT = 6; // re-evaluate your size based on the GadgetInfo Domain. Do NOT re-render yourself yet, you will be called when it is time... + GM_DOMAIN = 7; // This method is invoked to learn about the sizing requirements of your class, before an object is created. + +// Parameter "Messages" passed to gadget class methods +type + // GM_HITTEST + { This method is used to test, if a mouse-click hit the gadget. You return + GMR_GADGETHIT (see below), if you were hit and 0 otherwise. Note that you + have to test, if you were hit, no matter if you are disabled or not.} + PgpHitTest = ^TgpHitTest; + TgpHitTest = record + MethodID: LongWord; // GM_HITEST or GM_HELPTEST + gpht_GInfo: PGadgetInfo; + gpht_Mouse: record // These values are relative to the gadget select box for GM_HITTEST. For + x: SmallInt; // GM_HELPTEST they are relative to the bounding box (which is often + y: SmallInt; // equal to the select box). + end; + end; +const + GMR_GADGETHIT = $00000004; // GM_HITTEST hit + GMR_NOHELPHIT = $00000000; // GM_HELPTEST didn't hit + GMR_HELPHIT = $FFFFFFFF; // GM_HELPTEST hit, The gadget was hit. The lower word of the Code field of the IntuiMessage will be set to -1. + GMR_HELPCODE = $00010000; // GM_HELPTEST hit, return low Word as code. The gadget was hit. Pass the lower word, returned by this method to the application by using the Code field of the IntuiMessage. + +type + // GM_RENDER This method is invoked to draw the gadget into a rastport. + PgpRender = ^TgpRender; + TgpRender = record + MethodID: LongWord; // GM_RENDER + gpr_GInfo: PGadgetInfo; // gadget context + gpr_RPort: PRastPort; // all ready for use + gpr_Redraw: LongInt; // might be a "highlight pass" (GREDRAW_*) + end; +const + // gpr_Redraw. Not all of these values make sense for all gadgets. + GREDRAW_UPDATE = 2; // incremental update. Some data (e.g. the level of a slider) was updated. Just redraw the necessary parts. + GREDRAW_REDRAW = 1; // redraw the whole gadget + GREDRAW_TOGGLE = 0; // toggle highlight, IF applicable + +type + // GM_GOACTIVE, GM_HANDLEINPUT + {GM_GOACTIVE tells the gadget that it has become active and will receive + input from now on from the method GM_HANDLEINPUT. This is stopped by using + GM_GOINACTIVE (see below). + GM_GOACTIVE and GM_HANDLEINPUT both use the same structure and return the + same values, as defined below.} + PgpInput = ^TgpInput; + TgpInput = record + MethodID: LongWord; // GM_GOACTIVE or GM_HANDLEINPUT + gpi_GInfo: PGadgetInfo; // gadget context + gpi_IEvent: PInputEvent; // Pointer to the InputEvent that caused the method to be invoked. + gpi_Termination: Pointer; { Pointer to a variable that is to be set by the gadget class, if + GMR_VERIFY is returned. The lower 16 bits of this value are returned + in the Code field of the IntuiMessage passed back to the application} + gpi_Mouse: record // This struct defines the current mouse position, relative to the gadgets' bounding box. + x: SmallInt; + y: SmallInt; + end; + gpi_TabletData: PTabletData; { Pointer to TabletData structure or nil, + if this input event did not originate from a tablet that is capable of + sending IESUBCLASS_NEWTABLET events.} + end; +const + // GM_HANDLEINPUT and GM_GOACTIVE return code flags. These are actually flags and may be or'ed. + GMR_MEACTIVE = 0; // Gadget is still alive. + GMR_NOREUSE = 1 shl 1; // Gadget has become inactive, but the input event may not be used again. + GMR_REUSE = 1 shl 2; // Gadget has become inactive, and the input event may be reused by intuition. + GMR_VERIFY = 1 shl 3; // Gadget was selected. Generate IDCMP_GADGETUP message. gpi_Termination must be set. + { If one of the following two flags is returned, the gadget has become + inactive, but the next or previous gadget, which has the GFLG_TABCYCLE flag + set is to be activated.} + GMR_NEXTACTIVE = 1 shl 4; // Activate next gadget. + GMR_PREVACTIVE = 1 shl 5; // Activate previous gadget. + +type + // GM_GOINACTIVE see GM_GOACTIVE for explanation + PgpGoInactive = ^TgpGoInactive; + TgpGoInactive = record + MethodID: LongWord; // GM_GOINACTIVE + gpgi_GInfo: PGadgetInfo; + gpgi_Abort: LongWord; { Boolean field to indicate, who wanted the gadget to go inactive. If + this is 1 this method was sent, because intution wants the gadget to + go inactive, if it is 0, it was the gadget itself that wanted it.} + end; + +type + // GM_LAYOUT + { This method is called by intuition, if on of the GFLG_REL flags or one of + the GA_Rel attributes is set and the window size changes or you are added to + a window. In this method you should re-evaluate the size of yourself. You + are not allowed to do any rendering operation during this method!} + PgpLayout = ^TgpLayout; + TgpLayout = record + MethodID: LongWord; // GM_LAYOUT + gpl_GInfo: PGadgetInfo; + gpl_Initial: LongWord; {Boolean that indicated, if this method was invoked, when you are added + to a window (True) or if it is called, because the window was resized + (False).} + end; + + // GM_DOMAIN + { This method is invoked to learn about the sizing requirements of your class, + before an object is created. This is AROS specific.} + PgpDomain = ^TgpDomain; + TgpDomain = record + MethodID: LongWord; // GM_DOMAIN + gpd_GInfo: PGadgetInfo; + gpd_RPort: PRastPort; // RastPort to calculate dimensions for. + gpd_Which: LONG; // what to calculate (GDOMAIN_*) + gpd_Domain: TIBox; // Resulting domain + gpd_Attrs: PTagItem; // Additional attributes. None defines yet + end; +const + // gpd_Which + GDOMAIN_MINIMUM = 0; // Calculate minimum size. + GDOMAIN_NOMINAL = 1; // Calculate nominal size. + GDOMAIN_MAXIMUM = 2; // Calculate maximum size. + +const + ICM_Dummy = $0401; // used for nothing + // no parameters for ICM_SETLOOP, ICM_CLEARLOOP, ICM_CHECKLOOP + ICM_SETLOOP = ICM_Dummy + 1; // set/increment loop counter + ICM_CLEARLOOP = ICM_Dummy + 2; // clear/decrement loop counter + ICM_CHECKLOOP = ICM_Dummy + 3; // set/increment loop + // interconnection attributes used by icclass, modelclass, and gadgetclass + ICA_Dummy = TAG_USER + $40000; + ICA_TARGET = ICA_Dummy + 1; // interconnection target + ICA_MAP = ICA_Dummy + 2; // interconnection map tagitem list + ICSPECIAL_CODE = ICA_Dummy + 3; // a "pseudo-attribute", see below. + +{ Normally, the value for ICA_TARGET is some object pointer, + but if you specify the special value ICTARGET_IDCMP, notification + will be send as an IDCMP_IDCMPUPDATE message to the appropriate window's + IDCMP port. See the definition of IDCMP_IDCMPUPDATE. + When you specify ICTARGET_IDCMP for ICA_TARGET, the map you + specify will be applied to derive the attribute list that is + sent with the IDCMP_IDCMPUPDATE message. If you specify a map list + which results in the attribute tag id ICSPECIAL_CODE, the + lower sixteen bits of the corresponding ti_Data value will + be copied into the Code field of the IDCMP_IDCMPUPDATE IntuiMessage.} + ICTARGET_IDCMP = not 0; + +const + // if image.Depth is this, it's a new Image class object + CUSTOMIMAGEDEPTH = -1; + + // Attributes for IMAGECLASS + IA_Dummy = TAG_USER + $20000; + IA_Left = IA_Dummy + $01; + IA_Top = IA_Dummy + $02; + IA_Width = IA_Dummy + $03; + IA_Height = IA_Dummy + $04; + IA_FGPen = IA_Dummy + $05; // IA_FGPen also means "PlanePick" + IA_BGPen = IA_Dummy + $06; // IA_BGPen also means "PlaneOnOff" + IA_Data = IA_Dummy + $07; // bitplanes, for classic image, other image classes may use it for other things + IA_LineWidth = IA_Dummy + $08; + IA_Pens = IA_Dummy + $0E; // pointer to UWord pens[], ala DrawInfo.Pens, MUST be terminated by (not 0). Some classes can choose to have this, or SYSIA_DrawInfo, or both. + IA_Resolution = IA_Dummy + $0F; // packed uwords for x/y resolution into a LongWord ala DrawInfo.Resolution + // see class documentation to learn which classes recognize these + IA_APattern = IA_Dummy + $10; + IA_APatSize = IA_Dummy + $11; + IA_Mode = IA_Dummy + $12; + IA_Font = IA_Dummy + $13; + IA_Outline = IA_Dummy + $14; + IA_Recessed = IA_Dummy + $15; + IA_DoubleEmboss = IA_Dummy + $16; + IA_EdgesOnly = IA_Dummy + $17; // to specify that the interior of a frame should not be cleared + // SYSICLASS attributes + SYSIA_Size = IA_Dummy + $0B; // see below SYSISIZE_* + SYSIA_Depth = IA_Dummy + $0C; + SYSIA_Which = IA_Dummy + $0D; // see below + SYSIA_UserBuffer = IA_Dummy + $20; // Only for system Images + SYSIA_DrawInfo = IA_Dummy + $18; // Must be specified + SYSIA_ReferenceFont = IA_Dummy + $19; // Font to use as reference for scaling certain sysiclass images + IA_SupportsDisable = IA_Dummy + $1a; // Tell intuition to use IDS_*DISABLED instead of own code + IA_FrameType = IA_Dummy + $1b; // Starting with V39, FrameIClass recognizes several standard types of frame. Use one of the FRAME_* specifiers below. Default = FRAME_DEFAULT. + // Private AROS sysiclass tags and defines + SYSIA_WithBorder = IA_FGPen; // default: True + SYSIA_Style = IA_BGPen; // default: SYSISTYLE_NORMAL + + SYSISTYLE_NORMAL = 0; + SYSISTYLE_GADTOOLS = 1; // to get arrow images in gadtools look + + // data values for SYSIA_Size + SYSISIZE_MEDRES = 0; + SYSISIZE_LOWRES = 1; + SYSISIZE_HIRES = 2; + +// SYSIA_Which tag data values: Specifies which system gadget you want an image for. Some numbers correspond to internal Intuition + DEPTHIMAGE = $00; // Window depth gadget image + ZOOMIMAGE = $01; // Window zoom gadget image + SIZEIMAGE = $02; // Window sizing gadget image + CLOSEIMAGE = $03; // Window close gadget image + SDEPTHIMAGE = $05; // Screen depth gadget image + LEFTIMAGE = $0A; // Left-arrow gadget image + UPIMAGE = $0B; // Up-arrow gadget image + RIGHTIMAGE = $0C; // Right-arrow gadget image + DOWNIMAGE = $0D; // Down-arrow gadget image + CHECKIMAGE = $0E; // GadTools checkbox image + MXIMAGE = $0F; // GadTools mutual exclude "button" image + MENUCHECK = $10; // Menu checkmark image + AMIGAKEY = $11; // Menu Amiga-key image + + // Data values for IA_FrameType (recognized by FrameIClass) + FRAME_DEFAULT = 0; // The standard V37-type frame, which has thin edges. + FRAME_BUTTON = 1; // Standard button gadget frames, having thicker sides and nicely edged corners. + FRAME_RIDGE = 2; // A ridge such as used by standard string gadgets. You can recess the ridge to get a groove image. + FRAME_ICONDROPBOX = 3; // A broad ridge which is the standard imagery for areas in AppWindows where icons may be dropped. + + // image message id's + IM_DRAW = $202; // draw yourself, with "state" + IM_HITTEST = $203; // return True if click hits image + IM_ERASE = $204; // erase yourself + IM_MOVE = $205; // draw new and erase old, smoothly + IM_DRAWFRAME = $206; // draw with specified dimensions + IM_FRAMEBOX = $207; // get recommended frame around some box + IM_HITFRAME = $208; // hittest with dimensions + IM_ERASEFRAME = $209; // hittest with dimensions + + // image draw states or styles, for IM_DRAW + IDS_NORMAL = 0; + IDS_SELECTED = 1; // for selected gadgets + IDS_DISABLED = 2; // for disabled gadgets + IDS_BUSY = 3; // for future functionality + IDS_INDETERMINATE = 4; // for future functionality + IDS_INACTIVENORMAL = 5; // normal, in inactive window border + IDS_INACTIVESELECTED = 6; // selected, in inactive border + IDS_INACTIVEDISABLED = 7; // disabled, in inactive border + IDS_SELECTEDDISABLED = 8; // disabled and selected + +type + // IM_FRAMEBOX + PimpFrameBox = ^TimpFrameBox; + TimpFrameBox = record + MethodID: LongWord; + imp_ContentsBox: PIBox; // input: relative box of contents + imp_FrameBox: PIBox; // output: rel. box of encl frame + imp_DrInfo: PDrawInfo; // may be nil + imp_FrameFlags: LongWord; + end; + +const + FRAMEF_SPECIFY = 1 shl 0; // Make do with the dimensions of FrameBox provided. + +type + PimpPos = ^TimpPos; + TimpPos = record + X: SmallInt; + Y: SmallInt; + end; + + PimpSize = ^TimpSize; + TimpSize = record + Width: SmallInt; + Height: SmallInt; + end; + + // IM_DRAW, IM_DRAWFRAME + PimpDraw = ^TimpDraw; + TimpDraw = record + MethodID: LongWord; + imp_RPort: PRastPort; + imp_Offset: TimpPos; + imp_State: LongWord; + imp_DrInfo: PDrawInfo; // May be nil + imp_Dimensions: TimpSize; // Only valid for IM_DRAWFRAME + end; + + // IM_ERASE, IM_ERASEFRAME NOTE: This is a subset of TimpDraw + PimpErase = ^TimpErase; + TimpErase = record + MethodID: LongWord; + imp_RPort: PRastPort; + imp_Offset: TimpPos; + imp_Dimensions: TimpSize; // // Only valid for IM_DRAWFRAME + end; + + // IM_HITTEST, IM_HITFRAME + PimpHitTest = ^TimpHitTest; + TimpHitTest = record + MethodID: LongWord; + imp_Point: TimpPos; + imp_Dimensions: TimpSize; // only valid for IM_HITFRAME + end; + +// 'boopsi' pointer class interface +const + // The following tags are recognized at NewObject() time by pointerclass + POINTERA_Dummy = TAG_USER + $39000; + POINTERA_BitMap = POINTERA_Dummy + $01; // (PBitmap) Pointer to bitmap to get pointer imagery from. Bitplane data need not be in chip RAM. + POINTERA_XOffset = POINTERA_Dummy + $02; // (LongInt) - X-offset of the pointer hotspot. + POINTERA_YOffset = POINTERA_Dummy + $03; // (LongInt) - Y-offset of the pointer hotspot. + POINTERA_WordWidth = POINTERA_Dummy + $04; // (LongWord) - designed width of the pointer in words + POINTERA_XResolution = POINTERA_Dummy + $05; // (LongWord) - one of the POINTERXRESN_ flags below + POINTERA_YResolution = POINTERA_Dummy + $06; // (LongWord) - one of the POINTERYRESN_ flags below + + // These are the choices for the POINTERA_XResolution attribute which + // will determine what resolution pixels are used for this pointer. + POINTERXRESN_DEFAULT = 0; // (ECS-compatible pointer width) = 70 ns if SUPERHIRES-type mode, 140 ns if not + POINTERXRESN_140NS = 1; // (pointer always in 140 ns pixels) = 140 ns always + POINTERXRESN_70NS = 2; // (pointer always in 70 ns pixels) = 70 ns always + POINTERXRESN_35NS = 3; // (pointer always in 35 ns pixels) = 35 ns always + POINTERXRESN_SCREENRES = 4; // Same as pixel speed of screen + POINTERXRESN_LORES = 5; // (pointer always in lores-like pixels) = 140 ns in 15kHz modes, 70 ns in 31kHz modes + POINTERXRESN_HIRES = 6; // (pointer always in hires-like pixels) = 70 ns in 15kHz modes, 35 ns in 31kHz modes + +{ These are the choices for the POINTERA_YResolution attribute which + will determine what vertical resolution is used for this pointer. + + POINTERYRESN_DEFAULT + = In 15 kHz modes, the pointer resolution will be the same + as a non-interlaced screen. In 31 kHz modes, the pointer + will be doubled vertically. This means there will be about + 200-256 pointer lines per screen. + + POINTERYRESN_HIGH + POINTERYRESN_HIGHASPECT + = Where the hardware/software supports it, the pointer resolution + will be high. This means there will be about 400-480 pointer + lines per screen. POINTERYRESN_HIGHASPECT also means that + when the pointer comes out double-height due to hardware/software + restrictions, its width would be doubled as well, if possible + (to preserve aspect). + + POINTERYRESN_SCREENRES + POINTERYRESN_SCREENRESASPECT + = Will attempt to match the vertical resolution of the pointer + to the screen's vertical resolution. POINTERYRESN_SCREENASPECT also + means that when the pointer comes out double-height due to + hardware/software restrictions, its width would be doubled as well, + if possible (to preserve aspect).} + + POINTERYRESN_DEFAULT = 0; + POINTERYRESN_HIGH = 2; + POINTERYRESN_HIGHASPECT = 3; + POINTERYRESN_SCREENRES = 4; + POINTERYRESN_SCREENRESASPECT = 5; +type + PSGWork = ^TSGWork; + TSGWork = record + // set up when gadget is first activated } + Gadget: PGadget; // the contestant itself + StringInfo: PStringInfo; // easy access to sinfo + WorkBuffer: STRPTR; // intuition's planned result + PrevBuffer: STRPTR; // what was there before + Modes: LongWord; // current mode + // modified for each input event + IEvent: PInputEvent; // actual event: do not change + Code: Word; // character code, IF one Byte + BufferPos: SmallInt; // cursor position + NumChars: SmallInt; + Actions: LongWord; // what Intuition will do + LongInt_: LongInt; // temp storage for LongInt + GadgetInfo: PGadgetInfo; + EditOp: Word; // from constants below + end; + +{ TSGWork.EditOp - These values indicate what basic type of operation the global editing hook has performed on the string before your gadget's custom + editing hook gets called. You do not have to be concerned with the value your custom hook leaves in the EditOp field, only if you write a global editing hook. + For most of these general edit operations, you'll want to compare the BufferPos and NumChars of the StringInfo (before global editing) and SGWork (after global editing).} +const + EO_NOOP = $0001; // did nothing + EO_DELBACKWARD = $0002; // deleted some chars (maybe 0). + EO_DELFORWARD = $0003; // deleted some characters under and in front of the cursor + EO_MOVECURSOR = $0004; // moved the cursor + EO_ENTER = $0005; // "enter" or "return" key, terminate + EO_RESET = $0006; // current Intuition-style undo + EO_REPLACECHAR = $0007; // replaced one character and (maybe) advanced cursor + EO_INSERTCHAR = $0008; // inserted one char into string or added one at end + EO_BADFORMAT = $0009; // didn't like the text data, e.g., Bad LONGINT + EO_BIGCHANGE = $000A; // unused by Intuition complete or major change to the text, e.g. new string + EO_UNDO = $000B; // unused by Intuition some other style of undo + EO_CLEAR = $000C; // clear the string + EO_SPECIAL = $000D; // unused by Intuition some operation that doesn't fit into the categories here + + // Mode Flags definitions (ONLY first group allowed as InitialModes) + SGM_REPLACE = 1 shl 0; // replace mode please initialize StringInfo with in-range value of BufferPos if you are using SGM_REPLACE mode. + SGM_FIXEDFIELD = 1 shl 1; // fixed length buffer always set SGM_REPLACE, too + SGM_NOFILTER = 1 shl 2; // don't filter control chars + SGM_EXITHELP = 1 shl 7; // exit with code = $5F IF HELP hit + // These Mode Flags are for internal use only + SGM_NOCHANGE = 1 shl 3; // no edit changes yet + SGM_NOWORKB = 1 shl 4; // Buffer = PrevBuffer + SGM_CONTROL = 1 shl 5; // control char escape mode + SGM_LONGINT = 1 shl 6; // an intuition LongInt gadget + // String Gadget Action Flags (put in SGWork.Actions by EditHook) + SGA_USE = $1; // use contents of SGWork + SGA_END = $2; // terminate gadget, code in Code field + SGA_BEEP = $4; // flash the screen for the user + SGA_REUSE = $8; // reuse input event + SGA_REDISPLAY = $10; // gadget visuals changed + SGA_NEXTACTIVE = $20; // Make next possible gadget active. + SGA_PREVACTIVE = $40; // Make previous possible gadget active. + // function id for only existing custom string gadget edit hook + SGH_KEY = 1; // process editing keystroke + SGH_CLICK = 2; // process mouse click cursor position + +{ Here's a brief summary of how the custom string gadget edit hook works: + You provide a hook in StringInfo.Extension.EditHook. The hook is called in the standard way with the 'object' a pointer to SGWork, + and the 'message' a pointer to a command block, starting either with (LongWord) SGH_KEY, SGH_CLICK, or something new. + You return 0 if you don't understand the command (SGH_KEY is required and assumed). Return non-zero if you implement the command. + SGH_KEY: + There are no parameters following the command LongWord. Intuition will put its idea of proper values in the SGWork + before calling you, and if you leave SGA_USE set in the SGWork.Actions field, Intuition will use the values + found in SGWork fields WorkBuffer, NumChars, BufferPos, and LongInt, copying the WorkBuffer back to the StringInfo + Buffer. + + NOTE WELL: You may NOT change other SGWork fields. + If you clear SGA_USE, the string gadget will be unchanged. + + If you set SGA_END, Intuition will terminate the activation of the string gadget. If you also set SGA_REUSE, Intuition + will reuse the input event after it deactivates your gadget. In this case, Intuition will put the value found in SGWork.Code + into the IntuiMessage.Code field of the IDCMP_GADGETUP message it sends to the application. + + If you set SGA_BEEP, Intuition will call DisplayBeep(); use this if the user has typed in error, or buffer is full. + + Set SGA_REDISPLAY if the changes to the gadget warrant a gadget redisplay. Note: cursor movement requires a redisplay. + Starting in V37, you may set SGA_PREVACTIVE or SGA_NEXTACTIVE when you set SGA_END. This tells Intuition that you want + the next or previous gadget with GFLG_TABCYCLE to be activated. + + SGH_CLICK: + This hook command is called when Intuition wants to position the cursor in response to a mouse click in the string gadget. + Again, here are no parameters following the command LongWord. This time, Intuition has already calculated the mouse position + character cell and put it in SGWork.BufferPos. The previous BufferPos value remains in the SGWork.StringInfo.BufferPos. + + Intuition will again use the SGWork fields listed above for SGH_KEY. One restriction is that you are NOT allowed to set + SGA_END or SGA_REUSE for this command. Intuition will not stand for a gadget which goes inactive when you click in it. + + You should always leave the SGA_REDISPLAY flag set, since Intuition uses this processing when activating a string gadget.} +type +{ NewDecorator structure used by ChangeDecoration the three Objects (nd_Window, nd_Screen and nd_Menu must be installed and point to decorator objects + the port is used for different issues and will be filled up with DecoratorMessages} + PNewDecorator = ^TNewDecorator; + TNewDecorator = record + nd_Node: TNode; + nd_Port: PMsgPort; + nd_cnt: Word; + nd_Pattern: STRPTR; + nd_IntPattern: STRPTR; // Private, transformated Pattern be dos/ParsePattern() + nd_Window: PObject_; + nd_Screen: PObject_; + nd_Menu: PObject_; + end; + + PDecoratorMessage = ^TDecoratorMessage; + TDecoratorMessage = record + dm_Message: TMagicMessage; + dm_Class: LongWord; + dm_Code: LongWord; + dm_Flags: LongWord; + dm_Object: IPTR; + end; + + PScreenNotifyMessage = ^TScreenNotifyMessage; + TScreenNotifyMessage = record + snm_Message: PMagicMessage; + snm_Class: LongWord; // Notification Class ID same as SNA_Notify + snm_Code: LongWord; // Code only supported for ScreenDepth() and will put the Flags in + snm_Object: IPTR; // Pointer to the Object that caused this message + snm_UserData: IPTR; // will be filled with SNA_UserData + end; + +const + DECORATOR_VERSION = 0; + SCREENNOTIFY_VERSION = 0; +{ there is only one Message in the initial decoration system it will be sent to the decorator port to signal that it´ll not be used any longer + and may be destroyed, in that case the dm_Object contains the NewDecorator struct Intuition does not touch anything, the decorator have to + destroy all objects as well as the NewDecorator struct.} + DM_CLASS_DESTROYDECORATOR = $8001; + // Tags for Screen notify message + SNA_PubName = TAG_USER + $01; // public screen name of nil for all screens + SNA_Notify = TAG_USER + $02; // Flags to look for see below + SNA_UserData = TAG_USER + $03; // this tag will be passed to the screennotify message + SNA_SigTask = TAG_USER + $04; // if port = nil, a sigbit will be set for this task + SNA_SigBit = TAG_USER + $05; // signal bit to set if port = nil + SNA_MsgPort = TAG_USER + $06; // if <> nil post mesage to this port + SNA_Priority = TAG_USER + $07; + SNA_Hook = TAG_USER + $08; + + // SNA_Notify (all unassigned bits are reserved for system use) + SNOTIFY_AFTER_OPENSCREEN = 1 shl 0; // screen has been opened + SNOTIFY_BEFORE_CLOSESCREEN = 1 shl 1; // going to close screen + SNOTIFY_AFTER_OPENWB = 1 shl 2; // Workbench is open + SNOTIFY_BEFORE_CLOSEWB = 1 shl 3; // Workbench is going to be closed + SNOTIFY_AFTER_OPENWINDOW = 1 shl 4; // new window + SNOTIFY_BEFORE_CLOSEWINDOW = 1 shl 5; // window is going to be closed + SNOTIFY_PUBSCREENSTATE = 1 shl 6; // PubScreenState() + SNOTIFY_LOCKPUBSCREEN = 1 shl 7; // LockPubScreen() + SNOTIFY_SCREENDEPTH = 1 shl 8; // ScreenDepth() + SNOTIFY_AFTER_CLOSESCREEN = 1 shl 9; // notify after CloseScreen() + SNOTIFY_AFTER_CLOSEWINDOW = 1 shl 10; // dto. CloseWindow() + SNOTIFY_BEFORE_OPENSCREEN = 1 shl 11; // notify before OpenScreen() + SNOTIFY_BEFORE_OPENWINDOW = 1 shl 12; // dto. OpenWindow() + SNOTIFY_BEFORE_OPENWB = 1 shl 13; // like OPENSCREEN + SNOTIFY_AFTER_CLOSEWB = 1 shl 14; // like CLOSESCREEN + SNOTIFY_WAIT_REPLY = 1 shl 15; // wait for reply before taking action + SNOTIFY_UNLOCKPUBSCREEN = 1 shl 16; // UnlockPubScreen() + SNOTIFY_BEFORE_UPDATEINTUITION = 1 shl 17; // Intuition is going to be updated + SNOTIFY_AFTER_UPDATEINTUITION = 1 shl 18; // Intuition is updated + + // Attributes for MENUDECORCLASS + MDA_Dummy = TAG_USER + $22000; + MDA_DrawInfo = MDA_Dummy + 1; // [I.G] + MDA_Screen = MDA_Dummy + 2; // [I.G] + MDA_TrueColorOnly = MDA_Dummy + 3; // [..G] + MDA_UserBuffer = MDA_Dummy + 4; // [I.G] + // Methods for MENUDECORCLASS + MDM_Dummy = MDA_Dummy + 500; + MDM_GETDEFSIZE_SYSIMAGE = MDM_Dummy + 1; + MDM_DRAW_SYSIMAGE = MDM_Dummy + 2; + MDM_GETMENUSPACES = MDM_Dummy + 3; + MDM_DRAWBACKGROUND = MDM_Dummy + 4; + MDM_INITMENU = MDM_Dummy + 5; + MDM_EXITMENU = MDM_Dummy + 6; + +type + PmdpGetDefSizeSysImage = ^TmdpGetDefSizeSysImage; + TmdpGetDefSizeSysImage = record + MethodID: LongWord; + mdp_TrueColor: ShortInt; + mdp_Dri: PDrawInfo; + mdp_ReferenceFont: PTextFont; // In: + mdp_Which: LongWord; // In: One of CLOSEIMAGE, SIZEIMAGE, ... + mdp_SysiSize: LongWord; // In: lowres/medres/highres + mdp_Width: PLongWord; // Out + mdp_Height: PLongWord; // Out + mdp_Flags: LongWord; + end; + + PmdpDrawSysImage = ^TmdpDrawSysImage; + TmdpDrawSysImage = record + MethodID: LongWord; + mdp_TrueColor: ShortInt; + mdp_Dri: PDrawInfo; + mdp_RPort: PRastPort; + mdp_X: LongInt; + mdp_Y: LongInt; + mdp_Width: LongInt; + mdp_Height: LongInt; + mdp_Which: LongWord; + mdp_State: LongWord; + mdp_Flags: LongWord; + mdp_UserBuffer: IPTR; + end; + + PmdpGetMenuSpaces = ^TmdpGetMenuSpaces; + TmdpGetMenuSpaces = record + MethodID: LongInt; + mdp_TrueColor: ShortInt; + mdp_InnerLeft: LongInt; // Out + mdp_InnerTop: LongInt; // Out + mdp_InnerRight: LongInt; + mdp_InnerBottom: LongInt; + mdp_ItemInnerLeft: LongInt; + mdp_ItemInnerTop: LongInt; + mdp_ItemInnerRight: LongInt; + mdp_ItemInnerBottom: LongInt; + mdp_MinWidth: LongInt; + mdp_MinHeight: LongInt; + end; + + PmdpDrawBackground = ^TmdpDrawBackground; + TmdpDrawBackground = record + MethodID: Longword; + mdp_TrueColor: ShortInt; + mdp_RPort: PRastPort; + mdp_X: LongInt; + mdp_Y: LongInt; + mdp_Width: LongInt; + mdp_Height: LongInt; + mdp_ItemLeft: LongInt; + mdp_ItemTop: LongInt; + mdp_ItemWidth: LongInt; + mdp_ItemHeight: LongInt; + mdp_Flags: Word; + mdp_UserBuffer: IPTR; + mdp_MenuDecorFlags: LongWord; + end; + + PmdpInitMenu = ^TmdpInitMenu; + TmdpInitMenu = record + MethodID: LongInt; + mdp_TrueColor: SmallInt; + mdp_RPort: PRastPort; + mdp_Screen: PScreen; + mdp_Left: LongWord; + mdp_Top: LongWord; + mdp_Width: LongWord; + mdp_Height: LongInt; + mdp_UserBuffer: IPTR; + mdp_ScreenUserBuffer: IPTR; + mdp_MenuDecorFlags: LongWord; + end; + + PmdpExitMenu = ^TmdpExitMenu; + TmdpExitMenu = record + MethodID: LongInt; + mdp_TrueColor: ShortInt; + mdp_UserBuffer: IPTR; + end; + +const + MDP_STATE_NORMAL = 0; + MDP_STATE_SELECTED = 1; + MDP_STATE_DISABLED = 2; + + MDP_MDF_MENU = 1 shl 0; + MDP_MDF_ITEM = 1 shl 1; + MDP_MDF_SUBITEM = 1 shl 2; + MDP_MDF_MENUS_UNDERMOUSE = 1 shl 7; + + // Length of array returned by MA_PixelFormats + MONITOR_MAXPIXELFORMATS = 14; + + // Attributes + MA_Dummy = TAG_USER; + MA_MonitorName = MA_Dummy + 1; // [..G] STRPTR Monitor name + MA_Manufacturer = MA_Dummy + 2; // [..G] STRPTR Hardware manufacturer string + MA_ManufacturerID = MA_Dummy + 3; // [..G] LongWord + MA_ProductID = MA_Dummy + 4; // [..G] LongWord + MA_MemorySize = MA_Dummy + 5; // [..G] LongWord Video card memory size + MA_PixelFormats = MA_Dummy + 6; // [..G] PLongWord Pixelformat support flags + MA_TopLeftMonitor = MA_Dummy + 7; // [.SG] PObject_ Monitor placed in a position relative to the current one + MA_TopMiddleMonitor = MA_Dummy + 8; // [.SG] PObject_ + MA_TopRightMonitor = MA_Dummy + 9; // [.SG] PObject_ + MA_MiddleLeftMonitor = MA_Dummy + 10; // [.SG] PObject_ + MA_MiddleRightMonitor = MA_Dummy + 11; // [.SG] PObject_ + MA_BottomLeftMonitor = MA_Dummy + 12; // [.SG] PObject_ + MA_BottomMiddleMonitor = MA_Dummy + 13; // [.SG] PObject_ + MA_BottomRightMonitor = MA_Dummy + 14; // [.SG] PObject_ + MA_GammaControl = MA_Dummy + 15; // [..G] LongBool Whether gamma control is supported + MA_PointerType = MA_Dummy + 16; // [..G] LongWord Supported pointer types + MA_DriverName = MA_Dummy + 17; // [..G] STRPTR Driver name + MA_MemoryClock = MA_Dummy + 18; // [..G] LongWord Video memory clock in Hz, 0 if unknown + + //* Pointer type flags */ + PointerType_3Plus1 = $0001; // color 0 transparent, 1-3 visible + PointerType_2Plus1 = $0002; // color 0 transparent, 2-3 visible, 1 undefined/clear/inverse + PointerType_ARGB = $0004; // Direct color alpha-blended bitmap pointer + + // Methods + MM_GetRootBitMap = $401; // Reserved + MM_Query3DSupport = $402; // Ask for 3D acceleration support for given pixelformat + MM_GetDefaultGammaTables = $403; // Get default gamma correction table + MM_GetDefaultPixelFormat = $404; // Ask for preferred pixelformat for given depth (-1 = unsupported depth) + MM_GetPointerBounds = $405; // Ask for maximum supported mouse pointer size + MM_RunBlanker = $406; // Start screensaver for this monitor + MM_EnterPowerSaveMode = $407; // Start power saving mode + MM_ExitBlanker = $408; // Stop screensaver or power saving mode + + // AROS-specific attributes + MA_AROS = TAG_USER + $00010000; + MA_Windowed = MA_AROS + 1; // [G..] BOOL A display is a window on hosted OS + // AROS-specific methods + MM_SetDefaultGammaTables = $1401; // Set default gamma correction table + +type + PmsGetRootBitMap = ^TmsGetRootBitMap; + TmsGetRootBitMap = record + MethodID: LongWord; + PixelFormat: LongWord; + Store: ^PBitMap; + end; + + PmsQuery3DSupport = ^TmsQuery3DSupport; + TmsQuery3DSupport = record + MethodID: LongWord; + PixelFormat: LongWord; + Store: PLongWord; + end; +const + MSQUERY3D_UNKNOWN = 0; // Unsupported pixelformat or other error + MSQUERY3D_NODRIVER = 1; // No 3D support available + MSQUERY3D_SWDRIVER = 2; // Software 3D support available + MSQUERY3D_HWDRIVER = 3; // Hardware accelerated 3D available +type + PmsGetDefaultGammaTables = ^TmsGetDefaultGammaTables; + TmsGetDefaultGammaTables = record + MethodID: LongWord; + Red: PByte; // Optional pointers to 256-byte arrays to fill in + Green: PByte; + Blue: PByte; + end; + + PmsGetDefaultPixelFormat = ^TmsGetDefaultPixelFormat; + TmsGetDefaultPixelFormat = record + MethodID: LongWord; + Depth: LongWord; + Store: PLongWord; + end; + + PmsGetPointerBounds = ^TmsGetPointerBounds; + TmsGetPointerBounds = record + MethodID: LongWord; + PointerType: LongWord; + Width: PLongWord; + Height: PLongWord; + end; + + PmsSetDefaultGammaTables = PmsGetDefaultGammaTables; + TmsSetDefaultGammaTables = TmsGetDefaultGammaTables; +const + // Attributes for SCRDECORCLASS + SDA_Dummy = TAG_USER + $22100; + SDA_DrawInfo = SDA_Dummy + 1; // [I.G] + SDA_Screen = SDA_Dummy + 2; // [I.G] + SDA_TrueColorOnly = SDA_Dummy + 3; // [..G] + SDA_UserBuffer = SDA_Dummy + 4; // [I.G] + // Methods for SCRDECORCLASS */ + SDM_Dummy = SDA_Dummy + 500; + SDM_SETUP = SDM_Dummy + 1; + SDM_CLEANUP = SDM_Dummy + 2; + SDM_GETDEFSIZE_SYSIMAGE = SDM_Dummy + 3; + SDM_DRAW_SYSIMAGE = SDM_Dummy + 4; + SDM_DRAW_SCREENBAR = SDM_Dummy + 5; + SDM_LAYOUT_SCREENGADGETS = SDM_Dummy + 6; + SDM_INITSCREEN = SDM_Dummy + 7; + SDM_EXITSCREEN = SDM_Dummy + 8; +type + PsdpGetDefSizeSysImage = ^TsdpGetDefSizeSysImage; + TsdpGetDefSizeSysImage = record + MethodID: LongWord; + sdp_TrueColor: ShortInt; + sdp_Dri: PDrawInfo; + sdp_ReferenceFont: PTextFont; // In: + sdp_Which: LongWord; // In: SDEPTHIMAGE + sdp_SysiSize: LongWord; // In: lowres/medres/highres + sdp_Width: PLongWord; // Out + sdp_Height: PLongWord; // Out + sdp_Flags: LongWord; + sdp_UserBuffer: LongWord; + end; + + PsdpDrawSysImage = ^TsdpDrawSysImage; + TsdpDrawSysImage = record + MethodID: LongInt; + sdp_TrueColor: ShortInt; + sdp_Dri: PDrawInfo; + sdp_RPort: PRastPort; + sdp_X: LongInt; + sdp_Y: LongInt; + sdp_Width: LongInt; + sdp_Height: LongInt; + sdp_Which: LongWord; + sdp_State: LongWord; + sdp_Flags: LongWord; + sdp_UserBuffer: IPTR; + end; + + PsdpDrawScreenBar = ^TsdpDrawScreenBar; + TsdpDrawScreenBar = record + MethodID: LongWord; + sdp_TrueColor: ShortInt; + sdp_Dri: PDrawInfo; + sdp_Layer: PLayer; + sdp_RPort: PRastPort; + sdp_Screen: PScreen; + sdp_Flags: LongWord; + sdp_UserBuffer: IPTR; + end; + + PsdpLayoutScreenGadgets = ^TsdpLayoutScreenGadgets; + TsdpLayoutScreenGadgets = record + MethodID: LongWord; + sdp_TrueColor: ShortInt; + sdp_Dri: PDrawInfo; + sdp_Layer: PLayer; + sdp_Gadgets: PGadget; + sdp_Flags: LongWord; + sdp_UserBuffer: IPTR; + end; + + PsdpInitScreen = ^TsdpInitScreen; + TsdpInitScreen = record + MethodID: LongWord; + sdp_TrueColor: ShortInt; + sdp_Dri: PDrawInfo; + sdp_Screen: PScreen; + sdp_FontHeight: LongWord; + sdp_TitleHack: LongInt; + sdp_BarHeight: LongWord; + sdp_BarVBorder: LongWord; + sdp_BarHBorder: LongWord; + sdp_MenuVBorder: LongWord; + spd_MenuHBorder: LongWord; + sdp_WBorTop: ShortInt; + sdp_WBorLeft: ShortInt; + sdp_WBorRight: ShortInt; + sdp_WBorBottom: ShortInt; + sdp_UserBuffer: IPTR; + end; + + PsdpExitScreen = ^TsdpExitScreen; + TsdpExitScreen = record + MethodID: LongWord; + sdp_TrueColor: ShortInt; + sdp_UserBuffer: IPTR; + end; +const +// ScrDecor LayoutScreenGadgets Flags + SDF_LSG_INITIAL = 1; // First time = During OpenScreen + SDF_LSG_SYSTEMGADGET = 2; // Is a system gadget (sdepth) + SDF_LSG_INGADLIST = 4; // Gadget is already in screen gadget list + SDF_LSG_MULTIPLE = 8; // There may be multiple gadgets (linked together through NextGadget. Follow it) + +// Attributes for WINDECORCLASS + WDA_Dummy = TAG_USER + $22000; + WDA_DrawInfo = WDA_Dummy + 1; // [I.G] + WDA_Screen = WDA_Dummy + 2; // [I.G] + WDA_TrueColorOnly = WDA_Dummy + 3; // [..G] + WDA_UserBuffer = WDA_Dummy + 4; // [I.G] + +// Methods for WINDECORCLASS + WDM_Dummy = WDA_Dummy + 500; + WDM_SETUP = WDM_Dummy + 1; + WDM_CLEANUP = WDM_Dummy + 2; + WDM_GETDEFSIZE_SYSIMAGE = WDM_Dummy + 3; + WDM_DRAW_SYSIMAGE = WDM_Dummy + 4; + WDM_DRAW_WINBORDER = WDM_Dummy + 5; + WDM_LAYOUT_BORDERGADGETS = WDM_Dummy + 6; + WDM_DRAW_BORDERPROPBACK = WDM_Dummy + 7; + WDM_DRAW_BORDERPROPKNOB = WDM_Dummy + 8; + WDM_INITWINDOW = WDM_Dummy + 9; + WDM_EXITWINDOW = WDM_Dummy + 10; + WDM_WINDOWSHAPE = WDM_Dummy + 11; + +type + PwdpGetDefSizeSysImage = ^TwdpGetDefSizeSysImage; + TwdpGetDefSizeSysImage = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Dri: PDrawInfo; + wdp_ReferenceFont: PTextFont; // In: + wdp_Which: LongWord; // In: One of CLOSEIMAGE, SIZEIMAGE, ... + wdp_SysiSize: LongWord; // In: lowres/medres/highres + wdp_Width: PLongWord; // Out + wdp_Height: PLongWord; // Out + wdp_Flags: LongWord; + wdp_UserBuffer: IPTR; + end; + + PwdpDrawSysImage = ^TwdpDrawSysImage; + TwdpDrawSysImage = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Dri: PDrawInfo; + wdp_RPort: PRastPort; + wdp_X: LongInt; + wdp_Y: LongInt; + wdp_Width: LongInt; + wdp_Height: LongInt; + wdp_Which: LongWord; + wdp_State: LongWord; + wdp_Flags: LongWord; + wdp_UserBuffer: IPTR; + end; + + PwdpDrawWinBorder = ^TwdpDrawWinBorder; + TwdpDrawWinBorder = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Dri: PDrawInfo; + wdp_Window: PWindow; + wdp_RPort: PRastPort; + wdp_Flags: LongWord; + wdp_UserBuffer: IPTR; + end; + + PwdpLayoutBorderGadgets = ^TwdpLayoutBorderGadgets; + TwdpLayoutBorderGadgets = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Dri: PDrawInfo; + wdp_Window: PWindow; + wdp_Gadgets: PGadget; + wdp_Flags: LongWord; + wdp_ExtraButtons: LongWord; + wdp_UserBuffer: IPTR; + end; + + PwdpDrawBorderPropBack = ^TwdpDrawBorderPropBack; + TwdpDrawBorderPropBack = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Dri: PDrawInfo; + wdp_Window: PWindow; + wdp_RPort: PRastPort; + wdp_Gadget: PGadget; + wdp_RenderRect: PRectangle; + wdp_PropRect: PRectangle; + wdp_KnobRect: Prectangle; + wdp_Flags: LongWord; + wdp_UserBuffer: IPTR; + end; + + PwdpDrawBorderPropKnob = ^TwdpDrawBorderPropKnob; + TwdpDrawBorderPropKnob = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Dri: PDrawInfo; + wdp_Window: PWindow; + wdp_RPort: PRastPort; + wdp_Gadget: PGadget; + wdp_RenderRect: PRectangle; + wdp_PropRect: PRectangle; + wdp_Flags: LongWord; + wdp_UserBuffer: IPTR; + end; + + PwdpInitWindow = ^TwdpInitWindow; + TwdpInitWindow = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_UserBuffer: IPTR; + wdp_Screen: PScreen; + wdp_ScreenUserBuffer: IPTR; + end; + + PwdpExitWindow = ^TwdpExitWindow; + TwdpExitWindow = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_UserBuffer: IPTR; + end; + + PwdpWindowShape = ^TwdpWindowShape; + TwdpWindowShape = record + MethodID: LongWord; + wdp_TrueColor: ShortInt; + wdp_Window: PWindow; + wdp_Width: LongInt; + wdp_Height: LongInt; + wdp_UserBuffer: IPTR; + end; +const +// WinDecor DrawWindowBorder Flags + WDF_DWB_TOP_ONLY = 1; // Draw top border only +// WinDecor DrawWinTitle Title Align + WD_DWTA_LEFT = 0; + WD_DWTA_RIGHT = 1; + WD_DWTA_CENTER = 2; +// WinDecor LayourBorderGadgets Flags + WDF_LBG_INITIAL = 1; // First time == During OpenWindow + WDF_LBG_SYSTEMGADGET = 2; // Is a system gadget (close/depth/zoom) + WDF_LBG_INGADLIST = 4; // Gadget is already in window gadget list + WDF_LBG_MULTIPLE = 8; // There may be multiple gadgets (linked together through NextGadget. Follow it) +// WinDecor DrawBorderPropKnob Flags + WDF_DBPK_HIT = 1; // Knob is hit / in use by user + + +// extensions: +const + +// Sysiclass SYSIA_Which + ICONIFYIMAGE = $12; + LOCKIMAGE = $13; + MUIIMAGE = $14; + POPUPIMAGE = $15; + SNAPSHOTIMAGE = $16; + JUMPIMAGE = $17; + MENUTOGGLEIMAGE = $19; + SUBMENUIMAGE = $1A; + +// Window attributes + WA_ExtraTitlebarGadgets = WA_Dummy + 151; + WA_ExtraGadgetsStartID = WA_Dummy + 152; + WA_ExtraGadget_Iconify = WA_Dummy + 153; + WA_ExtraGadget_Lock = WA_Dummy + 154; + WA_ExtraGadget_MUI = WA_Dummy + 155; + WA_ExtraGadget_PopUp = WA_Dummy + 156; + WA_ExtraGadget_Snapshot = WA_Dummy + 157; + WA_ExtraGadget_Jump = WA_Dummy + 158; + +// WA_ExtraTitlebarGadgets + // Flags + ETG_ICONIFY = $01; + ETG_LOCK = $02; + ETG_MUI = $04; + ETG_POPUP = $08; + ETG_SNAPSHOT = $10; + ETG_JUMP = $20; + + // Gadget ID offsets + ETD_Iconify = 0; + ETD_Lock = 1; + ETD_MUI = 2; + ETD_PopUp = 3; + ETD_Snapshot = 4; + ETD_Jump = 5; + + // Gadget IDs + ETI_Dummy = $FFD0; + ETI_Iconify = ETI_Dummy + ETD_Iconify; + ETI_Lock = ETI_Dummy + ETD_Lock; + ETI_MUI = ETI_Dummy + ETD_MUI; + ETI_PopUp = ETI_Dummy + ETD_PopUp; + ETI_Snapshot = ETI_Dummy + ETD_Snapshot; + ETI_Jump = ETI_Dummy + ETD_Jump; + +// Defines for WindowAction() + // Commands + WAC_BASE = $0001; + WAC_HIDEWINDOW = WAC_BASE + 0 unimplemented; + WAC_SHOWWINDOW = WAC_BASE + 1 unimplemented; + WAC_SENDIDCMPCLOSE = WAC_BASE + 2; + WAC_MOVEWINDOW = WAC_BASE + 3 unimplemented; + WAC_SIZEWINDOW = WAC_BASE + 4 unimplemented; + WAC_CHANGEWINDOWBOX = WAC_BASE + 5 unimplemented; + WAC_WINDOWTOFRONT = WAC_BASE + 6 unimplemented; + WAC_WINDOWTOBACK = WAC_BASE + 7 unimplemented; + WAC_ZIPWINDOW = WAC_BASE + 8 unimplemented; + WAC_MOVEWINDOWINFRONTOF = WAC_BASE + 9 unimplemented; + WAC_ACTIVATEWINDOW = WAC_BASE + 10 unimplemented; + + // Tags + WAT_BASE = TAG_USER; + // WAC_MOVEWINDOW + WAT_MOVEWINDOWX = WAT_BASE + 1; + WAT_MOVEWINDOWY = WAT_BASE + 2; + // WAC_SIZEWINDOW + WAT_SIZEWINDOWX = WAT_BASE + 3; + WAT_SIZEWINDOWY = WAT_BASE + 4; + // WAC_CHANGEWINDOWBOX + WAT_WINDOWBOXLEFT = WAT_BASE + 5; + WAT_WINDOWBOXTOP = WAT_BASE + 6; + WAT_WINDOWBOXWIDTH = WAT_BASE + 7; + WAT_WINDOWBOXHEIGHT = WAT_BASE + 8; + // WAC_MOVEWINDOWINFRONTOF + WAT_MOVEWBEHINDWINDOW = WAT_BASE + 9; + +{$ifndef INTUI_V36_NAMES_ONLY} + +//* Gadget Type names: */ + + GTYPEMASK = GTYP_GTYPEMASK; + CUSTOMGADGET = GTYP_CUSTOMGADGET; + STRGADGET = GTYP_STRGADGET; + PROPGADGET = GTYP_PROPGADGET; + GADGET0002 = GTYP_GADGET0002; + BOOLGADGET = GTYP_BOOLGADGET; + IntuiCLOSE = GTYP_CLOSE; + //SDOWNBACK = GTYP_SDOWNBACK; // not in the official AROS includes + //WDOWNBACK = GTYP_WDOWNBACK; + //SUPFRONT = GTYP_SUPFRONT; + //WUPFRONT = GTYP_WUPFRONT; + SDRAGGING = GTYP_SDRAGGING; + WDRAGGING = GTYP_WDRAGGING; + SIZING = GTYP_SIZING; + REQGADGET = GTYP_REQGADGET; + GZZGADGET = GTYP_GZZGADGET; + SCRGADGET = GTYP_SCRGADGET; + SYSGADGET = GTYP_SYSGADGET; + GADGETTYPE = GTYP_GADGETTYPE; +// Gadget Flags names: + LABELIMAGE = GFLG_LABELIMAGE; + LABELSTRING = GFLG_LABELSTRING; + LABELITEXT = GFLG_LABELITEXT; + LABELMASK = GFLG_LABELMASK; + GADGDISABLED = GFLG_DISABLED; + SELECTED = GFLG_SELECTED; + GRELHEIGHT = GFLG_RELHEIGHT; + GRELWIDTH = GFLG_RELWIDTH; + GRELRIGHT = GFLG_RELRIGHT; + GRELBOTTOM = GFLG_RELBOTTOM; + GADGIMAGE = GFLG_GADGIMAGE; + GADGHNONE = GFLG_GADGHNONE; + GADGHIMAGE = GFLG_GADGHIMAGE; + GADGHBOX = GFLG_GADGHBOX; + GADGHCOMP = GFLG_GADGHCOMP; + GADGHIGHBITS = GFLG_GADGHIGHBITS; +// Gadget Activation flag names: + ACTIVEGADGET = GACT_ACTIVEGADGET; + STRINGEXTEND = GACT_STRINGEXTEND; + ALTKEYMAP = GACT_ALTKEYMAP; + IntuiLONGINT = GACT_LONGINT; + STRINGRIGHT = GACT_STRINGRIGHT; + STRINGCENTER = GACT_STRINGCENTER; + STRINGLEFT = GACT_STRINGLEFT; + BOOLEXTEND = GACT_BOOLEXTEND; + TOGGLESELECT = GACT_TOGGLESELECT; + BORDERSNIFF = GACT_BORDERSNIFF; + BOTTOMBORDER = GACT_BOTTOMBORDER; + TOPBORDER = GACT_TOPBORDER; + LEFTBORDER = GACT_LEFTBORDER; + RIGHTBORDER = GACT_RIGHTBORDER; + FOLLOWMOUSE = GACT_FOLLOWMOUSE; + ENDGADGET = GACT_ENDGADGET; + GADGIMMEDIATE = GACT_IMMEDIATE; + RELVERIFY = GACT_RELVERIFY; +// Window Flags names: + HASZOOM = WFLG_HASZOOM; + ZOOMED = WFLG_ZOOMED; + VISITOR = WFLG_VISITOR; + NW_EXTENDED = WFLG_NW_EXTENDED; + WINDOWTICKED = WFLG_WINDOWTICKED; + WBENCHWINDOW = WFLG_WBENCHWINDOW; + WINDOWREFRESH = WFLG_WINDOWREFRESH; + NOCAREREFRESH = WFLG_NOCAREREFRESH; + RMBTRAP = WFLG_RMBTRAP; + MENUSTATE = WFLG_MENUSTATE; + INREQUEST = WFLG_INREQUEST; + WINDOWACTIVE = WFLG_WINDOWACTIVE; + ACTIVATE = WFLG_ACTIVATE; + BORDERLESS = WFLG_BORDERLESS; + GIMMEZEROZERO = WFLG_GIMMEZEROZERO; + IntuiREPORTMOUSE = WFLG_REPORTMOUSE; + BACKDROP = WFLG_BACKDROP; + OTHER_REFRESH = WFLG_OTHER_REFRESH; + SUPER_BITMAP = WFLG_SUPER_BITMAP; + SIMPLE_REFRESH= WFLG_SIMPLE_REFRESH; + SMART_REFRESH = WFLG_SMART_REFRESH; + REFRESHBITS = WFLG_REFRESHBITS; + SIZEBBOTTOM = WFLG_SIZEBBOTTOM; + SIZEBRIGHT = WFLG_SIZEBRIGHT; + WINDOWCLOSE = WFLG_CLOSEGADGET; + WINDOWDEPTH = WFLG_DEPTHGADGET; + WINDOWDRAG = WFLG_DRAGBAR; + WINDOWSIZING = WFLG_SIZEGADGET; +// IDCMP class names: + LONELYMESSAGE = IDCMP_LONELYMESSAGE; + CHANGEWINDOW = IDCMP_CHANGEWINDOW; + MENUHELP = IDCMP_MENUHELP; + IDCMPUPDATE = IDCMP_IDCMPUPDATE; + INTUITICKS = IDCMP_INTUITICKS; + VANILLAKEY = IDCMP_VANILLAKEY; + DELTAMOVE = IDCMP_DELTAMOVE; + INACTIVEWINDOW = IDCMP_INACTIVEWINDOW; + ACTIVEWINDOW = IDCMP_ACTIVEWINDOW; + WBENCHMESSAGE = IDCMP_WBENCHMESSAGE; + DISKREMOVED = IDCMP_DISKREMOVED; + DISKINSERTED = IDCMP_DISKINSERTED; + NEWPREFS = IDCMP_NEWPREFS; + MENUVERIFY = IDCMP_MENUVERIFY; + REQCLEAR = IDCMP_REQCLEAR; + REQVERIFY = IDCMP_REQVERIFY; + RAWKEY = IDCMP_RAWKEY; + IntuiCLOSEWINDOW = IDCMP_CLOSEWINDOW; + MENUPICK = IDCMP_MENUPICK; + REQSET = IDCMP_REQSET; + GADGETUP = IDCMP_GADGETUP; + GADGETDOWN = IDCMP_GADGETDOWN; + MOUSEMOVE = IDCMP_MOUSEMOVE; + MOUSEBUTTONS = IDCMP_MOUSEBUTTONS; + REFRESHWINDOW = IDCMP_REFRESHWINDOW; + NEWSIZE = IDCMP_NEWSIZE; + SIZEVERIFY = IDCMP_SIZEVERIFY; +{$endif} // not INTUI_V36_NAMES_ONLY + +// Tags for GetMonitorList +const + GMLA_Dummy = TAG_USER + $4000; + GMLA_DisplayID = GMLA_Dummy + 1; + +var + IntuitionBase: PIntuitionBase; + + +function ActivateGadget(Gadget: PGadget; Window: PWindow; Requester: PRequester): LongBool; syscall IntuitionBase 77; +procedure ActivateWindow(Window: PWindow); syscall IntuitionBase 75; +procedure AddClass(ClassPtr: PIClass); syscall IntuitionBase 114; +function AddGadget(Window: PWindow; Gadget: PGadget; Position: LongWord): Word; syscall IntuitionBase 7; +function AddGList(Window: PWindow; Gadget: PGadget; Position: LongWord; NumGad: LongInt; Requester: PRequester): Word; syscall IntuitionBase 73; +function AllocIntuiMessage(Window: PWindow): PIntuiMessage; syscall IntuitionBase 148; +function AllocRemember(var RememberKey: PRemember; Size: LongWord; Flags: LongWord): APTR; syscall IntuitionBase 66; +function AllocScreenBuffer(Screen: PScreen; Bitmap: PBitMap; Flags: LongWord): PScreenBuffer; syscall IntuitionBase 128; +procedure AlohaWorkbench(MsgPort: PMsgPort); syscall IntuitionBase 67; +function AutoRequest(Window: PWindow; Body: PIntuiText; PosText: PIntuiText; NegText: PIntuiText; PFlag: LongWord; NFlag: LongWord; Width: LongWord; Height: LongWord): LongBool; syscall IntuitionBase 58; +procedure BeginRefresh(Window: PWindow); syscall IntuitionBase 59; +function BuildEasyRequestArgs(Window: PWindow; EasyStruct: PEasyStruct; IDCMP: LongWord; Args: APTR): PWindow; syscall IntuitionBase 99; +function BuildSysRequest(Window: PWindow; Body: PIntuiText; PosText: PIntuiText; NegText: PIntuiText; Flags: LongWord; Width: LongWord; Height: LongWord): PWindow; syscall IntuitionBase 60; +function ChangeScreenBuffer(Screen: PScreen; ScreenBuffer: PScreenBuffer): LongWord; syscall IntuitionBase 130; +procedure ChangeWindowBox(Window: PWindow; Left: LongInt; Top: LongInt; Width: LongInt; Height: LongInt); syscall IntuitionBase 81; +function ClearDMRequest(Window: PWindow): LongBool; syscall IntuitionBase 8; +procedure ClearMenuStrip(Window: PWindow); syscall IntuitionBase 9; +procedure ClearPointer(Window: PWindow); syscall IntuitionBase 10; +function CloseScreen(Screen: PScreen): LongBool; syscall IntuitionBase 11; +procedure CloseWindow(Window: PWindow); syscall IntuitionBase 12; +function CloseWorkBench: LongInt; syscall IntuitionBase 13; +procedure ChangeDecoration(ID: LongWord; Decor: PNewDecorator); syscall IntuitionBase 153; +function ChangeWindowShape(Window: PWindow; NewShape: PRegion; CallBack: PHook): PRegion; syscall IntuitionBase 143; unimplemented; +procedure CurrentTime(var Seconds: LongWord; var Micros: LongWord); syscall IntuitionBase 14; +function DisplayAlert(AlertNumber: LongWord; String_: PChar; Height: Word): LongBool; syscall IntuitionBase 15; deprecated; +procedure DisplayBeep(Screen: PScreen); syscall IntuitionBase 16; +procedure DisposeObject(Object_: APTR); syscall IntuitionBase 107; +function DoGadgetMethodA(Gad: PGadget; Win: PWindow; Req: PRequester; Msg: TMsg): IPTR; syscall IntuitionBase 135; +function DoNotify(Cl: PIClass; O: PObject_; Ic: Pointer; Msg: TopUpdate): Pointer; syscall IntuitionBase 145; +function DoubleClick(SSeconds: LongWord; SMicros: LongWord; CSeconds: LongWord; CMicros: LongWord): LongBool; syscall IntuitionBase 17; +procedure DrawBorder(Rp: PRastPort; Border: PBorder; LeftOffset: LongInt; TopOffset: LongInt); syscall IntuitionBase 18; +procedure DrawImage(Rp: PRastPort; Image: PImage; LeftOffset: LongInt; TopOffset: LongInt); syscall IntuitionBase 19; +procedure DrawImageState(Rp: PRastPort; Image: PImage; LeftOffset: LongInt; TopOffset: LongInt; state: LongWord; DrawInfo: PDrawInfo); syscall IntuitionBase 103; +function EasyRequestArgs(Window: PWindow; EasyStruct: PEasyStruct; IDCMP_Ptr: PLongWord; Args: APTR): LongInt; syscall IntuitionBase 98; +procedure EndRefresh(Window: PWindow; Complete: LongBool); syscall IntuitionBase 61; +procedure EndRequest(Requester: PRequester; Window: PWindow); syscall IntuitionBase 20; +function EndScreenNotify(Notify: IPTR): LongBool; syscall IntuitionBase 162; +procedure EraseImage(Rp: PRastPort; Image: PImage; LeftOffset: LongInt; TopOffset: LongInt); syscall IntuitionBase 105; +function FindClass(ClassID: ClassID): PIClass; syscall IntuitionBase 112; +function FreeClass(IClass: PIClass): LongBool; syscall IntuitionBase 119; +procedure FreeICData(ICData: Pointer); syscall IntuitionBase 146; +procedure FreeIntuiMessage(IMsg: PIntuiMessage); syscall IntuitionBase 149; +procedure FreeMonitorList(Obj: PPObject_); syscall IntuitionBase 164; +procedure FreeRemember(var RememberKey: PRemember; ReallyForget: LongInt); syscall IntuitionBase 68; +procedure FreeScreenBuffer(Screen: PScreen; ScreenBuffer: PScreenBuffer); syscall IntuitionBase 129; +procedure FreeScreenDrawInfo(Screen: PScreen; DrawInfo: PDrawInfo); syscall IntuitionBase 116; +procedure FreeSysRequest(Window: PWindow); syscall IntuitionBase 62; +procedure GadgetMouse(Gadget: PGadget; GInfo: PGadgetInfo; var MousePoint: SmallInt); syscall IntuitionBase 95; +function GetAttr(AttrID: LongWord; Object_: PObject_; StoragePtr: PIPTR): LongWord; syscall IntuitionBase 109; +function GetDefaultPubScreen(NameBuffer: PChar): PScreen; syscall IntuitionBase 97; +function GetDefPrefs(Preferences: PPreferences; Size: SmallInt): PPreferences; syscall IntuitionBase 21; +function GetMonitorList(Tags: PTagItem): PPObject_; syscall IntuitionBase 163; +function GetPrefs(Preferences: PPreferences; Size: SmallInt): PPreferences; syscall IntuitionBase 22; +function GetScreenData(Buffer: APTR; Size: LongWord; Type_: LongWord; Screen: PScreen): LongInt; syscall IntuitionBase 71; +function GetScreenDrawInfo(Screen: PScreen): PDrawInfo; syscall IntuitionBase 115; +procedure HelpControl(Window: PWindow; Flags: LongWord); syscall IntuitionBase 138; +procedure HideWindow(Window: PWindow); syscall IntuitionBase 141; +procedure InitRequester(Requester: PRequester); syscall IntuitionBase 23; deprecated; +function IntuiTextLength(iText: PIntuiText): LongInt; syscall IntuitionBase 55; +function ItemAddress(MenuStrip: PMenu; MenuNumber: Word): PMenuItem; syscall IntuitionBase 24; +function IsWindowVisible(Window: PWindow): LongWord; syscall IntuitionBase 139; +procedure LendMenus(FromWindow: PWindow; ToWindow: PWindow); syscall IntuitionBase 134; +function LockIBase(LockNumber: LongWord): LongWord; syscall IntuitionBase 69; +function LockPubScreen(const Name: STRPTR): PScreen; syscall IntuitionBase 85; +function LockPubScreenList: PList; syscall IntuitionBase 87; +function MakeClass(ClassID: ClassID; SuperClassID: ClassID; SuperClassPtr: PIClass; InstanceSize: LongWord; Flags: LongWord): PIClass; syscall IntuitionBase 113; +function MakeScreen(Screen: PScreen): LongInt; syscall IntuitionBase 63; +function ModifyIDCMP(Window: PWindow; Flags: LongWord): LongBool; syscall IntuitionBase 25; +procedure ModifyProp(Gadget: PGadget; Window: PWindow; Requester: PRequester; Flags: LongWord; HorizPot: LongWord; VertPot: LongWord; HorizBody: LongWord; VertBody: LongWord); syscall IntuitionBase 26; +procedure MoveScreen(Screen: PScreen; Dx: LongInt; Dy: LongInt); syscall IntuitionBase 27; +procedure MoveWindow(Window: PWindow; Dx: LongInt; Dy: LongInt); syscall IntuitionBase 28; +procedure MoveWindowInFrontOf(Window: PWindow; BehindWindow: PWindow); syscall IntuitionBase 80; +procedure NewModifyProp(Gadget: PGadget; Window: PWindow; Requester: PRequester; Flags: LongWord; HorizPot: LongWord; VertPot: LongWord; HorizBody: LongWord; VertBody: LongWord; NumGad: LongInt); syscall IntuitionBase 78; +function NewObjectA(ClassPtr: PIClass; ClassID: PChar; TagList: PTagItem): APTR; syscall IntuitionBase 106; +function NextObject(ObjectPtrPtr: APTR): APTR; syscall IntuitionBase 111; +function NextPubScreen(Screen: PScreen; Namebuf: PChar): PChar; syscall IntuitionBase 89; +function ObtainGIRPort(GInfo: PGadgetInfo): PRastPort; syscall IntuitionBase 93; +procedure OffGadget(Gadget: PGadget; Window: PWindow; Requester: PRequester); syscall IntuitionBase 29; +procedure OffMenu(Window: PWindow; MenuNumber: Word); syscall IntuitionBase 30; +procedure OnGadget(Gadget: PGadget; Window: PWindow; Requester: PRequester); syscall IntuitionBase 31; +procedure OnMenu(Window: PWindow; MenuNumber: Word); syscall IntuitionBase 32; +function OpenScreen(NewScreen: PNewScreen): PScreen; syscall IntuitionBase 33; +function OpenScreenTagList(NewScreen: PNewScreen; TagList: PTagItem): PScreen; syscall IntuitionBase 102; +function OpenWindow(NewWindow: PNewWindow): PWindow; syscall IntuitionBase 34; +function OpenWindowTagList(NewWindow: PNewWindow; TagList: PTagItem): PWindow; syscall IntuitionBase 101; +function OpenWorkBench: IPTR; syscall IntuitionBase 35; +function PointInImage(Point: LongWord; Image: PImage): LongBool; syscall IntuitionBase 104; +procedure PrintIText(Rp: PRastPort; IText: PIntuiText; Left: LongInt; Top: LongInt); syscall IntuitionBase 36; +function PubScreenStatus(Screen: PScreen; StatusFlags: Word): Word; syscall IntuitionBase 92; +function QueryOverscan(DisplayID: LongWord; Rect: PRectangle; OScanType: SmallInt): LongInt; syscall IntuitionBase 79; +procedure RefreshGadgets(Gadgets: PGadget; Window: PWindow; Requester: PRequester); syscall IntuitionBase 37; +procedure RefreshGList(Gadgets: PGadget; Window: PWindow; Requester: PRequester; NumGad: LongInt); syscall IntuitionBase 72; +procedure RefreshWindowFrame(Window: PWindow); syscall IntuitionBase 76; +procedure ReleaseGIRPort(Rp: PRastPort); syscall IntuitionBase 94; +function RemakeDisplay: LongInt; syscall IntuitionBase 64; +procedure RemoveClass(ClassPtr: PIClass); syscall IntuitionBase 118; +function RemoveGadget(Window: PWindow; Gadget: PGadget): Word; syscall IntuitionBase 38; +function RemoveGList(RemPtr: PWindow; Gadget: PGadget; NumGad: LongInt): Word; syscall IntuitionBase 74; +procedure ReportMouse(Flag: LongInt; Window: PWindow); syscall IntuitionBase 39; +function Request(Requester: PRequester; Window: PWindow): LongBool; syscall IntuitionBase 40; +function ResetMenuStrip(Window: PWindow; Menu: PMenu): LongBool; syscall IntuitionBase 117; +function RethinkDisplay: LongInt; syscall IntuitionBase 65; +procedure ScreenDepth(Screen: PScreen; Flags: LongWord; Reserved: APTR); syscall IntuitionBase 131; +procedure ScreenPosition(Screen: PScreen; Flags: LongWord; X1: LongInt; Y1: LongInt; X2: LongInt; Y2: LongInt); syscall IntuitionBase 132; +procedure ScreenToBack(Screen: PScreen); syscall IntuitionBase 41; +procedure ScreenToFront(Screen: PScreen); syscall IntuitionBase 42; +procedure ScrollWindowRaster(Win: PWindow; Dx: SmallInt; Dy: SmallInt; XMin: SmallInt; YMin: SmallInt; XMax: SmallInt; YMax: SmallInt); syscall IntuitionBase 133; +procedure ScrollWindowRasterNoFill(Window: PWindow; Dx, Dy, XMin, YMin, XMax, YMax: Word); syscall IntuitionBase 159; +procedure SendIntuiMessage(Window: PWindow; IMsg: PIntuiMessage); syscall IntuitionBase 151; +function SetAttrsA(Object_: APTR; TagList: PTagItem): IPTR; syscall IntuitionBase 108; +procedure SetDefaultPubScreen(Name: PChar); syscall IntuitionBase 90; +procedure SetDefaultScreenFont(TextFont: PTextFont); syscall IntuitionBase 144; +function SetDMRequest(Window: PWindow; Requester: PRequester): LongBool; syscall IntuitionBase 43; +function SetEditHook(Hook: PHook): PHook; syscall IntuitionBase 82; +function SetGadgetAttrsA(Gadget: PGadget; Window: PWindow; Requester: PRequester; TagList: PTagItem): IPTR; syscall IntuitionBase 110; +function SetIPrefs(Data: Pointer; Length: LongWord; Typ: LongWord): LongWord; syscall IntuitionBase 96; +function SetMenuStrip(Window: PWindow; Menu: PMenu): LongBool; syscall IntuitionBase 44; +function SetMouseQueue(Window: PWindow; QueueLength: LongWord): LongInt; syscall IntuitionBase 83; +procedure SetPointer(Window: PWindow; Pointer_: PWord; Height: LongInt; Width: LongInt; XOffset: LongInt; YOffset: LongInt); syscall IntuitionBase 45; +function SetPointerBounds(Screen: PScreen; Rect: TRectangle; Reserved: LongWord; Tags: PTagItem): LongWord; syscall IntuitionBase 160; +function SetPrefs(PrefBuffer: PPreferences; Size: LongInt; Inform: LongBool): PPreferences; syscall IntuitionBase 54; +function SetPubScreenModes(Modes: Word): Word; syscall IntuitionBase 91; +procedure SetWindowPointerA(Win: PWindow; Taglist: PTagItem); syscall IntuitionBase 136; +procedure SetWindowTitles(Window: PWindow; const WindowTitle: PChar; const ScreenTitle: PChar); syscall IntuitionBase 46; +procedure ShowTitle(Screen: PScreen; ShowIt: LongBool); syscall IntuitionBase 47; +procedure ShowWindow(Window: PWindow); syscall IntuitionBase 140; +procedure SizeWindow(Window: PWindow; Dx: LongInt; Dy: LongInt); syscall IntuitionBase 48; +function StartScreenNotifyTagList(Tags: PTagItem): IPTR; syscall IntuitionBase 161; +function SysReqHandler(Window: PWindow; IDCMPFlagsPtr: PLongWord; WaitInput: LongBool): LongInt; syscall IntuitionBase 100; +function TimedDisplayAlert(AlertNumber: LongWord; String_: PChar; Height: Word; Time: LongWord): LongBool; syscall IntuitionBase 137; +procedure UnlockIBase(LockNumber: LongWord); syscall IntuitionBase 70; +procedure UnlockPubScreen(Name: PChar; Screen: PScreen); syscall IntuitionBase 86; +procedure UnlockPubScreenList; syscall IntuitionBase 88; +function ViewAddress: PView; syscall IntuitionBase 49; +function ViewPortAddress(Window: PWindow): PViewPort; syscall IntuitionBase 50; +function WBenchToBack: LongBool; syscall IntuitionBase 56; +function WBenchToFront: LongBool; syscall IntuitionBase 57; +procedure WindowAction(Window: PWindow; Action: LongWord; Tags: PTagItem); syscall IntuitionBase 157; +function WindowLimits(Window: PWindow; WidthMin: SmallInt; HeightMin: SmallInt; WidthMax: Word; HeightMax: Word): LongBool; syscall IntuitionBase 53; +procedure WindowToBack(Window: PWindow); syscall IntuitionBase 51; +procedure WindowToFront(Window: PWindow); syscall IntuitionBase 52; +procedure ZipWindow(Window: PWindow); syscall IntuitionBase 84; + +// VarArgs Versions +function SetAttrs(Obj: APTR; const Tags: array of const): LongWord; +function NewObject(ClassPtr: PIClass; ClassID: PChar; const Tags: array of const): APTR; +function BuildEasyRequest(Window: PWindow; EasyStruct: PEasyStruct; IDCMP: LongWord; const Args: array of const): PWindow; +function DoGadgetMethod(Gad: PGadget; Win: PWindow; Req: PRequester; const Args: array of const): IPTR; +function EasyRequest(Window: PWindow; EasyStruct: PEasyStruct; IDCMP_Ptr: PLongWord; const Args: array of const): LongInt; +function OpenScreenTags(NewScreen: PNewScreen; const Tags: array of const): PScreen; +function OpenWindowTags(NewWindow: PNewWindow; const Tags: array of const): PWindow; +function SetGadgetAttrs(Gadget: PGadget; Window: PWindow; Requester: PRequester; const Tags: array of const): IPTR; +procedure SetWindowPointer(Win: PWindow; const Tags: array of const); + +// Function wrapper +function SetSuperAttrsA(cl: PIClass; Obj: PObject_; TagList: PTagItem): IPTR; +function SetSuperAttrs(cl: PIClass; Obj: PObject_; Tags: array of const): IPTR; +function DoMethodA(Obj: PObject_; Message: APTR): IPTR; +function DoMethod(Obj: PObject_; MethodID: LongWord; Args: array of const): IPTR; +function CoerceMethodA(cl: PIClass; Obj: PObject_; Message: APTR): IPTR; +function CoerceMethod(cl: PIClass; Obj: PObject_; MethodID: LongWord; const Args: array of const): IPTR; +function DoSuperMethodA(cl: PIClass; Obj: PObject_; Message: APTR): IPTR; +function DoSuperMethod(cl: PIClass; Obj: PObject_; Args: array of const): IPTR; + +function Has_Children(Win: PWindow): Boolean; +function Is_Children(Win: PWindow): Boolean; + +{ Intuition macros } + +function INST_DATA(Cl: PIClass; O: P_Object): Pointer; +function SIZEOF_INSTANCE(Cl: PIClass): LongInt; +function BASEOBJECT(O: P_Object): Pointer; +function _OBJ(O: Pointer): P_Object; +function __OBJECT(O: Pointer): P_Object; +function OCLASS(O: Pointer): PIClass; +function SHIFTITEM(N: SmallInt): Word; +function SHIFTMENU(N: SmallInt): Word; +function SHIFTSUB(N: SmallInt): Word; +function FULLMENUNUM(Menu, Item, Sub: SmallInt): Word; +function IM_BGPEN(Im: PImage): Byte; +function IM_BOX(Im: PImage): PIBox; +function IM_FGPEN(Im: PImage): Byte; +function GADGET_BOX(G: PGadget): PIBox; +function CUSTOM_HOOK(Gadget: PGadget): PHook; +function ITEMNUM(N: Word): Word; +function MENUNUM(N: Word): Word; +function SUBNUM(N: Word): Word; +function IAM_Resolution(x, y: Word): LongWord; // Pack two Words into one LongWord +function SRBNUM(x: Word): Word; +function SWBNUM(x: Word): Word; +function SSBNUM(x: Word): Word; +function SPARNUM(x: Word): Word; +function SHAKNUM(x: Word): Word; + +implementation + +uses + tagsarray, longarray; + +function SetAttrs(Obj: APTR; const Tags: array of const): LongWord; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := SetAttrsA(Obj, GetTagPtr(TagList)); +end; + +function NewObject(ClassPtr: PIClass; ClassID: PChar; const Tags: array of const): APTR; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := NewObjectA(ClassPtr, ClassID, GetTagPtr(TagList)); +end; + +function BuildEasyRequest(Window: PWindow; EasyStruct: PEasyStruct; IDCMP: LongWord; const Args: array of const): PWindow; +var + ArgList: TArgList; +begin + AddArguments(ArgList, Args); + Result := BuildEasyRequestArgs(Window, EasyStruct, IDCMP, GetArgPtr(ArgList)); +end; + +function DoGadgetMethod(Gad: PGadget; Win: PWindow; Req: PRequester; const Args: array of const): IPTR; +var + ArgList: TArgList; +begin + AddArguments(ArgList, Args); + Result := DoGadgetMethodA(Gad, Win, Req, TMsg(ArgList)); +end; + +function EasyRequest(Window: PWindow; EasyStruct: PEasyStruct; IDCMP_Ptr: PLongWord; const Args: array of const): LongInt; +var + ArgList: TArgList; +begin + AddArguments(ArgList, Args); + Result := EasyRequestArgs(Window, EasyStruct, IDCMP_Ptr, @(ArgList[0])); +end; + +function OpenScreenTags(NewScreen: PNewScreen; const Tags: array of const): PScreen; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := OpenScreenTagList(NewScreen, GetTagPtr(TagList)); +end; + +function OpenWindowTags(NewWindow: PNewWindow; const Tags: array of const): PWindow; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := OpenWindowTagList(NewWindow, GetTagPtr(TagList)); +end; + +function SetGadgetAttrs(Gadget: PGadget; Window: PWindow; Requester: PRequester; const Tags: array of const): IPTR; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := SetGadgetAttrsA(Gadget, Window, Requester, GetTagPtr(TagList)); +end; + +procedure SetWindowPointer(Win: PWindow; const Tags: array of const); +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + SetWindowPointerA(Win, GetTagPtr(TagList)); +end; + +// Functions wrapper + +function DoMethodA(Obj: PObject_; Message: APTR): IPTR; +begin + Result := 0; + if Obj = nil then + Exit; + Result := CALLHOOKPKT_(PHook(OCLASS(Obj)), Obj, Message); +end; + +function DoMethod(Obj: PObject_; MethodID: LongWord; Args: array of const): IPTR; +var + ArgList: TArgList; +begin + Result := 0; + if obj = nil then + Exit; + AddArguments(ArgList, [MethodID]); + AddArguments(ArgList, Args); + Result := CALLHOOKPKT_(PHook(OCLASS(Obj)), Obj, @(ArgList[0])); +end; + +function DoSuperMethodA(cl: PIClass; Obj: PObject_; Message: APTR): IPTR; +begin + Result := 0; + if (cl = nil) or (obj = nil) then + Exit; + Result := CALLHOOKPKT_(PHook(cl^.cl_Super), Obj, Message); +end; + +function DoSuperMethod(cl: PIClass; Obj: PObject_; Args: array of const): IPTR; +var + ArgList: TArgList; +begin + Result := 0; + if (cl = nil) or (obj = nil) then + Exit; + AddArguments(ArgList, Args); + Result := CALLHOOKPKT_(PHook(cl^.cl_Super), Obj, @(ArgList[0])); +end; + +function CoerceMethodA(cl: PIClass; Obj: PObject_; Message: APTR): IPTR; +begin + Result := 0; + if (cl = nil) or (obj = nil) then + Exit; + Result := CALLHOOKPKT_(PHook(cl), Obj, Message); +end; + +function CoerceMethod(cl: PIClass; Obj: PObject_; MethodID: LongWord; const Args: array of const): IPTR; +var + ArgList: TArgList; +begin + AddArguments(ArgList,[MethodID]); + AddArguments(ArgList, Args); + Result := CoerceMethodA(cl, Obj, @(ArgList[0])); +end; + + +function SetSuperAttrs(cl: PIClass; Obj: PObject_; Tags: array of const): IPTR; +var + TagList: TTagsList; + ops: TopSet; +begin + AddTags(TagList, Tags); + ops.MethodID := OM_SET; + ops.ops_AttrList := GetTagPtr(TagList); + ops.ops_GInfo := nil; + Result := DoSuperMethodA(cl, obj, @ops); +end; + +function SetSuperAttrsA(cl: PIClass; Obj: PObject_; TagList: PTagItem): IPTR; +var + ops: TopSet; +begin + ops.MethodID := OM_SET; + ops.ops_AttrList := TagList; + ops.ops_GInfo := nil; + Result := DoSuperMethodA(cl, obj, @ops); +end; + + +function INST_DATA(Cl: PIClass; O: P_Object): Pointer; +begin + INST_DATA := Pointer(PtrUInt(O) + Cl^.cl_InstOffset); +end; + +function SIZEOF_INSTANCE(Cl: PIClass): LongInt; +begin + SIZEOF_INSTANCE := Cl^.cl_InstOffset + Cl^.cl_InstSize + SizeOf(T_Object); +end; + +function BASEOBJECT(O: P_Object): Pointer; +begin + BASEOBJECT := Pointer(PtrUInt(O) + SizeOf(T_Object)); +end; + +function _OBJ(O: Pointer): P_Object; +begin + _OBJ := P_Object(O); +end; + +function __OBJECT(O: Pointer): P_Object; +begin + __OBJECT := P_Object(PtrUInt(O) - SizeOf(T_Object)) +end; + +function OCLASS(O: Pointer): PIClass; +var + Obj: P_Object; +begin + Obj := P_Object(PtrUInt(O) - SizeOf(T_Object)); + OCLASS := Obj^.o_Class; +end; + +function SHIFTITEM(N: SmallInt): Word; +begin + SHIFTITEM := (N and $3f) shl 5 +end; + +function SHIFTMENU(N: SmallInt): Word; +begin + SHIFTMENU := N and $1f +end; + +function SHIFTSUB(N: SmallInt): Word; +begin + SHIFTSUB := (N and $1f) shl 11 +end; + +function FULLMENUNUM(Menu, Item, Sub: SmallInt): Word; +begin + FULLMENUNUM := ((Sub and $1f) shl 11) or ((Item and $3f) shl 5) or (Menu and $1f); +end; + +{ The next functons _BGPEN AND _FGPEN aren't a full replacement of the + C macros because the C preprocessor makes it possible to set the + A/BPen values of the Image class objects as well. This can't work + in pascal, of course! +} + +function IM_BGPEN(Im: PImage): Byte; +begin + IM_BGPEN := Im^.PlaneOnOff; +end; + +function IM_BOX(Im: PImage): PIBox; +begin + IM_BOX := PIBox(@Im^.LeftEdge); +END; + +function IM_FGPEN (Im: PImage): Byte; +begin + IM_FGPEN := Im^.PlanePick; +end; + +function GADGET_BOX(G: PGadget): PIBox; +begin + GADGET_BOX := PIBox(@G^.LeftEdge); +end; + +function CUSTOM_HOOK (Gadget: PGadget): PHook; +begin + CUSTOM_HOOK := PHook(Gadget^.MutualExclude); +end; + +function ITEMNUM(N: Word): Word; +begin + ITEMNUM := (N shr 5) and $3F +end; + +function MENUNUM(N: Word): Word; +begin + MENUNUM := N and $1f +end; + +function SUBNUM(N: Word): Word; +begin + SUBNUM := (N shr 11) and $1f +end; + +function IAM_Resolution(x, y: Word): LongWord; +begin + Result := (x shl 16) or y; +end; + +function SRBNUM(x: Word): Word; +begin + SRBNUM := $08 - (x shr 4); +end; + +function SWBNUM(x: Word): Word; +begin + SWBNUM := $08 - (x and $0f); +end; + +function SSBNUM(x: Word): Word; +begin + SSBNUM := $01 + (x shr 4); +end; + +function SPARNUM(x: Word): Word; +begin + SPARNUM := x shr 4; +end; + +function SHAKNUM(x: Word): Word; +begin + SHAKNUM := x and $0f; +end; + +function Has_Children(Win: PWindow): Boolean; +begin + Result := Assigned(Win^.FirstChild); +end; + +function Is_Children(Win: PWindow): Boolean; +begin + Result := Assigned(Win^.Parent2); +end; + +initialization + IntuitionBase := PIntuitionBase(OpenLibrary('intuition.library', 36)); + +finalization + CloseLibrary(PLibrary(IntuitionBase)); + +end. diff --git a/packages/arosunits/src/keymap.pas b/packages/arosunits/src/keymap.pas new file mode 100644 index 0000000000..38256c6d26 --- /dev/null +++ b/packages/arosunits/src/keymap.pas @@ -0,0 +1,111 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + Keymap.resource definitions and console.device key map definitions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + + +unit Keymap; + +INTERFACE + +{$mode objfpc} + +uses exec, inputevent; + +Type + + PKeyMap = ^TKeyMap; + TKeyMap = record + km_LoKeyMapTypes : Pointer; + km_LoKeyMap : Pointer; + km_LoCapsable : Pointer; + km_LoRepeatable : Pointer; + km_HiKeyMapTypes : Pointer; + km_HiKeyMap : Pointer; + km_HiCapsable : Pointer; + km_HiRepeatable : Pointer; + end; + + + pKeymapNode = ^TKeyMapNode; + TKeyMapNode = record + kn_Node : TNode; { including name of Keymap } + kn_KeyMap : TKeyMap; + end; + +{ the structure of Keymap.resource } + + pKeyMapResource = ^TKeyMapResource; + TKeyMapResource = record + kr_Node : TNode; + kr_List : tList; { a list of KeyMapNodes } + end; + + +Const + +{ Key Map Types } + + KC_NOQUAL = 0; + KC_VANILLA = 7; { note that SHIFT+ALT+CTRL is VANILLA } + KCB_SHIFT = 0; + KCF_SHIFT = $01; + KCB_ALT = 1; + KCF_ALT = $02; + KCB_CONTROL = 2; + KCF_CONTROL = $04; + KCB_DOWNUP = 3; + KCF_DOWNUP = $08; + + KCB_DEAD = 5; { may be dead or modified by dead key: } + KCF_DEAD = $20; { use dead prefix bytes } + + KCB_STRING = 6; + KCF_STRING = $40; + + KCB_NOP = 7; + KCF_NOP = $80; + + +{ Dead Prefix Bytes } + + DPB_MOD = 0; + DPF_MOD = $01; + DPB_DEAD = 3; + DPF_DEAD = $08; + + DP_2DINDEXMASK = $0f; { mask for index for 1st of two dead keys } + DP_2DFACSHIFT = 4; { shift for factor for 1st of two dead keys } + +var KeyMapBase : pLibrary; + +const + KEYMAPNAME : PChar = 'keymap.library'; + +function AskKeyMapDefault : PKeyMap; syscall KeyMapBase 6; +function MapANSI(TheString : PChar; Count : LongInt; Buffer : PChar; Length : LongInt; KeyMap : PKeyMap) : LongInt; syscall KeyMapBase 8; +function MapRawKey(Event : PInputEvent; Buffer : PChar; Length : LongInt; KeyMap : PKeyMap) : SmallInt; syscall KeyMapBase 7; +procedure SetKeyMapDefault(KeyMap : PKeyMap); syscall KeyMapBase 5; + +implementation + +initialization + KeyMapBase := OpenLibrary(KEYMAPNAME, 0); + +finalization + CloseLibrary(KeyMapBase); + +end. (* UNIT KEYMAP *) + + + diff --git a/packages/arosunits/src/layers.pas b/packages/arosunits/src/layers.pas new file mode 100644 index 0000000000..585d520fed --- /dev/null +++ b/packages/arosunits/src/layers.pas @@ -0,0 +1,115 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + layers.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit layers; + +interface +uses + exec, agraphics, utility; + +const + + LAYERSIMPLE = 1; + LAYERSMART = 2; + LAYERSUPER = 4; + LAYERUPDATING = $10; + LAYERBACKDROP = $40; + LAYERREFRESH = $80; + LAYER_CLIPRECTS_LOST = $100; { during BeginUpdate } + { or during layerop } + { this happens if out of memory } + LMN_REGION = -1; + +type + PLayer_Info = ^TLayer_Info; + TLayer_Info = record + top_layer : PLayer; + check_lp : PLayer; { !! Private !! } + obs : PClipRect; + FreeClipRects : PClipRect; { !! Private !! } + PrivateReserve1, { !! Private !! } + PrivateReserve2 : LongInt; { !! Private !! } + Lock : TSignalSemaphore; { !! Private !! } + gs_Head : TMinList; { !! Private !! } + PrivateReserve3 : SmallInt; { !! Private !! } + PrivateReserve4 : Pointer; { !! Private !! } + Flags : WORD; + fatten_count : Shortint; { !! Private !! } + LockLayersCount : Shortint; { !! Private !! } + PrivateReserve5 : SmallInt; { !! Private !! } + BlankHook, { !! Private !! } + LayerInfo_extra : Pointer; { !! Private !! } + end; + +const + NEWLAYERINFO_CALLED = 1; + +{ + * LAYERS_NOBACKFILL is the value needed to get no backfill hook + * LAYERS_BACKFILL is the value needed to get the default backfill hook + } + LAYERS_NOBACKFILL = 1; + LAYERS_BACKFILL = 0; + + LAYERSNAME : PChar = 'layers.library'; + +var + LayersBase : PLibrary; + +function BeginUpdate(Layer: PLayer): LongInt; syscall LayersBase 13; +function BehindLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 9; +function CreateBehindHookLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; Hook: PHook; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 32; +function CreateBehindLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 7; +function CreateUpfrontHookLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; Hook: PHook; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 31; +function CreateUpfrontLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 6; +function DeleteLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 15; +procedure DisposeLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 25; +procedure DoHookClipRects(Hook: PHook; RPort: PRastPort;const Rect: PRectangle); syscall LayersBase 36; +procedure EndUpdate(Layer: PLayer; Flag: LongWord); syscall LayersBase 14; +function FattenLayerInfo(LayerInfo: PLayer_Info): LongInt; syscall LayersBase 26; +procedure InitLayers(LayerInfo: PLayer_Info); syscall LayersBase 5; +function InstallClipRegion(Layer: PLayer; const Region: PRegion): PRegion; syscall LayersBase 29; +function InstallLayerHook(Layer: PLayer; Hook: PHook): PHook; syscall LayersBase 33; +function InstallLayerInfoHook(LayerInfo: PLayer_Info; const Hook: PHook): PHook; syscall LayersBase 34; +procedure LockLayer(dummy: LongInt; Layer: PLayer); syscall LayersBase 16; +procedure LockLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 20; +procedure LockLayers(LayerInfo: PLayer_Info); syscall LayersBase 18; +function MoveLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt): LongInt; syscall LayersBase 10; +function MoveLayerInFrontOf(layer_to_move: PLayer; other_layer: PLayer): LongInt; syscall LayersBase 28; +function MoveSizeLayer(Layer: PLayer; dx: LongInt; dy: LongInt; dw: LongInt; dh: LongInt): LongInt; syscall LayersBase 30; +function NewLayerInfo: PLayer_Info; syscall LayersBase 24; +procedure ScrollLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt); syscall LayersBase 12; +function SizeLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt): LongInt; syscall LayersBase 11; +procedure SortLayerCR(Layer: PLayer; dx: LongInt; dy: LongInt); syscall LayersBase 35; +procedure SwapBitsRastPortClipRect(rp: PRastPort; cr: PClipRect); syscall LayersBase 21; +procedure ThinLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 27; +procedure UnlockLayer(Layer: PLayer); syscall LayersBase 17; +procedure UnlockLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 23; +procedure UnlockLayers(LayerInfo: PLayer_Info); syscall LayersBase 19; +function UpfrontLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 8; +function WhichLayer(LayerInfo: PLayer_Info; x: LongInt; y: LongInt): PLayer; syscall LayersBase 22; + +implementation + +initialization + LayersBase := OpenLibrary(LAYERSNAME, 36); + +finalization + CloseLibrary(LayersBase); + +eND. (* UNIT LAYERS *) + + + diff --git a/packages/arosunits/src/longarray.pas b/packages/arosunits/src/longarray.pas new file mode 100644 index 0000000000..f070507dee --- /dev/null +++ b/packages/arosunits/src/longarray.pas @@ -0,0 +1,111 @@ +{ + This file is part of the Free Pascal run time library. + + A file in Amiga system run time library. + Copyright (c) 1998-2002 by Nils Sjoholm + member of the Amiga RTL development team. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{ + History: + + A simple unit that helps to build array of longint. + Uses array of const so don't forget to use + $mode objfpc. + + 05 Nov 2002. + + nils.sjoholm@mailbox.swipnet.se +} + +unit longarray; +{$mode objfpc}{$H+} + +interface +uses + Exec; + +type + PArgList = ^TArgList; + TArgList = array of IPTR; + +function readinlongs(const Args: array of const): Pointer; +procedure AddArguments(var ArgList: TArgList; const Args: array of const); +function GetArgPtr(var ArgList: TArgList): Pointer; + +implementation + +type + TMyArgs = array of IPTR; + PMyArgs = ^TMyArgs; + +var + ArgArray : PMyArgs; + +procedure AddArguments(var ArgList: TArgList; const Args: array of const); +var + i: Integer; + Offset: Integer; +begin + Offset := Length(ArgList); + SetLength(ArgList, Length(ArgList) + Length(Args)); + for i := 0 to High(Args) do + begin + case Args[i].vtype of + vtinteger: ArgList[Offset + i] := IPTR(Args[i].vinteger); + vtpchar: ArgList[Offset + i] := IPTR(Args[i].vpchar); + vtchar: ArgList[Offset + i] := IPTR(Args[i].vchar); + vtpointer: ArgList[Offset + i] := IPTR(Args[i].vpointer); + vtstring: ArgList[Offset + i] := IPTR(PChar(string(Args[i].vstring^))); + vtboolean: ArgList[Offset + i] := IPTR(Byte(Args[i].vboolean)); + end; + end; +end; + +function GetArgPtr(var ArgList: TArgList): Pointer; +var + Idx: Integer; +begin + Idx := Length(ArgList); + SetLength(ArgList, Idx + 1); + ArgList[Idx] := 0; + Result := @(ArgList[0]); +end; + + +function ReadInLongs(const Args: array of const): Pointer; +var + i: Integer; +begin + for i := 0 to High(Args) do begin + case args[i].vtype of + vtinteger: ArgArray^[i] := IPTR(Args[i].vinteger); + vtpchar: ArgArray^[i] := IPTR(Args[i].vpchar); + vtchar: ArgArray^[i] := IPTR(Args[i].vchar); + vtpointer: ArgArray^[i] := IPTR(Args[i].vpointer); + vtstring: ArgArray^[i] := IPTR(PChar(string(Args[i].vstring^))); + vtboolean: ArgArray^[i] := IPTR(byte(Args[i].vboolean)); + end; + end; + readinlongs := @(argarray^[0]); +end; + + + + +initialization + New(argarray); + SetLength(argarray^, 200); +finalization + SetLength(argarray^, 0); + Dispose(argarray); +end. + diff --git a/packages/arosunits/src/tagsarray.pas b/packages/arosunits/src/tagsarray.pas new file mode 100644 index 0000000000..175d55883a --- /dev/null +++ b/packages/arosunits/src/tagsarray.pas @@ -0,0 +1,111 @@ +{ + This file is part of the Free Pascal run time library. + + A file in Amiga system run time library. + Copyright (c) 2002 by Nils Sjoholm + member of the Amiga RTL development team. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit tagsarray; +{$mode objfpc}{$H+} + +interface + +uses + Exec, Utility; + +type + TTagsList = array of ttagitem; + PMyTags = ^TTagsList; + + +function ReadInTags(const Args: array of const): PTagItem; +procedure AddTags(var Taglist: TTagsList; const Args: array of const); +function GetTagPtr(var TagList: TTagsList): PTagItem; + +implementation + +var + MyTags: PMyTags; + +procedure AddTags(var Taglist: TTagsList; const Args: array of const); +var + i: IPTR; + ii: IPTR; +begin + ii := Length(TagList); + SetLength(TagList, Length(TagList) + (Length(args) DIV 2)); + for i := 0 to High(args) do + begin + if (not Odd(i)) then + begin + TagList[ii].ti_tag := IPTR(Args[i].vinteger); + end else + begin + case Args[i].vtype of + vtinteger : TagList[ii].ti_data := IPTR(Args[i].vinteger); + vtboolean : TagList[ii].ti_data := IPTR(byte(Args[i].vboolean)); + vtpchar : TagList[ii].ti_data := IPTR(Args[i].vpchar); + vtchar : TagList[ii].ti_data := IPTR(Args[i].vchar); + vtstring : TagList[ii].ti_data := IPTR(PChar(string(Args[i].vstring^))); + vtpointer : TagList[ii].ti_data := IPTR(Args[i].vpointer); + end; + inc(ii); + end; + end; +end; + +function GetTagPtr(var TagList: TTagsList): pTagItem; +begin + AddTags(TagList, [TAG_END, TAG_END]); + GetTagPtr := @(TagList[0]); +end; + +function ReadInTags(const Args: array of const): PTagItem; +var + i: IPTR; + ii: IPTR; +begin + ii := 0; + SetLength(MyTags^, (Length(Args) div 2) + 4); // some more at the end + for i := 0 to High(Args) do + begin + if not Odd(i) then + begin + mytags^[ii].ti_tag := IPTR(Args[i].vinteger); + end else + begin + case Args[i].vtype of + vtinteger: mytags^[ii].ti_data := IPTR(Args[i].vinteger); + vtboolean: mytags^[ii].ti_data := IPTR(Byte(Args[i].vboolean)); + vtpchar: mytags^[ii].ti_data := IPTR(Args[i].vpchar); + vtchar: mytags^[ii].ti_data := IPTR(Args[i].vchar); + vtstring: mytags^[ii].ti_data := IPTR(PChar(string(Args[i].vstring^))); + vtpointer: mytags^[ii].ti_data := IPTR(Args[i].vpointer); + end; + Inc(ii); + end; + end; + Inc(ii); + // Add additional TAG_DONE (if user forget) + mytags^[ii].ti_tag := TAG_DONE; + mytags^[ii].ti_data := 0; + // return the pointer + ReadInTags := @(MyTags^[0]); +end; + +initialization + New(MyTags); + SetLength(MyTags^, 200); +finalization + SetLength(MyTags^, 0); + Dispose(MyTags); +end. diff --git a/packages/arosunits/src/timer.pas b/packages/arosunits/src/timer.pas new file mode 100644 index 0000000000..e0908d443d --- /dev/null +++ b/packages/arosunits/src/timer.pas @@ -0,0 +1,94 @@ +{ + This file is part of the Free Pascal run time library. + + A file in Amiga system run time library. + Copyright (c) 1998-2003 by Nils Sjoholm + member of the Amiga RTL development team. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{ + History: + Removed the var for all functions. + 06 Sep 2000. + + Added the define use_amiga_smartlink. + 13 Jan 2003. + + nils.sjoholm@mailbox.swipnet.se + +} + +unit timer; + +interface + +uses + exec; + +const + +{ unit defintions } + UNIT_MICROHZ = 0; + UNIT_VBLANK = 1; + UNIT_ECLOCK = 2; + UNIT_WAITUNTIL = 3; + UNIT_WAITECLOCK = 4; + + TIMERNAME: PChar = 'timer.device'; + +type + PTimeval = ^TTimeval; + TTimeval = record + tv_secs: LongWord; + tv_micro: LongWord; + end; + + PTimerequest = ^TTimerequest; + TTimerequest = record + tr_node: TIORequest; + tr_time: TTimeval; + end; + + PEClockVal = ^TEClockVal; + TEClockVal = record + ev_hi : LongWord; + ev_lo : LongWord; + end; + + +const + +{ IO_COMMAND to use for adding a timer } + TR_ADDREQUEST = CMD_NONSTD; + TR_GETSYSTIME = CMD_NONSTD + 1; + TR_SETSYSTIME = CMD_NONSTD + 2; + +{ To use any of the routines below, TimerBase must be set to point + to the timer.device, either by calling CreateTimer or by pulling + the device pointer from a valid TimeRequest, i.e. + + TimerBase := TimeRequest.io_Device; + + _after_ you have called OpenDevice on the timer. + } + +var + TimerBase: Pointer; + +procedure AddTime(Dest, Source: PTimeVal); syscall TimerBase 7; +function CmpTime(Dest, Source: PTimeVal): LongWord; syscall TimerBase 9; +procedure SubTime(Dest, Source: PTimeVal); syscall TimerBase 8; +function ReadEClock(Dest: PEClockVal): LongInt; syscall TimerBase 10; +procedure GetSysTime(Dest: PTimeVal); syscall TimerBase 11; + +implementation + +end. diff --git a/packages/arosunits/src/utility.pas b/packages/arosunits/src/utility.pas new file mode 100644 index 0000000000..d81016f49b --- /dev/null +++ b/packages/arosunits/src/utility.pas @@ -0,0 +1,295 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + utility.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} +unit utility; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + Exec; + +type + PClockData = ^TClockData; + TClockData = record + Sec: Word; + Min: Word; + Hour: Word; + MDay: Word; + Month: Word; + Year: Word; + WDay: Word; + end; + +// Use CALLHOOKPKT to call a hook + PHook = ^THook; + THookFunctionProc = function(Hook: PHook; Object_: APTR; Message: APTR): IPTR; cdecl; + + THook = record + h_MinNode: TMinNode; + h_Entry: IPTR; // Main Entry point THookFunctionProc + h_SubEntry: IPTR; // Secondary entry point + h_Data: Pointer; // owner specific + end; + +// The named object structure + PNamedObject = ^TNamedObject; + TNamedObject = record + no_Object: APTR; // Your pointer, for whatever you want + END; + +const +// Tags for AllocNamedObject() + ANO_NameSpace = 4000; // Tag to define namespace + ANO_UserSpace = 4001; // tag to define userspace + ANO_Priority = 4002; // tag to define priority + ANO_Flags = 4003; // tag to define flags (NSF_*) + +// Flags for tag ANO_Flags + NSB_NODUPS = 0; + NSF_NODUPS = 1 shl 0; // Default allow duplicates + NSB_CASE = 1; + NSF_CASE = 1 shl 1; // Default to caseless... + +// Control attributes for Pack/UnpackStructureTags() +{ PackTable definition: + + The PackTable is a simple array of LONGWORDS that are evaluated by + PackStructureTags() and UnpackStructureTags(). + + The table contains compressed information such as the tag offset from + the base tag. The tag offset has a limited range so the base tag is + defined in the first longword. + + After the first longword, the fields look as follows: + + +--------- 1 = signed, 0 = unsigned (for bits, 1=inverted boolean) + | + | +------ 00 = Pack/Unpack, 10 = Pack, 01 = Unpack, 11 = special + | / \ + | | | +-- 00 = Byte, 01 = Integer, 10 = Long, 11 = Bit + | | | / \ + | | | | | /----- For bit operations: 1 = TAG_EXISTS is TRUE + | | | | | | + | | | | | | /-------------------- Tag offset from base tag value + | | | | | | | \ + m n n o o p q q q q q q q q q q r r r s s s s s s s s s s s s s + \ | | | + Bit offset (for bit operations) ----/ | | + \ | + Offset into data structure -----------------------------------/ + + A -1 longword signifies that the next longword will be a new base tag + + A 0 longword signifies that it is the end of the pack table. + + What this implies is that there are only 13-bits of address offset + and 10 bits for tag offsets from the base tag. For most uses this + should be enough, but when this is not, either multiple pack tables + or a pack table with extra base tags would be able to do the trick. + The goal here was to make the tables small and yet flexible enough to + handle most cases.} +const + PSTB_EXISTS = 26; // Tag exists bit true flag hack... + PSTF_EXISTS = 1 shl 26; + PSTB_PACK = 29; // Note that these are active low... + PSTF_PACK = 1 shl 29; + PSTB_UNPACK = 30; // Note that these are active low... + PSTF_UNPACK = 1 shl 30; + PSTB_SIGNED = 31; + PSTF_SIGNED = 1 shl 31; + + PKCTRL_UBYTE = $00000000; + PKCTRL_BYTE = $80000000; + PKCTRL_UWORD = $08000000; + PKCTRL_WORD = $88000000; + PKCTRL_LongWord = $10000000; + PKCTRL_LONG = $90000000; + PKCTRL_PACKUNPACK = $00000000; + PKCTRL_UNPACKONLY = $20000000; + PKCTRL_PACKONLY = $40000000; + PKCTRL_BIT = $18000000; + PKCTRL_FLIPBIT = $98000000; + +{ Some handy dandy macros to easily create pack tables + * + * Use PACK_STARTTABLE() at the start of a pack table. You pass it the + * base tag value that will be handled in the following chunk of the pack + * table. + * + * PACK_ENDTABLE() is used to mark the end of a pack table. + * + * PACK_NEWOFFSET() lets you change the base tag value used for subsequent + * entries in the table + * + * PACK_ENTRY() lets you define an entry in the pack table. You pass it the + * base tag value, the tag of interest, the type of the structure to use, + * the field name in the structure to affect and control bits (combinations of + * the various PKCTRL_XXX bits) + * + * PACK_BYTEBIT() lets you define a bit-control entry in the pack table. You + * pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag + * affects. This macro should be used when the field being affected is byte + * sized. + * + * PACK_WORDBIT() lets you define a bit-control entry in the pack table. You + * pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag + * affects. This macro should be used when the field being affected is Integer + * sized. + * + * PACK_LONGBIT() lets you define a bit-control entry in the pack table. You + * pass it the same data as PACK_ENTRY, plus the flag bit pattern this tag + * affects. This macro should be used when the field being affected is longword + * sized. + * + * EXAMPLE: + * + * LongWord packTable[] = + * ( + * PACK_STARTTABLE(GA_Dummy), + * PACK_ENTRY(GA_Dummy,GA_Left,Gadget,LeftEdge,PKCTRL_WORD|PKCTRL_PACKUNPACK), + * PACK_ENTRY(GA_Dummy,GA_Top,Gadget,TopEdge,PKCTRL_WORD|PKCTRL_PACKUNPACK), + * PACK_ENTRY(GA_Dummy,GA_Width,Gadget,Width,PKCTRL_UWORD|PKCTRL_PACKUNPACK), + * PACK_ENTRY(GA_Dummy,GA_Height,Gadget,Height,PKCTRL_UWORD|PKCTRL_PACKUNPACK), + * PACK_WORDBIT(GA_Dummy,GA_RelVerify,Gadget,Activation,PKCTRL_BIT|PKCTRL_PACKUNPACK,GACT_RELVERIFY) + * PACK_ENDTABLE + * ); + } + +// TagItem, Tag, TAG_USER moved to Exec needed there already for dome definitions + + +const +// system tag values Tag.ti_Tag + TAG_DONE = 0; // terminates array of TagItems. ti_Data unused + TAG_END = TAG_DONE; + TAG_IGNORE = 1; // ignore this item, not END of array + TAG_MORE = 2; // ti_Data is pointer to another array of TagItems note that this tag terminates the current array + TAG_SKIP = 3; // skip this AND the next ti_Data items +// What separates user tags from system tags + // TAG_USER = 1 shl 31; // see exec + TAG_OS = 16; // The first tag used by the OS +// Tag-Offsets for the OS + DOS_TAGBASE = TAG_OS; // Reserve 16k tags for DOS + INTUITION_TAGBASE = TAG_OS or $2000; // Reserve 16k tags for Intuition + +{ If the TAG_USER bit is set in a tag number, it tells utility.library that + the tag is not a control tag (like TAG_DONE, TAG_IGNORE, TAG_MORE) and is + instead an application tag. "USER" means a client of utility.library in + general, including system code like Intuition or ASL, it has nothing to do + with user code.} +// Tag filter logic specifiers for use with FilterTagItems() + TAGFILTER_AND = 0; // exclude everything but filter hits + TAGFILTER_NOT = 1; // exclude only filter hits + +// Mapping types for use with MapTags() + MAP_REMOVE_NOT_FOUND = 0; // remove tags that aren't in mapList + MAP_KEEP_NOT_FOUND = 1; // keep tags that aren't in mapList + + UTILITYNAME = 'utility.library'; + +type + PUtilityBase = ^TUtilityBase; + TUtilityBase = record + ub_LibNode: TLibrary; + ub_Language: Byte; + ub_Reserved: Byte; + end; + +function AddNamedObject(NameSpace, Object_: PNamedObject): LongBool; syscall AOS_UtilityBase 37; +function AllocateTagItems(Num: LongWord): PTagItem; syscall AOS_UtilityBase 11; +function AllocNamedObjectA(const Name: STRPTR; TagList: PTagItem): PNamedObject; syscall AOS_UtilityBase 38; +procedure Amiga2Date(Seconds: LongWord; Resultat: PClockData); syscall AOS_UtilityBase 20; +procedure ApplyTagChanges(List: PTagItem; ChangeList: PTagItem); syscall AOS_UtilityBase 31; +function AttemptRemNamedObject(Object_: PNamedObject): LongInt; syscall AOS_UtilityBase 39; +function CallHookPkt(Hook: PHook; Object_, ParamPaket: APTR): IPTR; syscall AOS_UtilityBase 17; +function CheckDate(Date: PClockData): LongWord; syscall AOS_UtilityBase 22; +function CloneTagItems(const TagList: PTagItem): PTagItem; syscall AOS_UtilityBase 12; +function Date2Amiga(Date: PClockData): LongWord; syscall AOS_UtilityBase 21; +procedure FilterTagChanges(ChangeList: PTagItem; const Oldvalues: PTagItem; Apply: LongBool); syscall AOS_UtilityBase 9; +function FilterTagItems(TagList: PTagItem; FilterArray: PTag; Logic: LongWord): LongWord; syscall AOS_UtilityBase 16; +function FindNamedObject(NameSpace: PNamedObject; const Name: STRPTR; LastObject: PNamedObject): PNamedObject; syscall AOS_UtilityBase 40; +function FindTagItem(TagValue: Tag; const TagList: PTagItem): PTagItem; syscall AOS_UtilityBase 5; +procedure FreeNamedObject(Object_: PNamedObject); syscall AOS_UtilityBase 41; +procedure FreeTagItems(TagList: PTagItem); syscall AOS_UtilityBase 13; +function GetTagData(TagValue: Tag; Default: IPTR; const TagList: PTagItem): IPTR; syscall AOS_UtilityBase 6; +function GetUniqueID: LongWord; syscall AOS_UtilityBase 45; +procedure MapTags(TagList: PTagItem; const MapList: PTagItem; MapType: LongWord); syscall AOS_UtilityBase 10; +function NamedObjectName(Object_: PNamedObject): STRPTR; syscall AOS_UtilityBase 42; +function NextTagItem(var Item: PTagItem): PTagItem; syscall AOS_UtilityBase 8; +function PackBoolTags(InitialFlags: LongWord; const TagList, BoolMap: PTagItem): IPTR; syscall AOS_UtilityBase 7; +function PackStructureTags(Pack: APTR; PackTable: PLongWord; TagList: PTagItem): LongWord; syscall AOS_UtilityBase 35; +procedure RefreshTagItemClones(Clone: PTagItem; const Original: PTagItem); syscall AOS_UtilityBase 14; +procedure ReleaseNamedObject(Object_: PNamedObject); syscall AOS_UtilityBase 43; +procedure RemNamedObject(Object_: PNamedObject; Message: PMessage); syscall AOS_UtilityBase 44; +function SDivMod32(Dividend, Divisor: LongInt): Int64; syscall AOS_UtilityBase 25; +function SMult32(Arg1, Arg2: LongInt): LongInt; syscall AOS_UtilityBase 23; +function SMult64(Arg1, Arg2: LongInt): Int64; syscall AOS_UtilityBase 33; +function Stricmp(const Str1: STRPTR; const Str2: STRPTR): LongInt; syscall AOS_UtilityBase 27; +function Strnicmp(const Str1: STRPTR; const Str2 : STRPTR; Length_: LongInt): LongInt; syscall AOS_UtilityBase 28; +function TagInArray(TagValue: Tag; TagArray: PTag): LongBool; syscall AOS_UtilityBase 15; +function ToLower(c: LongWord): Char; syscall AOS_UtilityBase 30; +function ToUpper(c: LongWord): Char; syscall AOS_UtilityBase 29; +function UDivMod32(Dividend, Divisor: LongWord): LongWord; syscall AOS_UtilityBase 26; +function UMult32(Arg1, Arg2: LongWord): LongWord; syscall AOS_UtilityBase 24; +function UMult64(Arg1, Arg2: LongWord): QWord; syscall AOS_UtilityBase 34; +function UnpackStructureTags(Pack: APTR; PackTable: PLongWord; TagList: PTagItem): LongWord; syscall AOS_UtilityBase 36; + +// Macros +function CALLHOOKPKT_(Hook: PHook; Object_: APTR; Message: APTR): IPTR; inline; +function TAGLIST(var Args: array of const): PTagItem; // NOT threadsafe! Better use AddTags/GetTagPtr + +// VarArgs Versions +function AllocNamedObject(const Name: STRPTR; const Tags: array of const): PNamedObject; +function CallHook(Hook: PHook; Object_: APTR; const Params: array of const): IPTR; + +implementation + +uses + tagsarray,longarray; + +function AllocNamedObject(const Name: STRPTR; const Tags: array of const): PNamedObject; +var + TagList: TTagsList; +begin + AddTags(TagList, Tags); + Result := AllocNamedObjectA(Name, GetTagPtr(TagList)); +end; + +function TAGLIST(var Args: array of const): PTagItem; +begin + Result := ReadInTags(Args); +end; + +function CallHook(Hook: PHook; Object_: APTR; const Params: array of const): IPTR; +begin + CallHook := CallHookPkt(Hook, Object_ , ReadInLongs(Params)); +end; + +function CALLHOOKPKT_(Hook: PHook; Object_: APTR; Message: APTR): IPTR; +var + FuncPtr: THookFunctionProc; +begin + Result := 0; + if (Hook = nil) or (Object_ = nil) or (Message = nil) then + Exit; + if (Hook^.h_Entry = 0) then + Exit; + FuncPtr := THookFunctionProc(Hook^.h_Entry); + Result := FuncPtr(Hook, Object_, Message); +end; + +end. diff --git a/packages/arosunits/src/workbench.pas b/packages/arosunits/src/workbench.pas new file mode 100644 index 0000000000..f4ff16beca --- /dev/null +++ b/packages/arosunits/src/workbench.pas @@ -0,0 +1,659 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2014 by Free Pascal development team + + workbnech.library functions + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} +unit Workbench; + +{$MODE OBJFPC} {$H+} +{$PACKRECORDS C} + + +Interface + +Uses + exec, AmigaDos, Utility, Intuition, AGraphics; + + // NOTE: + // - unit based on AROS ABIv0 sources d.d. 16-oct-2013 + // - workbench/icon.h is not present in this unit. Instead it is present in + // unit icon. + // - It is uncertain if v45 additions are aros specific. + // - No full ABIv1 diff was done yet (only one item was done for future + // reference. Ergo, this unit is not ABIv1 compatible yet. + +// ###### workbench/startup.h ############################################### + + +type + PWBArg = ^TWBArg; + TWBArg = record + wa_Lock: BPTR; // A lock descriptor. + wa_Name: PChar; // A string relative to that lock. + end; + +// ###### <freepascal> ###################################################### + + PWBArgList = ^TWBArgList; + TWBArgList = array[1..100] of TWBArg; // Only 1..smNumArgs are valid + +// ###### </freepascal> ##################################################### + + PWBStartup = ^TWBStartup; + TWBStartup = record + sm_Message: TMessage; // A standard message structure. + sm_Process: PMsgPort; // The process descriptor for you. + sm_Segment: BPTR; // A descriptor for your code. + sm_NumArgs: LongInt; // The number of elements in ArgList. + sm_ToolWindow: PChar; // Description of window. + sm_ArgList: PWBArgList; // The arguments themselves + end; + +// ###### workbench/workbench.h ############################################# + +const + WORKBENCHNAME: PChar = 'workbench.library'; // Workbench library name. + +type + POldDrawerData = ^TOldDrawerData; + TOldDrawerData = record + dd_NewWindow: TNewWindow; // Args to open window. + dd_CurrentX: LongInt; // Current x coordinate of origin. + dd_CurrentY: LongInt; // Current y coordinate of origin. + end; + +const + OLDDRAWERDATAFILESIZE = SizeOf(TOldDrawerData); // Amount of DrawerData actually written to disk. + +type + PDrawerData = ^TDrawerData; + TDrawerData = record + dd_NewWindow: TNewWindow; // Args to open window. + dd_CurrentX: LongInt; // Current x coordinate of origin. + dd_CurrentY: LongInt; // Current y coordinate of origin. + dd_Flags: LongWord; // Flags for drawer. + dd_ViewModes: Word; // View mode for drawer. + end; + +const + DRAWERDATAFILESIZE = SizeOf(TDrawerData); // Amount of DrawerData actually written to disk. + + // Definitions for dd_ViewModes + DDVM_BYDEFAULT = 0; // Default (inherit parent's view mode). + DDVM_BYICON = 1; // View as icons. + DDVM_BYNAME = 2; // View as text, sorted by name. + DDVM_BYDATE = 3; // View as text, sorted by date. + DDVM_BYSIZE = 4; // View as text, sorted by size. + DDVM_BYTYPE = 5; // View as text, sorted by type. + + // Definitions for dd_Flags + DDFLAGS_SHOWDEFAULT = 0; // Fefault (show only icons). + DDFLAGS_SHOWICONS = 1; // Show only icons. + DDFLAGS_SHOWALL = 2; // Show all files. + +type + PDiskObject = ^TDiskObject; + TDiskObject = record + do_Magic: Word; // A magic number at the start of the file. + do_Version: Word; // A version number, so we can change it. + do_Gadget: TGadget; // A copy of in core gadget. + do_type: Word; + do_DefaultTool: STRPTR; + do_Tooltypes: PPChar; + do_CurrentX: LongInt; + do_CurrentY: LongInt; + do_DrawerData: PDrawerData; + do_ToolWindow: STRPTR; // Only applies to tools. + do_StackSize: LongInt; // Only applies to tools. + end; + +const + WBDISK = 1; + WBDRAWER = 2; + WBTOOL = 3; + WBPROJECT = 4; + WBGARBAGE = 5; + WBDEVICE = 6; + WBKICK = 7; + WBAPPICON = 8; + + WB_DISKVERSION = 1; // Current version number. + WB_DISKREVISION = 1; // Current revision number. + WB_DISKREVISIONMASK = $FF; // Only use the lower 8 bits of Gadget.UserData for the revision #. + + WB_DISKMAGIC = $E310; // A magic number, not easily impersonated. + +type + PFreeList = ^TFreeList; + TFreeList = record + fl_NumFree: SmallInt; + fl_MemList: TList; + end; + +const + // + // workbench does different complement modes for its gadgets. + // It supports separate images, complement mode, and backfill mode. + // The first two are identical to intuitions GADGIMAGE and GADGHCOMP. + // backfill is similar to GADGHCOMP, but the region outside of the + // image (which normally would be color three when complemented) + // is flood-filled to color zero. + // + GFLG_GADGBACKFILL = $0001; + // GADGBACKFILL = $0001; // an old synonym + NO_ICON_POSITION = $80000000; // If an icon does not really live anywhere, set its current position to here. + +type + PAppMessage = ^TAppMessage; + TAppMessage = record + am_Message: TMessage; // Standard message structure. + am_type: Word; // Message type. + am_UserData: IPTR; // Application specific. + {$IFDEF AROS_ABIv1} + am_ID: IPTR; // Application definable ID. + {$ELSE} + am_ID: LongWord; // Application definable ID. + {$ENDIF} + am_NumArgs: LongInt; // # of elements in arglist. + am_ArgList: PWBArgList; // The arguements themselves. + am_Version: Word; // Will be AM_VERSION. + am_Class: Word; // Message class. + am_MouseX: SmallInt; // Mouse x position of event. + am_MouseY: SmallInt; // Mouse y position of event. + am_Seconds: LongWord; // Current system clock time. + am_Micros: LongWord; // Current system clock time. + am_Reserved: array[0..7] of LongWord; // Avoid recompilation. + end; + +const + // + // If you find am_Version >= AM_VERSION, you know this structure has + // at least the fields defined in this version of the include file + // + AM_VERSION = 1; // Definition for am_Version. + + // Definitions for member am_type of structure TAppMessage. + AMTYPE_APPWINDOW = 7; // App window message. + AMTYPE_APPICON = 8; // App icon message. + AMTYPE_APPMENUITEM = 9; // App menu item message. + AMTYPE_APPWINDOWZONE = 10; // App window drop zone message. + + // Definitions for member am_Class of structure TAppMessage for AppIcon messages (V44) + AMCLASSICON_Open = 0; // The "Open" menu item was invoked, the icon got double-clicked or an icon got dropped on it. + AMCLASSICON_Copy = 1; // The "Copy" menu item was invoked. + AMCLASSICON_Rename = 2; // The "Rename" menu item was invoked. + AMCLASSICON_Information = 3; // The "Information" menu item was invoked. + AMCLASSICON_Snapshot = 4; // The "Snapshot" menu item was invoked. + AMCLASSICON_UnSnapshot = 5; // The "UnSnapshot" menu item was invoked. + AMCLASSICON_LeaveOut = 6; // The "Leave Out" menu item was invoked. + AMCLASSICON_PutAway = 7; // The "Put Away" menu item was invoked. + AMCLASSICON_Delete = 8; // The "Delete" menu item was invoked. + AMCLASSICON_FormatDisk = 9; // The "Format Disk" menu item was invoked. + AMCLASSICON_EmptyTrash = 10; // The "Empty Trash" menu item was invoked. + AMCLASSICON_Selected = 11; // The icon is now selected. + AMCLASSICON_Unselected = 12; // The icon is now unselected. + +type + // The message your AppIcon rendering hook gets invoked with. + PAppIconRenderMsg = ^TAppIconRenderMsg; + TAppIconRenderMsg = record + arm_RastPort: PRastPort; // RastPort to render into. + arm_Icon: PDiskObject; // The icon to be rendered. + arm_Label: STRPTR; // The icon label txt. + arm_Tags: PTagItem; // Further tags to be passed on to DrawIconStateA(). + arm_Left: SmallInt; // \ Rendering origin, not taking the + arm_Top: SmallInt; // / button border into account. + arm_Width: SmallInt; // \ Limit your rendering to + arm_Height: SmallInt; // / this area. + arm_State: LongWord; // IDS_SELECTED, IDS_NORMAL, etc. + end; + + // The message your drop zone hook gets invoked with. } + PAppWindowDropZoneMsg = ^TAppWindowDropZoneMsg; + TAppWindowDropZoneMsg = record + adzm_RastPort: PRastPort; // RastPort to render into. + adzm_DropZoneBox: TIBox; // Limit your rendering to this area. + adzm_ID: LongWord; // \ These come from straight + adzm_UserData: IPTR; // / from AddAppWindowDropZoneA(). + adzm_Action: LongInt; // See below for a list of actions. + end; + +const + // definitions for adzm_Action + ADZMACTION_Enter = 0; + ADZMACTION_Leave = 1; + +type + // The message your icon selection change hook is invoked with. } + PIconSelectMsg = ^TIconSelectMsg; + TIconSelectMsg = record + ism_Length: LongWord; // Size of this data structure (in bytes). + ism_Drawer: BPTR; // Lock on the drawer this object resides in, NULL for Workbench backdrop (devices). + ism_Name: STRPTR; // Name of the object in question. + ism_type: Word; // One of WBDISK, WBDRAWER, WBTOOL, WBPROJECT, WBGARBAGE, WBDEVICE, WBKICK or WBAPPICON. + ism_Selected: LongBool; // TRUE if currently selected, FALSE otherwise. + ism_Tags: PTagItem; // Pointer to the list of tag items passed to ChangeWorkbenchSelectionA(). + ism_DrawerWindow: PWindow; // Pointer to the window attached to this icon, if the icon is a drawer-like object. + ism_ParentWindow: PWindow; // Pointer to the window the icon resides in. + ism_Left: SmallInt; // Position and size of the icon; note that the icon may not entirely reside within the visible bounds of the parent window. + ism_Top: SmallInt; + ism_Width: SmallInt; + ism_Height: SmallInt; + end; + +const + // These are the values your hook code can return. + ISMACTION_Unselect = 0; // Unselect the icon. + ISMACTION_Select = 1; // Select the icon. + ISMACTION_Ignore = 2; // Do not change the selection state. + ISMACTION_Stop = 3; // Do not invoke the hook code again, leave the icon as it is. + +type + // The messages your copy hook is invoked with. + PCopyBeginMsg = ^TCopyBeginMsg; + TCopyBeginMsg = record + cbm_Length: LongWord; // Size of this data structure in bytes. + cbm_Action: LongInt; // Will be set to CPACTION_Begin (see below). + cbm_SourceDrawer: BPTR; // A lock on the source drawer. + cbm_DestinationDrawer: BPTR; // A lock on the destination drawer. + end; + + PCopyDataMsg = ^TCopyDataMsg; + TCopyDataMsg = record + cdm_Length: LongWord; // Size of this data structure in bytes. + cdm_Action: LongInt; // Will be set to CPACTION_Copy (see below). + cdm_SourceLock: BPTR; // A lock on the parent directory of the source file/drawer. + cdm_SourceName: STRPTR; // The name of the source file or drawer. + cdm_DestinationLock: BPTR; // A lock on the parent directory of the destination file/drawer. + cdm_DestinationName: STRPTR; // The name of the destination file/drawer. + // This may or may not match the name of the source file/drawer in case the + // data is to be copied under a different name. For example, this is the case + // with the Workbench "Copy" command which creates duplicates of file/drawers by + // prefixing the duplicate's name with "Copy_XXX_of". + cdm_DestinationX: LongInt; // When the icon corresponding to the destination is written to disk, this + cdm_DestinationY: LongInt; // is the position (put into its DiskObject->do_CurrentX/DiskObject->do_CurrentY. + end; // fields) it should be placed at. + + PCopyEndMsg = ^TCopyEndMsg; + TCopyEndMsg = record + cem_Length: LongWord; // Size of this data structure in bytes. + cem_Action: LongInt; // Will be set to CPACTION_End (see below). + end; + +const + CPACTION_Begin = 0; + CPACTION_Copy = 1; // This message arrives for each file or drawer to be copied. + CPACTION_End = 2; // This message arrives when all files/drawers have been copied. + +type + // The messages your delete hook is invoked with. + PDeleteBeginMsg = ^TDeleteBeginMsg; + TDeleteBeginMsg = record + dbm_Length: LongWord; // Size of this data structure in bytes. + dbm_Action: LongInt; // Will be set to either DLACTION_BeginDiscard or DLACTION_BeginEmptyTrash (see below). + end; + + PDeleteDataMsg = ^TDeleteDataMsg; + TDeleteDataMsg = record + ddm_Length: LongWord; // Size of this data structure in bytes. + ddm_Action: LongInt; // Will be set to either DLACTION_DeleteContents or DLACTION_DeleteObject (see below). + ddm_Lock: BPTR; // A Lock on the parent directory of the object whose contents or which itself should be deleted. + ddm_Name: STRPTR; // The name of the object whose contents or which itself should be deleted. + end; + + PDeleteEndMsg = ^TDeleteEndMsg; + TDeleteEndMsg = record + dem_Length: LongWord; // Size of this data structure in bytes. + dem_Action: LongInt; // Will be set to DLACTION_End (see below). + end; + + +const + DLACTION_BeginDiscard = 0; + DLACTION_BeginEmptyTrash = 1; // This indicates that the following delete operations are intended to empty the trashcan. + DLACTION_DeleteContents = 3; // This indicates that the object described by lock and name refers to a drawer; you should empty its contents but DO NOT delete the drawer itself! + DLACTION_DeleteObject = 4; // This indicates that the object described by lock and name should be deleted; this could be a file or an empty drawer. + DLACTION_End = 5; // This indicates that the deletion process is finished. + +type + // The message your setup/cleanup hook gets invoked with. + PSetupCleanupHookMsg = ^TSetupCleanupHookMsg; + TSetupCleanupHookMsg = record + schm_Length: LongWord; + schm_State: LongInt; + end; + +const + SCHMSTATE_TryCleanup = 0; // Workbench will attempt to shut down now. + SCHMSTATE_Cleanup = 1; // Workbench will really shut down now. + SCHMSTATE_Setup = 2; // Workbench is operational again or could not be shut down. + +type + // The messages your text input hook is invoked with. + PTextInputMsg = ^TTextInputMsg; + TTextInputMsg = record + tim_Length: LongWord; // Size of this data structure in bytes. + tim_Action: LongInt; // One of the TIACTION_... values listed below. + tim_Prompt: STRPTR; // The Workbench suggested result, depending on what kind of input is requested (as indicated by the tim_Action member). + end; + +const + TIACTION_Rename = 0; // A file or drawer is to be renamed. + TIACTION_RelabelVolume = 1; // A volume is to be relabeled. + TIACTION_NewDrawer = 2; // A new drawer is to be created. + TIACTION_Execute = 3; // A program or script is to be executed. + +type + // + // The following structures are private. These are just stub + // structures for code compatibility... + // + { + pAppWindow = ^tAppWindow; + tAppWindow = record + aw_PRIVATE: Pointer; + end; + + pAppWindowDropZone = ^tAppWindowDropZone; + tAppWindowDropZone = record + awdz_PRIVATE: pointer; + end; + + pAppIcon = ^tAppIcon; + tAppIcon = record + ai_PRIVATE: Pointer; + end; + + pAppMenuItem = ^tAppMenuItem; + tAppMenuItem = record + ami_PRIVATE: Pointer; + end; + } + (* not in aros + PAppMenu = ^tAppMenu; + tAppMenu = record + am_PRIVATE: pointer; + end; + *) + // Aros versions: + + PAppWindow = ^TAppWindow; + TAppWindow = record + end; + + PAppWindowDropZone = ^TAppWindowDropZone; + TAppWindowDropZone = record + end; + + PAppIcon = ^TAppIcon; + TAppIcon = record + end; + + PAppMenuItem = ^TAppMenuItem; + TAppMenuItem = record + end; + + +const + (* WBA_Dummy = TAG_USER + $A000; *) {$WARNING AROS: constant WBA_Dummy is renamed to WBA_BASE} + WBA_BASE = TAG_USER + $A000; + // Tags for use with AddAppIconA() + // The different menu items the AppIcon responds to (BOOL). + WBAPPICONA_SupportsOpen = WBA_BASE + 1; // AppIcon responds to the "Open" menu item (LongBool). + WBAPPICONA_SupportsCopy = WBA_BASE + 2; // AppIcon responds to the "Copy" menu item (LongBool). + WBAPPICONA_SupportsRename = WBA_BASE + 3; // AppIcon responds to the "Rename" menu item (LongBool). + WBAPPICONA_SupportsInformation = WBA_BASE + 4; // AppIcon responds to the "Information" menu item (LongBool). + WBAPPICONA_SupportsSnapshot = WBA_BASE + 5; // AppIcon responds to the "Snapshot" menu item (LongBool). + WBAPPICONA_SupportsUnSnapshot = WBA_BASE + 6; // AppIcon responds to the "UnSnapshot" menu item (LongBool). + WBAPPICONA_SupportsLeaveOut = WBA_BASE + 7; // AppIcon responds to the "LeaveOut" menu item (LongBool). + WBAPPICONA_SupportsPutAway = WBA_BASE + 8; // AppIcon responds to the "PutAway" menu item (LongBool). + WBAPPICONA_SupportsDelete = WBA_BASE + 9; // AppIcon responds to the "Delete" menu item (LongBool). + WBAPPICONA_SupportsFormatDisk = WBA_BASE + 10; // AppIcon responds to the "FormatDisk" menu item (LongBool). + WBAPPICONA_SupportsEmptyTrash = WBA_BASE + 11; // AppIcon responds to the "EmptyTrash" menu item (LongBool). + + WBAPPICONA_PropagatePosition = WBA_BASE + 12; // AppIcon position should be propagated back to original DiskObject (LongBool). + WBAPPICONA_RenderHook = WBA_BASE + 13; // Callback hook to be invoked when rendering this icon (pHook). + WBAPPICONA_NotifySelectState = WBA_BASE + 14; // AppIcon wants to be notified when its select state changes (LongBool). + + // Tags for use with AddAppMenuA() + WBAPPMENUA_CommandKeyString = WBA_BASE + 15; // Command key string for this AppMenu (STRPTR). + WBAPPMENUA_GetKey = WBA_BASE + 65; // Item to be added should get sub menu items attached to; make room for it, then return the key to use later for attaching the items (A_PUL + WBAPPMENUA_UseKey = WBA_BASE + 66; // This item should be attached to a sub menu; the key provided refers to the sub menu it should be attached to (LongWord). + WBAPPMENUA_GetTitleKey = WBA_BASE + 77; // Item to be added is in fact a new menu title; make room for it, then return the key to use later for attaching the items (??? ULONG ???). + + // Tags for use with OpenWorkbenchObjectA() + WBOPENA_ArgLock = WBA_BASE + 16; // Corresponds to the wa_Lock member of a struct WBArg. + WBOPENA_ArgName = WBA_BASE + 17; // Corresponds to the wa_Name member of a struct WBArg. + WBOPENA_Show = WBA_BASE + 75; // When opening a drawer, show all files or only icons? This must be one out of DDFLAGS_SHOWICONS, or DDFLAGS_SHOWALL; (Byte); (V45) + WBOPENA_ViewBy = WBA_BASE + 76; // When opening a drawer, view the contents by icon, name, date, size or type? This must be one out of DDVM_BYICON, DDVM_BYNAME, DDVM_BYDATE, DDVM_BYSIZE or DDVM_BYTYPE; (UBYTE); (V45) + + // Tags for use with WorkbenchControlA() + WBCTRLA_IsOpen = WBA_BASE + 18; // Check if the named drawer is currently open (PLongInt). + WBCTRLA_DuplicateSearchPath = WBA_BASE + 19; // Create a duplicate of the Workbench private search path list (PBPTR). + WBCTRLA_FreeSearchPath = WBA_BASE + 20; // Free the duplicated search path list (BPTR). + WBCTRLA_GetDefaultStackSize = WBA_BASE + 21; // Get the default stack size for launching programs with (PLongWord). + WBCTRLA_SetDefaultStackSize = WBA_BASE + 22; // Set the default stack size for launching programs with (LongWord). + WBCTRLA_RedrawAppIcon = WBA_BASE + 23; // Cause an AppIcon to be redrawn (pAppIcon). + WBCTRLA_GetProgramList = WBA_BASE + 24; // Get a list of currently running Workbench programs (pList). + WBCTRLA_FreeProgramList = WBA_BASE + 25; // Release the list of currently running Workbench programs (pList). + WBCTRLA_GetSelectedIconList = WBA_BASE + 36; // Get a list of currently selected icons (pList). + WBCTRLA_FreeSelectedIconList = WBA_BASE + 37; // Release the list of currently selected icons (pList). + WBCTRLA_GetOpenDrawerList = WBA_BASE + 38; // Get a list of currently open drawers (pList). + WBCTRLA_FreeOpenDrawerList = WBA_BASE + 39; // Release the list of currently open icons (pList). + WBCTRLA_GetHiddenDeviceList = WBA_BASE + 42; // Get the list of hidden devices (pList). + + WBCTRLA_FreeHiddenDeviceList = WBA_BASE + 43; // Release the list of hidden devices (pList). + WBCTRLA_AddHiddenDeviceName = WBA_BASE + 44; // Add the name of a device which Workbench should never try to read a disk icon from (STRPTR). + WBCTRLA_RemoveHiddenDeviceName = WBA_BASE + 45; // Remove a name from list of hidden devices (STRPTR). + WBCTRLA_GettypeRestartTime = WBA_BASE + 47; // Get the number of seconds that have to pass before typing the next character in a drawer window will restart with a new file name (PLongWord). + WBCTRLA_SettypeRestartTime = WBA_BASE + 48; // Set the number of seconds that have to pass before typing the next character in a drawer window will restart with a new file name (LongWord). + WBCTRLA_GetCopyHook = WBA_BASE + 69; // Obtain the hook that will be invoked when Workbench starts to copy files and data (pHook); (V45) + WBCTRLA_SetCopyHook = WBA_BASE + 70; // Install the hook that will be invoked when Workbench starts to copy files and data (pHook); (V45) + WBCTRLA_GetDeleteHook = WBA_BASE + 71; // Obtain the hook that will be invoked when Workbench discards files and drawers or empties the trashcan (pHook); (V45). + WBCTRLA_SetDeleteHook = WBA_BASE + 72; // Install the hook that will be invoked when Workbench discards files and drawers or empties the trashcan (pHook); (V45). + WBCTRLA_GetTextInputHook = WBA_BASE + 73; // Obtain the hook that will be invoked when Workbench requests that the user enters text, such as when a file is to be renamed or a new drawer is to be created (pHook); (V45) + WBCTRLA_SetTextInputHook = WBA_BASE + 74; // Install the hook that will be invoked when Workbench requests that the user enters text, such as when a file is to be renamed or a new drawer is to be created (pHook); (V45) + WBCTRLA_AddSetupCleanupHook = WBA_BASE + 78; // Add a hook that will be invoked when Workbench is about to shut down (cleanup), and when Workbench has returned to operational state (setup) (pHook); (V45) + WBCTRLA_RemSetupCleanupHook = WBA_BASE + 79; // Remove a hook that has been installed with the WBCTRLA_AddSetupCleanupHook tag (pHook); (V45) + + // Tags for use with AddAppWindowDropZoneA() + WBDZA_Left = WBA_BASE + 26; // Zone left edge (SmallInt) + WBDZA_RelRight = WBA_BASE + 27; // Zone left edge, if relative to the right edge of the window (SmallInt) + WBDZA_Top = WBA_BASE + 28; // Zone top edge (SmallInt) + WBDZA_RelBottom = WBA_BASE + 29; // Zone top edge, if relative to the bottom edge of the window (SmallInt) + WBDZA_Width = WBA_BASE + 30; // Zone width (SmallInt) + WBDZA_RelWidth = WBA_BASE + 31; // Zone width, if relative to the window width (SmallInt) + WBDZA_Height = WBA_BASE + 32; // Zone height (SmallInt) + WBDZA_RelHeight = WBA_BASE + 33; // Zone height, if relative to the window height (SmallInt) + WBDZA_Box = WBA_BASE + 34; // Zone position and size (pIBox). + WBDZA_Hook = WBA_BASE + 35; // Hook to invoke when the mouse enters or leave a drop zone (pHook). + + // Reserved tags; don't use! } + WBA_Reserved1 = WBA_BASE + 40; + WBA_Reserved2 = WBA_BASE + 41; + WBA_Reserved3 = WBA_BASE + 46; + WBA_Reserved4 = WBA_BASE + 49; + WBA_Reserved5 = WBA_BASE + 50; + WBA_Reserved6 = WBA_BASE + 51; + WBA_Reserved7 = WBA_BASE + 52; + WBA_Reserved8 = WBA_BASE + 53; + WBA_Reserved9 = WBA_BASE + 54; + WBA_Reserved10 = WBA_BASE + 55; + WBA_Reserved11 = WBA_BASE + 56; + WBA_Reserved12 = WBA_BASE + 57; + WBA_Reserved13 = WBA_BASE + 58; + WBA_Reserved14 = WBA_BASE + 59; + WBA_Reserved15 = WBA_BASE + 60; + WBA_Reserved16 = WBA_BASE + 61; + WBA_Reserved17 = WBA_BASE + 62; + WBA_Reserved18 = WBA_BASE + 63; + WBA_Reserved19 = WBA_BASE + 64; + + // Last Tag + WBA_LAST_TAG = WBA_BASE + 64; + + // Parameters for the UpdateWorkbench() function. + UPDATEWB_ObjectRemoved = 0; // Object has been deleted. + UPDATEWB_ObjectAdded = 1; // Object is new or has changed. + +(* left behind: not used in aros, classic only +const + +{ each message that comes into the WorkBenchPort must have a type field + * in the preceeding short. These are the defines for this type + } + + MTYPE_PSTD = 1; { a "standard Potion" message } + MTYPE_TOOLEXIT = 2; { exit message from our tools } + MTYPE_DISKCHANGE = 3; { dos telling us of a disk change } + MTYPE_TIMER = 4; { we got a timer tick } + MTYPE_CLOSEDOWN = 5; { <unimplemented> } + MTYPE_IOPROC = 6; { <unimplemented> } + MTYPE_APPWINDOW = 7; { msg from an app window } + MTYPE_APPICON = 8; { msg from an app icon } + MTYPE_APPMENUITEM = 9; { msg from an app menuitem } + MTYPE_COPYEXIT = 10; { exit msg from copy process } + MTYPE_ICONPUT = 11; { msg from PutDiskObject in icon.library } +*) + +// ###### workbench/handler.h ############################################### +type + TWBHM_type = + ( + WBHM_TYPE_SHOW, // Open all windows. + WBHM_TYPE_HIDE, // Close all windows. + WBHM_TYPE_OPEN, // Open a drawer. + WBHM_TYPE_UPDATE // Update an object. + ); + + PWBHandlerMessage = ^TWBHandlerMessage; + TWBHandlerMessage = record + wbhm_Message: TMessage; // Standard message structure. + wbhm_type: TWBHM_type; // type of message. + case integer of + 0 : + ( + Open: record + OpenName: STRPTR; // Name of the drawer. + end; + ); + 1 : + ( + Update: record + UpdateName: STRPTR; // Mame of the object. + Updatetype: LongInt; // type of object (WBDRAWER, WBPROJECT, ...). + end; + ); + end; + + +var + WorkbenchBase: pLibrary; + +{ v36 } +function UpdateWorkbench(const Name: STRPTR; Lock: BPTR; Action: LongInt): LongBool; syscall WorkbenchBase 5; +function QuoteWorkbench(StringNum: LongWord): LongBool; syscall WorkbenchBase 6; unimplemented; +function StartWorkbench(Flag: LongWord; Ptr: APTR): LongBool; syscall WorkbenchBase 7; +function AddAppWindowA(ID: LongWord; UserData: LongWord; Window: PWindow; MsgPort: PMsgPort; TagList: PTagItem): PAppWindow; syscall WorkbenchBase 8; +function RemoveAppWindow(AppWindow: PAppWindow): LongBool; syscall WorkbenchBase 9; +function AddAppIconA(ID: LongWord; UserData: LongWord; Text_: PChar; MsgPort: PMsgPort; Lock: BPTR; DiskObj: PDiskObject; TagList: PTagItem): PAppIcon; syscall WorkbenchBase 10; +function RemoveAppIcon(AppIcon: PAppIcon): LongBool; syscall WorkbenchBase 11; +function AddAppMenuItemA(ID: LongWord; UserData: LongWord; Text_: APTR; MsgPort: PMsgPort; TagList: PTagItem): PAppMenuItem; syscall WorkbenchBase 12; +function RemoveAppMenuItem(AppMenuItem: PAppMenuItem): LongBool; syscall WorkbenchBase 13; +{ v39 } +function WBConfig(Unk1: LongWord; Unk2: LongWord): LongBool; syscall WorkbenchBase 14; unimplemented; +function WBInfo(Lock: BPTR; const Name: STRPTR; Screen: PScreen): LongBool; syscall WorkbenchBase 15; +{ v44 } +function OpenWorkbenchObjectA(Name: STRPTR; Tags: PTagItem): LongBool; syscall WorkbenchBase 16; +function CloseWorkbenchObjectA(Name: STRPTR; Tags: PTagItem): LongBool; syscall WorkbenchBase 17; unimplemented; +function WorkbenchControlA(Name: STRPTR; Tags: PTagItem): LongBool; syscall WorkbenchBase 18; +function AddAppWindowDropZoneA(Aw: PAppWindow; ID: LongWord; UserData: LongWord; Tags: PTagItem): PAppWindowDropZone; syscall WorkbenchBase 19; +function RemoveAppWindowDropZone(Aw: PAppWindow; DropZone: PAppWindowDropZone): LongBool; syscall WorkbenchBase 20; +function ChangeWorkbenchSelectionA(Name: STRPTR; Hook: PHook; Tags: PTagItem): LongBool; syscall WorkbenchBase 21; unimplemented; +function MakeWorkbenchObjectVisibleA(Name: STRPTR; Tags: PTagItem): LongBool; syscall WorkbenchBase 22; unimplemented; +{ v45, AROS only ? } +function RegisterWorkbench(MessagePort: PMsgPort): LongBool; syscall WorkbenchBase 23; +function UnregisterWorkbench(MessagePort: PMsgPort): LongBool; syscall WorkbenchBase 24; +function UpdateWorkbenchObjectA(Name: STRPTR; Type_: LongInt; Tags: PTagItem): LongBool; syscall WorkbenchBase 25; +function SendAppWindowMessage(Win: PWindow; NumFiles: LongWord; Files: PPChar; Class_: Word; MouseX: SmallInt; MouseY: SmallInt; Seconds: LongWord; Micros: LongWord): LongBool; syscall WorkbenchBase 26; +function GetNextAppIcon(LastDiskObj: PDiskObject; Text_: PChar): PDiskObject; syscall WorkbenchBase 27; + +// varargs versions: +function AddAppIcon(ID: LongWord; UserData: LongWord; Text_: PChar; MsgPort: PMsgPort; Lock: BPTR; DiskObj: PDiskObject; const Tags: array of const): PAppIcon; +function AddAppMenuItem(ID: LongWord; UserData: LongWord; Text_: APTR; MsgPort: PMsgPort; const Tags: array of const): PAppMenuItem; +function AddAppWindow(ID: LongWord; UserData: LongWord; Window: PWindow; MsgPort: PMsgPort; const Tags: array of const): PAppWindow; +function AddAppWindowDropZone(Aw: PAppWindow; ID: LongWord; UserData: LongWord; const Tags: array of const): PAppWindowDropZone; +function CloseWorkbenchObject(Name: STRPTR; const Tags: array of const): LongBool; unimplemented; +function MakeWorkbenchObjectVisible(Name: STRPTR; const Tags: array of const): LongBool; unimplemented; +function OpenWorkbenchObject(Name: STRPTR; const Tags: array of const): LongBool; +function WorkbenchControl(Name: STRPTR; const Tags: array of const): LongBool; + +implementation + +uses + TagsArray; + + +// varargs versions: +function AddAppIcon(ID: LongWord; UserData: LongWord; Text_: PChar; MsgPort: PMsgPort; Lock: BPTR; DiskObj: PDiskObject; const Tags: array of const): PAppIcon; +begin + AddAppIcon := AddAppIconA(ID, UserData, Text_, MsgPort, Lock, DiskObj, ReadInTags(Tags)); +end; + + +function AddAppMenuItem(ID: LongWord; UserData: LongWord; Text_: APTR; MsgPort: PMsgPort; const Tags: array of const): PAppMenuItem; +begin + AddAppMenuItem := AddAppMenuItemA(ID, UserData, Text_, MsgPort, ReadInTags(Tags)); +end; + + +function AddAppWindow(ID: LongWord; UserData: LongWord; Window: PWindow; MsgPort: PMsgPort; const Tags: array of const): PAppWindow; +begin + AddAppWindow := AddAppWindowA(ID, UserData, Window, MsgPort, ReadInTags(Tags)); +end; + + +function AddAppWindowDropZone(Aw: PAppWindow; ID: LongWord; UserData: LongWord; const Tags: array of const): PAppWindowDropZone; +begin + AddAppWindowDropZone := AddAppWindowDropZoneA(Aw, ID, UserData, ReadInTags(Tags)); +end; + + +function CloseWorkbenchObject(Name: STRPTR; const Tags: array of const): LongBool; +begin + CloseWorkbenchObject := CloseWorkbenchObjectA(Name, ReadInTags(Tags)); +end; + + +function MakeWorkbenchObjectVisible(Name: STRPTR; const Tags: array of const): LongBool; +begin + MakeWorkbenchObjectVisible := MakeWorkbenchObjectVisibleA(Name, ReadInTags(Tags)); +end; + + +function OpenWorkbenchObject(Name: STRPTR; const Tags: array of const): LongBool; +begin + OpenWorkbenchObject := OpenWorkbenchObjectA(Name, ReadInTags(Tags)); +end; + + +function WorkbenchControl(Name: STRPTR; const Tags: array of const): LongBool; +begin + WorkbenchControl := WorkbenchControlA(Name, ReadInTags(Tags)); +end; + + +Initialization + WorkbenchBase := OpenLibrary(WORKBENCHNAME,0); +Finalization + CloseLibrary(WorkbenchBase); +end. diff --git a/packages/fpmake_add.inc b/packages/fpmake_add.inc index 0b74b5052e..5aa84a31fb 100644 --- a/packages/fpmake_add.inc +++ b/packages/fpmake_add.inc @@ -1,5 +1,6 @@ add_a52(ADirectory+IncludeTrailingPathDelimiter('a52')); add_amunits(ADirectory+IncludeTrailingPathDelimiter('amunits')); + add_arosunits(ADirectory+IncludeTrailingPathDelimiter('arosunits')); add_aspell(ADirectory+IncludeTrailingPathDelimiter('aspell')); add_bfd(ADirectory+IncludeTrailingPathDelimiter('bfd')); add_bzip2(ADirectory+IncludeTrailingPathDelimiter('bzip2')); diff --git a/packages/fpmake_proc.inc b/packages/fpmake_proc.inc index 4937ea27b0..f5c139faca 100644 --- a/packages/fpmake_proc.inc +++ b/packages/fpmake_proc.inc @@ -10,6 +10,12 @@ begin {$include amunits/fpmake.pp} end; +procedure add_arosunits(const ADirectory: string); +begin + with Installer do +{$include arosunits/fpmake.pp} +end; + procedure add_aspell(const ADirectory: string); begin with Installer do |