Browse Source

* removed from main branch

peter 24 years ago
parent
commit
78ac57028b
61 changed files with 0 additions and 21510 deletions
  1. 0 996
      api/Makefile
  2. 0 19
      api/Makefile.fpc
  3. 0 87
      api/README
  4. 0 1282
      api/freebsd/Makefile
  5. 0 46
      api/freebsd/Makefile.fpc
  6. 0 1276
      api/go32v2/Makefile
  7. 0 40
      api/go32v2/Makefile.fpc
  8. 0 252
      api/go32v2/filectrl.inc
  9. 0 130
      api/go32v2/keyboard.inc
  10. 0 718
      api/go32v2/mouse.inc
  11. 0 163
      api/go32v2/vesamode.pas
  12. 0 314
      api/go32v2/video.inc
  13. 0 1
      api/inc/Makefile.api
  14. 0 328
      api/inc/apicomm.pas
  15. 0 358
      api/inc/callspec.pas
  16. 0 210
      api/inc/filectrl.pas
  17. 0 1113
      api/inc/filesys.pas
  18. 0 280
      api/inc/keyboard.pas
  19. 0 198
      api/inc/mouse.pas
  20. 0 332
      api/inc/platform.inc
  21. 0 254
      api/inc/video.pas
  22. 0 1281
      api/linux/Makefile
  23. 0 44
      api/linux/Makefile.fpc
  24. 0 2
      api/maketp.bat
  25. 0 1276
      api/os2/Makefile
  26. 0 40
      api/os2/Makefile.fpc
  27. 0 178
      api/os2/filectrl.inc
  28. 0 186
      api/os2/keyboard.inc
  29. 0 415
      api/os2/mouse.inc
  30. 0 565
      api/os2/video.inc
  31. 0 1273
      api/test/Makefile
  32. 0 13
      api/test/Makefile.fpc
  33. 0 155
      api/test/testcall.pas
  34. 0 22
      api/test/testfctl.pas
  35. 0 136
      api/test/testfsys.pas
  36. 0 38
      api/test/testkbd.pas
  37. 0 48
      api/test/testmou2.pas
  38. 0 16
      api/test/testmous.pas
  39. 0 24
      api/test/testterminfo.pas
  40. 0 24
      api/test/testterminfo5.pas
  41. 0 43
      api/test/testvid1.pas
  42. 0 50
      api/test/testvid2.pas
  43. 0 232
      api/tp/filectrl.inc
  44. 0 149
      api/tp/keyboard.inc
  45. 0 195
      api/tp/mouse.inc
  46. 0 230
      api/tp/video.inc
  47. 0 39
      api/tpapi.pas
  48. 0 182
      api/unix/filectrl.inc
  49. 0 142
      api/unix/gpm114.pas
  50. 0 858
      api/unix/keyboard.inc
  51. 0 348
      api/unix/mouse.inc
  52. 0 794
      api/unix/terminfo.pas
  53. 0 31
      api/unix/testkeyb.pas
  54. 0 870
      api/unix/video.inc
  55. 0 1278
      api/win32/Makefile
  56. 0 42
      api/win32/Makefile.fpc
  57. 0 354
      api/win32/event.pas
  58. 0 171
      api/win32/filectrl.inc
  59. 0 795
      api/win32/keyboard.inc
  60. 0 210
      api/win32/mouse.inc
  61. 0 364
      api/win32/video.inc

+ 0 - 996
api/Makefile

@@ -1,996 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override DIROBJECTS+=$(wildcard go32v2 linux win32 os2 freebsd)
-override EXAMPLEDIROBJECTS+=test
-
-# Clean
-
-
-# Install
-
-EXAMPLESUBDIR=api
-PACKAGENAME=api
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-
-# Packages
-
-
-# Libraries
-
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: $(addsuffix _all,$(OS_TARGET))
-
-debug: $(addsuffix _debug,$(OS_TARGET))
-
-examples: fpc_examples
-
-test: fpc_test
-
-smart: $(addsuffix _smart,$(OS_TARGET))
-
-shared: $(addsuffix _shared,$(OS_TARGET))
-
-showinstall: $(addsuffix _showinstall,$(OS_TARGET))
-
-install: $(addsuffix _install,$(OS_TARGET))
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: $(addsuffix _clean,$(OS_TARGET)) $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-
-distclean: $(addsuffix _distclean,$(OS_TARGET))
-
-cleanall: $(addsuffix _cleanall,$(OS_TARGET))
-
-require: $(addsuffix _require,$(OS_TARGET))
-
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require
-
-#####################################################################
-# Examples
-#####################################################################
-
-.PHONY: fpc_examples fpc_test
-
-ifdef EXAMPLEOBJECTS
-override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
-override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
-override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXAMPLEOBJECTS)))
-
-override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
-endif
-
-fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
-
-fpc_test: examples
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Directories
-#####################################################################
-
-OBJECTDIRGO32V2=1
-OBJECTDIRLINUX=1
-OBJECTDIRWIN32=1
-OBJECTDIROS2=1
-OBJECTDIRFREEBSD=1
-
-# Dir go32v2
-
-ifdef OBJECTDIRGO32V2
-.PHONY:  go32v2_all go32v2_debug go32v2_examples go32v2_test go32v2_smart go32v2_shared go32v2_showinstall go32v2_install go32v2_sourceinstall go32v2_exampleinstall go32v2_zipinstall go32v2_zipsourceinstall go32v2_zipexampleinstall go32v2_clean go32v2_distclean go32v2_cleanall go32v2_require go32v2_info
-
-go32v2_all:
-	$(MAKE) -C go32v2 all
-
-go32v2_debug:
-	$(MAKE) -C go32v2 debug
-
-go32v2_examples:
-	$(MAKE) -C go32v2 examples
-
-go32v2_test:
-	$(MAKE) -C go32v2 test
-
-go32v2_smart:
-	$(MAKE) -C go32v2 smart
-
-go32v2_shared:
-	$(MAKE) -C go32v2 shared
-
-go32v2_showinstall:
-	$(MAKE) -C go32v2 showinstall
-
-go32v2_install:
-	$(MAKE) -C go32v2 install
-
-go32v2_sourceinstall:
-	$(MAKE) -C go32v2 sourceinstall
-
-go32v2_exampleinstall:
-	$(MAKE) -C go32v2 exampleinstall
-
-go32v2_zipinstall:
-	$(MAKE) -C go32v2 zipinstall
-
-go32v2_zipsourceinstall:
-	$(MAKE) -C go32v2 zipsourceinstall
-
-go32v2_zipexampleinstall:
-	$(MAKE) -C go32v2 zipexampleinstall
-
-go32v2_clean:
-	$(MAKE) -C go32v2 clean
-
-go32v2_distclean:
-	$(MAKE) -C go32v2 distclean
-
-go32v2_cleanall:
-	$(MAKE) -C go32v2 cleanall
-
-go32v2_require:
-	$(MAKE) -C go32v2 require
-
-go32v2_info:
-	$(MAKE) -C go32v2 info
-endif
-
-# Dir linux
-
-ifdef OBJECTDIRLINUX
-.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_exampleinstall linux_zipinstall linux_zipsourceinstall linux_zipexampleinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
-
-linux_all:
-	$(MAKE) -C linux all
-
-linux_debug:
-	$(MAKE) -C linux debug
-
-linux_examples:
-	$(MAKE) -C linux examples
-
-linux_test:
-	$(MAKE) -C linux test
-
-linux_smart:
-	$(MAKE) -C linux smart
-
-linux_shared:
-	$(MAKE) -C linux shared
-
-linux_showinstall:
-	$(MAKE) -C linux showinstall
-
-linux_install:
-	$(MAKE) -C linux install
-
-linux_sourceinstall:
-	$(MAKE) -C linux sourceinstall
-
-linux_exampleinstall:
-	$(MAKE) -C linux exampleinstall
-
-linux_zipinstall:
-	$(MAKE) -C linux zipinstall
-
-linux_zipsourceinstall:
-	$(MAKE) -C linux zipsourceinstall
-
-linux_zipexampleinstall:
-	$(MAKE) -C linux zipexampleinstall
-
-linux_clean:
-	$(MAKE) -C linux clean
-
-linux_distclean:
-	$(MAKE) -C linux distclean
-
-linux_cleanall:
-	$(MAKE) -C linux cleanall
-
-linux_require:
-	$(MAKE) -C linux require
-
-linux_info:
-	$(MAKE) -C linux info
-endif
-
-# Dir win32
-
-ifdef OBJECTDIRWIN32
-.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_exampleinstall win32_zipinstall win32_zipsourceinstall win32_zipexampleinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
-
-win32_all:
-	$(MAKE) -C win32 all
-
-win32_debug:
-	$(MAKE) -C win32 debug
-
-win32_examples:
-	$(MAKE) -C win32 examples
-
-win32_test:
-	$(MAKE) -C win32 test
-
-win32_smart:
-	$(MAKE) -C win32 smart
-
-win32_shared:
-	$(MAKE) -C win32 shared
-
-win32_showinstall:
-	$(MAKE) -C win32 showinstall
-
-win32_install:
-	$(MAKE) -C win32 install
-
-win32_sourceinstall:
-	$(MAKE) -C win32 sourceinstall
-
-win32_exampleinstall:
-	$(MAKE) -C win32 exampleinstall
-
-win32_zipinstall:
-	$(MAKE) -C win32 zipinstall
-
-win32_zipsourceinstall:
-	$(MAKE) -C win32 zipsourceinstall
-
-win32_zipexampleinstall:
-	$(MAKE) -C win32 zipexampleinstall
-
-win32_clean:
-	$(MAKE) -C win32 clean
-
-win32_distclean:
-	$(MAKE) -C win32 distclean
-
-win32_cleanall:
-	$(MAKE) -C win32 cleanall
-
-win32_require:
-	$(MAKE) -C win32 require
-
-win32_info:
-	$(MAKE) -C win32 info
-endif
-
-# Dir os2
-
-ifdef OBJECTDIROS2
-.PHONY:  os2_all os2_debug os2_examples os2_test os2_smart os2_shared os2_showinstall os2_install os2_sourceinstall os2_exampleinstall os2_zipinstall os2_zipsourceinstall os2_zipexampleinstall os2_clean os2_distclean os2_cleanall os2_require os2_info
-
-os2_all:
-	$(MAKE) -C os2 all
-
-os2_debug:
-	$(MAKE) -C os2 debug
-
-os2_examples:
-	$(MAKE) -C os2 examples
-
-os2_test:
-	$(MAKE) -C os2 test
-
-os2_smart:
-	$(MAKE) -C os2 smart
-
-os2_shared:
-	$(MAKE) -C os2 shared
-
-os2_showinstall:
-	$(MAKE) -C os2 showinstall
-
-os2_install:
-	$(MAKE) -C os2 install
-
-os2_sourceinstall:
-	$(MAKE) -C os2 sourceinstall
-
-os2_exampleinstall:
-	$(MAKE) -C os2 exampleinstall
-
-os2_zipinstall:
-	$(MAKE) -C os2 zipinstall
-
-os2_zipsourceinstall:
-	$(MAKE) -C os2 zipsourceinstall
-
-os2_zipexampleinstall:
-	$(MAKE) -C os2 zipexampleinstall
-
-os2_clean:
-	$(MAKE) -C os2 clean
-
-os2_distclean:
-	$(MAKE) -C os2 distclean
-
-os2_cleanall:
-	$(MAKE) -C os2 cleanall
-
-os2_require:
-	$(MAKE) -C os2 require
-
-os2_info:
-	$(MAKE) -C os2 info
-endif
-
-# Dir freebsd
-
-ifdef OBJECTDIRFREEBSD
-.PHONY:  freebsd_all freebsd_debug freebsd_examples freebsd_test freebsd_smart freebsd_shared freebsd_showinstall freebsd_install freebsd_sourceinstall freebsd_exampleinstall freebsd_zipinstall freebsd_zipsourceinstall freebsd_zipexampleinstall freebsd_clean freebsd_distclean freebsd_cleanall freebsd_require freebsd_info
-
-freebsd_all:
-	$(MAKE) -C freebsd all
-
-freebsd_debug:
-	$(MAKE) -C freebsd debug
-
-freebsd_examples:
-	$(MAKE) -C freebsd examples
-
-freebsd_test:
-	$(MAKE) -C freebsd test
-
-freebsd_smart:
-	$(MAKE) -C freebsd smart
-
-freebsd_shared:
-	$(MAKE) -C freebsd shared
-
-freebsd_showinstall:
-	$(MAKE) -C freebsd showinstall
-
-freebsd_install:
-	$(MAKE) -C freebsd install
-
-freebsd_sourceinstall:
-	$(MAKE) -C freebsd sourceinstall
-
-freebsd_exampleinstall:
-	$(MAKE) -C freebsd exampleinstall
-
-freebsd_zipinstall:
-	$(MAKE) -C freebsd zipinstall
-
-freebsd_zipsourceinstall:
-	$(MAKE) -C freebsd zipsourceinstall
-
-freebsd_zipexampleinstall:
-	$(MAKE) -C freebsd zipexampleinstall
-
-freebsd_clean:
-	$(MAKE) -C freebsd clean
-
-freebsd_distclean:
-	$(MAKE) -C freebsd distclean
-
-freebsd_cleanall:
-	$(MAKE) -C freebsd cleanall
-
-freebsd_require:
-	$(MAKE) -C freebsd require
-
-freebsd_info:
-	$(MAKE) -C freebsd info
-endif
-EXAMPLEDIRTEST=1
-
-# Dir test
-
-ifdef EXAMPLEDIRTEST
-.PHONY:  test_all test_debug test_examples test_test test_smart test_shared test_showinstall test_install test_sourceinstall test_exampleinstall test_zipinstall test_zipsourceinstall test_zipexampleinstall test_clean test_distclean test_cleanall test_require test_info
-
-test_all:
-	$(MAKE) -C test all
-
-test_debug:
-	$(MAKE) -C test debug
-
-test_examples:
-	$(MAKE) -C test examples
-
-test_test:
-	$(MAKE) -C test test
-
-test_smart:
-	$(MAKE) -C test smart
-
-test_shared:
-	$(MAKE) -C test shared
-
-test_showinstall:
-	$(MAKE) -C test showinstall
-
-test_install:
-	$(MAKE) -C test install
-
-test_sourceinstall:
-	$(MAKE) -C test sourceinstall
-
-test_exampleinstall:
-	$(MAKE) -C test exampleinstall
-
-test_zipinstall:
-	$(MAKE) -C test zipinstall
-
-test_zipsourceinstall:
-	$(MAKE) -C test zipsourceinstall
-
-test_zipexampleinstall:
-	$(MAKE) -C test zipexampleinstall
-
-test_clean:
-	$(MAKE) -C test clean
-
-test_distclean:
-	$(MAKE) -C test distclean
-
-test_cleanall:
-	$(MAKE) -C test cleanall
-
-test_require:
-	$(MAKE) -C test require
-
-test_info:
-	$(MAKE) -C test info
-endif
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-

+ 0 - 19
api/Makefile.fpc

@@ -1,19 +0,0 @@
-#
-#   Makefile.fpc for Free Component Library
-#
-
-[targets]
-dirs=go32v2 linux win32 os2 freebsd
-exampledirs=test
-
-[defaults]
-defaultdir=$(OS_TARGET)
-
-[install]
-packagename=api
-examplesubdir=api
-
-[sections]
-none=1
-zipsourceinstall=1
-zipexampleinstall=1

+ 0 - 87
api/README

@@ -1,87 +0,0 @@
-
-
-1. What is this?
-----------------
-
-This is the first public release of our system independent routine collection
-for Pascal. This package includes routines in four major areas:
-
-- file handling (FileCtrl, FileSys)
-- keyboard handling (Keyboard)
-- mouse handling (Mouse)
-- full-screen video handling (Video)
-
-2. Where to find documentation?
--------------------------------
-
-Documentation is not available yet. However it is planned. If you need help
-feel free to ask on our public mailing lists.
-
-There are two mailing lists, one for users. To subscribe send a message to
[email protected] containing one single line:
-
-subscribe fpk-pascal
-
-The other mailing list is for developers. To subscribe to this list, send a 
-message to [email protected], containing:
-
-subscribe fpc-devel
-
-3. FTP sites
--------------
-
-This unit collection is available at the following FTP site:
-
-ftp://ftp.uni-freiburg.de/pub/pc/msdos/fpk-pascal/develop/
-
-
-4. Installation
----------------
-
-  * With FPK:
-     compile the unit with FPK-Pascal using your favourite switches.
-
-       ppc386 buildapi.pas
-
-     will do the trick. After this, copy the resulting .ppu and .o files to
-     your ppc lib directory. By default this is
-
-     /usr/lib/ppc/<version-you-are-using>/linuxunits
-
-     under Linux. Under DOS units are in \PP\LIB\
-
-  * With BP
-     compile the unit with Borland Pascal using the command:
-
-       bpc /cd buildapi.pas            for real target
-       bpc /cp buildapi.pas            for DPMI target
-       bpc /cw buildapi.pas            for Windows target
-
-     you may want to rename filectrl.pp to filectrl.pas if you want BP to
-     be able to access your source file more easily. Copy the resulting
-     .TPU, .TPP, .TPW files to your \BP\UNITS directory. (or to a directory
-     you created for add-on units, make sure that this directory is listed
-     in the Unit directories dialog)
-
-  * With Virtual Pascal/2
-  * With Speed Pascal/2
-     similar to the above ones, but since I don't have OS/2 installed right
-     now, I don't know.
-
-5. Copyright
-------------
-
-This library is under the terms and conditions of the LGPL. See the enclosed
-file COPYING.LIB for details. The library is not available as a shared lib (yet)
-so it may cause licensing problems if you want to use it in a commercial project.
-This will change as soon as the lib becomes available as a shared library.
-
-6. Troubleshooting
-------------------
-
-Due to the bugs in the FPK compiler you may run into problems while compiling
-the API. For example when I try to compile a unit which lists SysCalls in the
-uses clause (in the implementation) part, the compiler always wants to compile
-SysCalls (even if I have it in the lib directory.) copying the units to your 
-working directory helps. (you'll also need errno.inc and sysnr.inc)
-

+ 0 - 1282
api/freebsd/Makefile

@@ -1,1282 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# Default target
-#####################################################################
-
-override OS_TARGET:=freebsd
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# Pre Settings
-#####################################################################
-
-INC=../inc
-UNIXINC=../unix
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Default FPCDIR
-ifeq ($(FPCDIR),wrong)
-override FPCDIR=../..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-ifndef PACKAGESDIR
-PACKAGESDIR=$(FPCDIR)/packages
-endif
-ifndef TOOLKITSDIR
-TOOLKITSDIR=
-endif
-ifndef COMPONENTSDIR
-COMPONENTSDIR=
-endif
-
-# Create units dir
-ifneq ($(FPCDIR),.)
-UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override UNITOBJECTS+=terminfo $(APIOBJECTS)
-
-# Clean
-
-
-# Install
-
-UNITSUBDIR=api
-PACKAGENAME=api
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-vpath %$(PASEXT) $(INC)
-override NEEDUNITDIR=$(UNIXINC)
-override NEEDINCDIR=$(INC) $(UNIXINC)
-ifndef TARGETDIR
-TARGETDIR=.
-endif
-
-# Packages
-
-override PACKAGES+=rtl
-
-# Libraries
-
-LIBNAME=libfpapi.so
-LIBVERSION=1.0
-
-# Info
-
-INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ppumove
-ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUMOVE),)
-PPUMOVE=
-else
-PPUMOVE:=$(firstword $(PPUMOVE))
-endif
-endif
-export PPUMOVE
-
-# ppufiles
-ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUFILES),)
-PPUFILES=
-else
-PPUFILES:=$(firstword $(PPUFILES))
-endif
-endif
-export PPUFILES
-
-# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
-# upx uses that one itself (PFV)
-ifndef UPXPROG
-ifeq ($(OS_TARGET),go32v2)
-UPXPROG:=1
-endif
-ifeq ($(OS_TARGET),win32)
-UPXPROG:=1
-endif
-ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(UPXPROG),)
-UPXPROG=
-else
-UPXPROG:=$(firstword $(UPXPROG))
-endif
-else
-UPXPROG=
-endif
-endif
-export UPXPROG
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-#####################################################################
-# Default extensions
-#####################################################################
-
-# Default needed extensions (Go32v2,Linux)
-LOADEREXT=.as
-EXEEXT=.exe
-PPLEXT=.ppl
-PPUEXT=.ppu
-OEXT=.o
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.so
-RSTEXT=.rst
-FPCMADE=fpcmade
-
-# Go32v1
-ifeq ($(OS_TARGET),go32v1)
-PPUEXT=.pp1
-OEXT=.o1
-ASMEXT=.s1
-SMARTEXT=.sl1
-STATICLIBEXT=.a1
-SHAREDLIBEXT=.so1
-FPCMADE=fpcmade.v1
-endif
-
-# Go32v2
-ifeq ($(OS_TARGET),go32v2)
-FPCMADE=fpcmade.dos
-endif
-
-# Linux
-ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.lnx
-endif
-
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
-# Win32
-ifeq ($(OS_TARGET),win32)
-PPUEXT=.ppw
-OEXT=.ow
-ASMEXT=.sw
-SMARTEXT=.slw
-STATICLIBEXT=.aw
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.w32
-endif
-
-# OS/2
-ifeq ($(OS_TARGET),os2)
-PPUEXT=.ppo
-ASMEXT=.so2
-OEXT=.oo2
-SMARTEXT=.so
-STATICLIBEXT=.ao2
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.os2
-endif
-
-# library prefix
-LIBPREFIX=lib
-ifeq ($(OS_TARGET),go32v2)
-LIBPREFIX=
-endif
-ifeq ($(OS_TARGET),go32v1)
-LIBPREFIX=
-endif
-
-# determine which .pas extension is used
-ifndef PASEXT
-ifdef EXEOBJECTS
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
-else
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
-endif
-ifeq ($(TESTPAS),)
-PASEXT=.pp
-else
-PASEXT=.pas
-endif
-endif
-
-
-# Check if the dirs really exists, else turn it off
-ifeq ($(wildcard $(UNITSDIR)),)
-UNITSDIR=
-endif
-ifeq ($(wildcard $(TOOLKITSDIR)),)
-TOOLKITSDIR=
-endif
-ifeq ($(wildcard $(PACKAGESDIR)),)
-PACKAGESDIR=
-endif
-ifeq ($(wildcard $(COMPONENTSDIR)),)
-COMPONENTSDIR=
-endif
-
-
-# PACKAGESDIR packages
-
-PACKAGERTL=1
-
-ifdef PACKAGERTL
-ifneq ($(wildcard $(FPCDIR)/rtl),)
-ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
-PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
-else
-PACKAGEDIR_RTL=$(FPCDIR)/rtl
-endif
-ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_rtl
-package_rtl:
-	$(MAKE) -C $(PACKAGEDIR_RTL) all
-endif
-UNITDIR_RTL=$(PACKAGEDIR_RTL)
-else
-PACKAGEDIR_RTL=
-ifneq ($(wildcard $(UNITSDIR)/rtl),)
-ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
-UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
-else
-UNITDIR_RTL=$(UNITSDIR)/rtl
-endif
-else
-UNITDIR_RTL=
-endif
-endif
-ifdef UNITDIR_RTL
-override NEEDUNITDIR+=$(UNITDIR_RTL)
-endif
-endif
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-
-#####################################################################
-# Compiler Command Line
-#####################################################################
-
-# Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(CPU_TARGET)
-
-# Load commandline OPT and add target and unit dir to be sure
-ifneq ($(OS_TARGET),$(OS_SOURCE))
-override FPCOPT+=-T$(OS_TARGET)
-endif
-
-# User dirs should be first, so they are looked at first
-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
-
-# Smartlinking
-ifdef LINKSMART
-override FPCOPT+=-XX
-endif
-
-# Smartlinking creation
-ifdef CREATESMART
-override FPCOPT+=-CX
-endif
-
-# Debug
-ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
-endif
-
-# Release mode (strip, optimize and don't load ppc386.cfg)
-# 0.99.12b has a bug in the optimizer so don't use it by default
-ifdef RELEASE
-ifeq ($(FPC_VERSION),0.99.12)
-override FPCOPT+=-Xs -OGp3 -n
-else
-override FPCOPT+=-Xs -OG2p3 -n
-endif
-endif
-
-# Strip
-ifdef STRIP
-override FPCOPT+=-Xs
-endif
-
-# Optimizer
-ifdef OPTIMIZE
-override FPCOPT+=-OG2p3
-endif
-
-# Verbose settings (warning,note,info)
-ifdef VERBOSE
-override FPCOPT+=-vwni
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
-endif
-
-
-# Target dirs and the prefix to use for clean/install
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
-endif
-
-# Add commandline options last so they can override
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-
-# Add defines from FPCOPTDEF to FPCOPT
-ifdef FPCOPTDEF
-override FPCOPT+=$(FPCOPTDEF)
-endif
-
-# Error file ?
-ifdef ERRORFILE
-override FPCOPT+=-Fr$(ERRORFILE)
-endif
-
-# Was a config file specified ?
-ifdef CFGFILE
-override FPCOPT+=@$(CFGFILE)
-endif
-
-# For win32 the options are passed using the environment FPCEXTCMD
-ifeq ($(OS_SOURCE),win32)
-override FPCEXTCMD:=$(FPCOPT)
-override FPCOPT:=!FPCEXTCMD
-export FPCEXTCMD
-endif
-
-# Compiler commandline
-override COMPILER:=$(FPC) $(FPCOPT)
-
-# also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
-ifeq (,$(findstring -s ,$(COMPILER)))
-EXECPPAS=
-else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
-EXECPPAS:=@$(PPAS)
-endif
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: fpc_all
-
-debug: fpc_debug
-
-smart: fpc_smart
-
-shared: fpc_shared
-
-showinstall: fpc_showinstall
-
-install: fpc_install
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: fpc_clean
-
-distclean: fpc_distclean
-
-cleanall: fpc_cleanall
-
-info: fpc_info
-
-.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
-
-#####################################################################
-# Units
-#####################################################################
-
-.PHONY: fpc_units
-
-override ALLTARGET+=fpc_units
-
-override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
-override INSTALLPPUFILES+=$(UNITPPUFILES)
-override CLEANPPUFILES+=$(UNITPPUFILES)
-
-fpc_units: $(UNITPPUFILES)
-
-#####################################################################
-# General compile rules
-#####################################################################
-
-.PHONY: fpc_packages fpc_all fpc_debug
-
-$(FPCMADE): $(ALLTARGET)
-	@$(ECHO) Compiled > $(FPCMADE)
-
-fpc_packages: $(COMPILEPACKAGES)
-
-fpc_all: fpc_packages $(FPCMADE)
-
-fpc_debug:
-	$(MAKE) all DEBUG=1
-
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
-# General compile rules, available for both possible PASEXT
-
-.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
-
-%$(PPUEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(PPUEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-#####################################################################
-# Library
-#####################################################################
-
-.PHONY: fpc_smart fpc_shared
-
-ifdef LIBVERSION
-LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
-else
-LIBFULLNAME=$(LIBNAME)
-endif
-
-# Default sharedlib units are all unit objects
-ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
-endif
-
-fpc_smart:
-	$(MAKE) all LINKSMART=1 CREATESMART=1
-
-fpc_shared: all
-ifdef HASSHAREDLIB
-ifndef LIBNAME
-	@$(ECHO) "LIBNAME not set"
-else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
-endif
-else
-	@$(ECHO) "Shared Libraries not supported"
-endif
-
-#####################################################################
-# Install rules
-#####################################################################
-
-.PHONY: fpc_showinstall fpc_install
-
-ifdef EXTRAINSTALLUNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
-endif
-
-ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-ifdef PPUFILES
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
-endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-
-fpc_showinstall: $(SHOWINSTALLTARGET)
-ifdef INSTALLEXEFILES
-	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
-endif
-ifdef INSTALLPPUFILES
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
-ifneq ($(INSTALLPPULINKFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
-endif
-
-fpc_install: $(INSTALLTARGET)
-# Create UnitInstallFiles
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(BININSTALLDIR)
-# Compress the exes if upx is defined
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(UNITINSTALLDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
-	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	$(MKDIR) $(DATAINSTALLDIR)
-	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
-endif
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Clean rules
-#####################################################################
-
-.PHONY: fpc_clean fpc_cleanall fpc_distclean
-
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
-ifdef EXTRACLEANUNITS
-override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
-endif
-
-ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
-ifdef PPUFILES
-CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
-else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
-endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
-endif
-
-fpc_clean: $(CLEANTARGET)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-ifdef CLEANPPUFILES
-	-$(DEL) $(CLEANPPUFILES)
-endif
-ifneq ($(CLEANPPULINKFILES),)
-	-$(DEL) $(CLEANPPULINKFILES)
-endif
-ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
-endif
-ifdef EXTRACLEANFILES
-	-$(DEL) $(EXTRACLEANFILES)
-endif
-ifdef LIBNAME
-	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
-endif
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-fpc_distclean: fpc_clean
-
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-	-$(DELTREE) *$(SMARTEXT)
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-#####################################################################
-# Info rules
-#####################################################################
-
-.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
-	fpc_dirinfo
-
-fpc_info: $(INFOTARGET)
-
-fpc_infocfg:
-	@$(ECHO)
-	@$(ECHO)  == Configuration info ==
-	@$(ECHO)
-	@$(ECHO)  FPC....... $(FPC)
-	@$(ECHO)  Version... $(FPC_VERSION)
-	@$(ECHO)  CPU....... $(CPU_TARGET)
-	@$(ECHO)  Source.... $(OS_SOURCE)
-	@$(ECHO)  Target.... $(OS_TARGET)
-	@$(ECHO)
-
-fpc_infoobjects:
-	@$(ECHO)
-	@$(ECHO)  == Object info ==
-	@$(ECHO)
-	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
-	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
-	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
-	@$(ECHO)
-	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
-	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
-	@$(ECHO)
-	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
-	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
-	@$(ECHO)
-
-fpc_infoinstall:
-	@$(ECHO)
-	@$(ECHO)  == Install info ==
-	@$(ECHO)
-ifdef DATE
-	@$(ECHO)  DateStr.............. $(DATESTR)
-endif
-ifdef PACKAGEPREFIX
-	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
-endif
-ifdef PACKAGENAME
-	@$(ECHO)  PackageName.......... $(PACKAGENAME)
-endif
-	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
-	@$(ECHO)
-	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
-	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
-	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
-	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
-	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
-	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
-	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
-	@$(ECHO)
-	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
-	@$(ECHO)  ZipName.............. $(ZIPNAME)
-	@$(ECHO)
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-
-#####################################################################
-# Users rules
-#####################################################################
-
-
-terminfo$(PPUEXT): $(UNIXINC)/terminfo.pas
-
-video$(PPUEXT): $(INC)/video.pas $(UNIXINC)/video.inc 
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas $(UNIXINC)/keyboard.inc
-
-mouse$(PPUEXT): $(INC)/mouse.pas $(UNIXINC)/mouse.inc
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas $(UNIXINC)/filectrl.inc

+ 0 - 46
api/freebsd/Makefile.fpc

@@ -1,46 +0,0 @@
-#
-#   Makefile.fpc for Free Pascal API (used by Free Vision) for freebsd
-#
-
-[defaults]
-defaulttarget=freebsd
-
-[targets]
-units=terminfo $(APIOBJECTS)
-
-[install]
-unitsubdir=api
-packagename=api
-
-[libs]
-libname=libfpapi.so
-libversion=1.0
-
-[dirs]
-fpcdir=../..
-targetdir=.
-sourcesdir=$(INC)
-incdir=$(INC) $(UNIXINC)
-unitdir=$(UNIXINC)
-
-[presettings]
-INC=../inc
-UNIXINC=../unix
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-
-[rules]
-
-terminfo$(PPUEXT): $(UNIXINC)/terminfo.pas
-
-video$(PPUEXT): $(INC)/video.pas $(UNIXINC)/video.inc 
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas $(UNIXINC)/keyboard.inc
-
-mouse$(PPUEXT): $(INC)/mouse.pas $(UNIXINC)/mouse.inc
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas $(UNIXINC)/filectrl.inc
-

+ 0 - 1276
api/go32v2/Makefile

@@ -1,1276 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# Default target
-#####################################################################
-
-override OS_TARGET:=go32v2
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# Pre Settings
-#####################################################################
-
-INC=../inc
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Default FPCDIR
-ifeq ($(FPCDIR),wrong)
-override FPCDIR=../..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-ifndef PACKAGESDIR
-PACKAGESDIR=$(FPCDIR)/packages
-endif
-ifndef TOOLKITSDIR
-TOOLKITSDIR=
-endif
-ifndef COMPONENTSDIR
-COMPONENTSDIR=
-endif
-
-# Create units dir
-ifneq ($(FPCDIR),.)
-UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override UNITOBJECTS+=$(APIOBJECTS) vesamode
-
-# Clean
-
-
-# Install
-
-UNITSUBDIR=api
-PACKAGENAME=api
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-vpath %$(PASEXT) $(INC)
-override NEEDINCDIR=$(INC)
-ifndef TARGETDIR
-TARGETDIR=.
-endif
-
-# Packages
-
-override PACKAGES+=rtl
-
-# Libraries
-
-LIBNAME=fpapi
-
-# Info
-
-INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ppumove
-ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUMOVE),)
-PPUMOVE=
-else
-PPUMOVE:=$(firstword $(PPUMOVE))
-endif
-endif
-export PPUMOVE
-
-# ppufiles
-ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUFILES),)
-PPUFILES=
-else
-PPUFILES:=$(firstword $(PPUFILES))
-endif
-endif
-export PPUFILES
-
-# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
-# upx uses that one itself (PFV)
-ifndef UPXPROG
-ifeq ($(OS_TARGET),go32v2)
-UPXPROG:=1
-endif
-ifeq ($(OS_TARGET),win32)
-UPXPROG:=1
-endif
-ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(UPXPROG),)
-UPXPROG=
-else
-UPXPROG:=$(firstword $(UPXPROG))
-endif
-else
-UPXPROG=
-endif
-endif
-export UPXPROG
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-#####################################################################
-# Default extensions
-#####################################################################
-
-# Default needed extensions (Go32v2,Linux)
-LOADEREXT=.as
-EXEEXT=.exe
-PPLEXT=.ppl
-PPUEXT=.ppu
-OEXT=.o
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.so
-RSTEXT=.rst
-FPCMADE=fpcmade
-
-# Go32v1
-ifeq ($(OS_TARGET),go32v1)
-PPUEXT=.pp1
-OEXT=.o1
-ASMEXT=.s1
-SMARTEXT=.sl1
-STATICLIBEXT=.a1
-SHAREDLIBEXT=.so1
-FPCMADE=fpcmade.v1
-endif
-
-# Go32v2
-ifeq ($(OS_TARGET),go32v2)
-FPCMADE=fpcmade.dos
-endif
-
-# Linux
-ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.lnx
-endif
-
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
-# Win32
-ifeq ($(OS_TARGET),win32)
-PPUEXT=.ppw
-OEXT=.ow
-ASMEXT=.sw
-SMARTEXT=.slw
-STATICLIBEXT=.aw
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.w32
-endif
-
-# OS/2
-ifeq ($(OS_TARGET),os2)
-PPUEXT=.ppo
-ASMEXT=.so2
-OEXT=.oo2
-SMARTEXT=.so
-STATICLIBEXT=.ao2
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.os2
-endif
-
-# library prefix
-LIBPREFIX=lib
-ifeq ($(OS_TARGET),go32v2)
-LIBPREFIX=
-endif
-ifeq ($(OS_TARGET),go32v1)
-LIBPREFIX=
-endif
-
-# determine which .pas extension is used
-ifndef PASEXT
-ifdef EXEOBJECTS
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
-else
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
-endif
-ifeq ($(TESTPAS),)
-PASEXT=.pp
-else
-PASEXT=.pas
-endif
-endif
-
-
-# Check if the dirs really exists, else turn it off
-ifeq ($(wildcard $(UNITSDIR)),)
-UNITSDIR=
-endif
-ifeq ($(wildcard $(TOOLKITSDIR)),)
-TOOLKITSDIR=
-endif
-ifeq ($(wildcard $(PACKAGESDIR)),)
-PACKAGESDIR=
-endif
-ifeq ($(wildcard $(COMPONENTSDIR)),)
-COMPONENTSDIR=
-endif
-
-
-# PACKAGESDIR packages
-
-PACKAGERTL=1
-
-ifdef PACKAGERTL
-ifneq ($(wildcard $(FPCDIR)/rtl),)
-ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
-PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
-else
-PACKAGEDIR_RTL=$(FPCDIR)/rtl
-endif
-ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_rtl
-package_rtl:
-	$(MAKE) -C $(PACKAGEDIR_RTL) all
-endif
-UNITDIR_RTL=$(PACKAGEDIR_RTL)
-else
-PACKAGEDIR_RTL=
-ifneq ($(wildcard $(UNITSDIR)/rtl),)
-ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
-UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
-else
-UNITDIR_RTL=$(UNITSDIR)/rtl
-endif
-else
-UNITDIR_RTL=
-endif
-endif
-ifdef UNITDIR_RTL
-override NEEDUNITDIR+=$(UNITDIR_RTL)
-endif
-endif
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-
-#####################################################################
-# Compiler Command Line
-#####################################################################
-
-# Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(CPU_TARGET)
-
-# Load commandline OPT and add target and unit dir to be sure
-ifneq ($(OS_TARGET),$(OS_SOURCE))
-override FPCOPT+=-T$(OS_TARGET)
-endif
-
-# User dirs should be first, so they are looked at first
-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
-
-# Smartlinking
-ifdef LINKSMART
-override FPCOPT+=-XX
-endif
-
-# Smartlinking creation
-ifdef CREATESMART
-override FPCOPT+=-CX
-endif
-
-# Debug
-ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
-endif
-
-# Release mode (strip, optimize and don't load ppc386.cfg)
-# 0.99.12b has a bug in the optimizer so don't use it by default
-ifdef RELEASE
-ifeq ($(FPC_VERSION),0.99.12)
-override FPCOPT+=-Xs -OGp3 -n
-else
-override FPCOPT+=-Xs -OG2p3 -n
-endif
-endif
-
-# Strip
-ifdef STRIP
-override FPCOPT+=-Xs
-endif
-
-# Optimizer
-ifdef OPTIMIZE
-override FPCOPT+=-OG2p3
-endif
-
-# Verbose settings (warning,note,info)
-ifdef VERBOSE
-override FPCOPT+=-vwni
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
-endif
-
-
-# Target dirs and the prefix to use for clean/install
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
-endif
-
-# Add commandline options last so they can override
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-
-# Add defines from FPCOPTDEF to FPCOPT
-ifdef FPCOPTDEF
-override FPCOPT+=$(FPCOPTDEF)
-endif
-
-# Error file ?
-ifdef ERRORFILE
-override FPCOPT+=-Fr$(ERRORFILE)
-endif
-
-# Was a config file specified ?
-ifdef CFGFILE
-override FPCOPT+=@$(CFGFILE)
-endif
-
-# For win32 the options are passed using the environment FPCEXTCMD
-ifeq ($(OS_SOURCE),win32)
-override FPCEXTCMD:=$(FPCOPT)
-override FPCOPT:=!FPCEXTCMD
-export FPCEXTCMD
-endif
-
-# Compiler commandline
-override COMPILER:=$(FPC) $(FPCOPT)
-
-# also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
-ifeq (,$(findstring -s ,$(COMPILER)))
-EXECPPAS=
-else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
-EXECPPAS:=@$(PPAS)
-endif
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: fpc_all
-
-debug: fpc_debug
-
-smart: fpc_smart
-
-shared: fpc_shared
-
-showinstall: fpc_showinstall
-
-install: fpc_install
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: fpc_clean
-
-distclean: fpc_distclean
-
-cleanall: fpc_cleanall
-
-info: fpc_info
-
-.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
-
-#####################################################################
-# Units
-#####################################################################
-
-.PHONY: fpc_units
-
-override ALLTARGET+=fpc_units
-
-override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
-override INSTALLPPUFILES+=$(UNITPPUFILES)
-override CLEANPPUFILES+=$(UNITPPUFILES)
-
-fpc_units: $(UNITPPUFILES)
-
-#####################################################################
-# General compile rules
-#####################################################################
-
-.PHONY: fpc_packages fpc_all fpc_debug
-
-$(FPCMADE): $(ALLTARGET)
-	@$(ECHO) Compiled > $(FPCMADE)
-
-fpc_packages: $(COMPILEPACKAGES)
-
-fpc_all: fpc_packages $(FPCMADE)
-
-fpc_debug:
-	$(MAKE) all DEBUG=1
-
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
-# General compile rules, available for both possible PASEXT
-
-.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
-
-%$(PPUEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(PPUEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-#####################################################################
-# Library
-#####################################################################
-
-.PHONY: fpc_smart fpc_shared
-
-ifdef LIBVERSION
-LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
-else
-LIBFULLNAME=$(LIBNAME)
-endif
-
-# Default sharedlib units are all unit objects
-ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
-endif
-
-fpc_smart:
-	$(MAKE) all LINKSMART=1 CREATESMART=1
-
-fpc_shared: all
-ifdef HASSHAREDLIB
-ifndef LIBNAME
-	@$(ECHO) "LIBNAME not set"
-else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
-endif
-else
-	@$(ECHO) "Shared Libraries not supported"
-endif
-
-#####################################################################
-# Install rules
-#####################################################################
-
-.PHONY: fpc_showinstall fpc_install
-
-ifdef EXTRAINSTALLUNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
-endif
-
-ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-ifdef PPUFILES
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
-endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-
-fpc_showinstall: $(SHOWINSTALLTARGET)
-ifdef INSTALLEXEFILES
-	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
-endif
-ifdef INSTALLPPUFILES
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
-ifneq ($(INSTALLPPULINKFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
-endif
-
-fpc_install: $(INSTALLTARGET)
-# Create UnitInstallFiles
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(BININSTALLDIR)
-# Compress the exes if upx is defined
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(UNITINSTALLDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
-	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	$(MKDIR) $(DATAINSTALLDIR)
-	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
-endif
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Clean rules
-#####################################################################
-
-.PHONY: fpc_clean fpc_cleanall fpc_distclean
-
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
-ifdef EXTRACLEANUNITS
-override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
-endif
-
-ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
-ifdef PPUFILES
-CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
-else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
-endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
-endif
-
-fpc_clean: $(CLEANTARGET)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-ifdef CLEANPPUFILES
-	-$(DEL) $(CLEANPPUFILES)
-endif
-ifneq ($(CLEANPPULINKFILES),)
-	-$(DEL) $(CLEANPPULINKFILES)
-endif
-ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
-endif
-ifdef EXTRACLEANFILES
-	-$(DEL) $(EXTRACLEANFILES)
-endif
-ifdef LIBNAME
-	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
-endif
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-fpc_distclean: fpc_clean
-
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-	-$(DELTREE) *$(SMARTEXT)
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-#####################################################################
-# Info rules
-#####################################################################
-
-.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
-	fpc_dirinfo
-
-fpc_info: $(INFOTARGET)
-
-fpc_infocfg:
-	@$(ECHO)
-	@$(ECHO)  == Configuration info ==
-	@$(ECHO)
-	@$(ECHO)  FPC....... $(FPC)
-	@$(ECHO)  Version... $(FPC_VERSION)
-	@$(ECHO)  CPU....... $(CPU_TARGET)
-	@$(ECHO)  Source.... $(OS_SOURCE)
-	@$(ECHO)  Target.... $(OS_TARGET)
-	@$(ECHO)
-
-fpc_infoobjects:
-	@$(ECHO)
-	@$(ECHO)  == Object info ==
-	@$(ECHO)
-	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
-	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
-	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
-	@$(ECHO)
-	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
-	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
-	@$(ECHO)
-	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
-	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
-	@$(ECHO)
-
-fpc_infoinstall:
-	@$(ECHO)
-	@$(ECHO)  == Install info ==
-	@$(ECHO)
-ifdef DATE
-	@$(ECHO)  DateStr.............. $(DATESTR)
-endif
-ifdef PACKAGEPREFIX
-	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
-endif
-ifdef PACKAGENAME
-	@$(ECHO)  PackageName.......... $(PACKAGENAME)
-endif
-	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
-	@$(ECHO)
-	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
-	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
-	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
-	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
-	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
-	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
-	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
-	@$(ECHO)
-	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
-	@$(ECHO)  ZipName.............. $(ZIPNAME)
-	@$(ECHO)
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-
-#####################################################################
-# Users rules
-#####################################################################
-
-video$(PPUEXT): $(INC)/video.pas video.inc
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc
-
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc

+ 0 - 40
api/go32v2/Makefile.fpc

@@ -1,40 +0,0 @@
-#
-#   Makefile.fpc for Free Pascal API (used by Free Vision) for go32v2
-#
-
-[defaults]
-defaulttarget=go32v2
-
-[targets]
-units=$(APIOBJECTS) vesamode
-
-[install]
-unitsubdir=api
-packagename=api
-
-[libs]
-libname=fpapi
-
-[dirs]
-fpcdir=../..
-targetdir=.
-sourcesdir=$(INC)
-incdir=$(INC)
-
-[presettings]
-INC=../inc
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-
-
-[rules]
-video$(PPUEXT): $(INC)/video.pas video.inc
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc
-
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc

+ 0 - 252
api/go32v2/filectrl.inc

@@ -1,252 +0,0 @@
-{
-  System independent filecontrol interface for go32v2
-
-  $Id$
-}
-uses
-  Go32;
-
-function OpenFileStr(FName: PChar; Flags: Longint): TFileHandle;
-Var
-  regs : trealregs;
-begin
-  copytodos(FName^,256);
-  if LFNSupport then
-   regs.realeax:=$716c
-  else
-   regs.realeax:=$6c00;
-  regs.realedx:=$1;
-  regs.realds:=tb_segment;
-  regs.realesi:=tb_offset;
-  regs.realebx:=$2000;
-  regs.realecx:=$20;
-  realintr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   begin
-     ErrorCode:=lo(regs.realeax);
-     exit(0);
-   end
-  else
-   OpenFileStr:=regs.realeax and $ffff;
-end;
-
-
-function CreateFileStr(FName: PChar): TFileHandle;
-Var
-  regs : trealregs;
-begin
-  copytodos(FName^,256);
-  if LFNSupport then
-   regs.realeax:=$716c
-  else
-   regs.realeax:=$6c00;
-  regs.realedx:=$12;
-  regs.realds:=tb_segment;
-  regs.realesi:=tb_offset;
-  regs.realebx:=$2001;
-  regs.realecx:=$20;
-  realintr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   begin
-     ErrorCode:=lo(regs.realeax);
-     exit(0);
-   end
-  else
-   CreateFileStr:=regs.realeax and $ffff;
-end;
-
-
-procedure DeleteFileStr(FName: PChar);
-var
-  regs : trealregs;
-begin
-  copytodos(FName^,256);
-  regs.realedx:=tb_offset;
-  regs.realds:=tb_segment;
-  if LFNSupport then
-   regs.realeax:=$7141
-  else
-   regs.realeax:=$4100;
-  regs.realesi:=0;
-  regs.realecx:=0;
-  realintr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   ErrorCode:=lo(regs.realeax);
-end;
-
-
-procedure CloseFile(Handle: TFileHandle);
-var
-  regs : trealregs;
-begin
-  regs.realebx:=handle;
-  regs.realeax:=$3e00;
-  RealIntr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   ErrorCode:=lo(regs.realeax);
-end;
-
-
-function SeekFile(Handle: TFileHandle; Pos: TFileInt; SeekType: Word): TFileInt;
-var
-  regs : trealregs;
-begin
-  regs.realebx:=handle;
-  regs.realecx:=pos shr 16;
-  regs.realedx:=pos and $ffff;
-  regs.realeax:=$4200 or SeekType;
-  RealIntr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   begin
-     ErrorCode:=lo(regs.realeax);
-     SeekFile:=-1;
-   end
-  else
-   SeekFile:=lo(regs.realedx) shl 16+lo(regs.realeax);
-end;
-
-
-function ReadFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  regs     : trealregs;
-  addr     : pchar;
-  len,
-  size,
-  readsize : longint;
-begin
-  len:=count;
-  addr:=@buff;
-  readsize:=0;
-  while len > 0 do
-   begin
-     if len>tb_size then
-      size:=tb_size
-     else
-      size:=len;
-     regs.realecx:=len;
-     regs.realedx:=tb_offset;
-     regs.realds:=tb_segment;
-     regs.realebx:=handle;
-     regs.realeax:=$3f00;
-     RealIntr($21,regs);
-     if (regs.realflags and carryflag) <> 0 then
-      begin
-        InOutRes:=lo(regs.realeax);
-        exit(0);
-      end
-     else
-      if regs.realeax<size then
-       begin
-         copyfromdos(addr^,regs.realeax);
-         exit(readsize+regs.realeax);
-       end;
-     copyfromdos(addr^,regs.realeax);
-     inc(readsize,regs.realeax);
-     inc(addr,regs.realeax);
-     dec(len,regs.realeax);
-   end;
-  readfile:=readsize;
-end;
-
-
-function WriteFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  regs      : trealregs;
-  addr      : pchar;
-  len,
-  size,
-  writesize : longint;
-begin
-  len:=count;
-  addr:=@buff;
-  writesize:=0;
-  while len > 0 do
-   begin
-     if len>tb_size then
-      size:=tb_size
-     else
-      size:=len;
-     copytodos(addr^,size);
-     regs.realecx:=size;
-     regs.realedx:=tb_offset;
-     regs.realds:=tb_segment;
-     regs.realebx:=handle;
-     regs.realeax:=$4000;
-     RealIntr($21,regs);
-     if (regs.realflags and carryflag) <> 0 then
-      begin
-        ErrorCode:=lo(regs.realeax);
-        exit(writesize);
-      end;
-     dec(len,size);
-     inc(writesize,size);
-     inc(addr,size);
-   end;
-  WriteFile:=WriteSize;
-end;
-
-
-procedure FlushFile(Handle: TFileHandle);
-var
-  regs : trealregs;
-begin
-  regs.ebx:=handle;
-  regs.ah:=$68;
-  realintr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   ErrorCode:=lo(regs.realeax);
-end;
-
-
-procedure TruncateFile(Handle: TFileHandle);
-var
-  regs : trealregs;
-begin
-  regs.realecx:=0;
-  regs.realedx:=tb_offset;
-  regs.realds:=tb_segment;
-  regs.realebx:=handle;
-  regs.realeax:=$4000;
-  RealIntr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   ErrorCode:=lo(regs.realeax);
-end;
-
-function EndOfFile(Handle: TFileHandle): Boolean;
-begin
-  EndOfFile := FilePos(Handle) >= FileSize(Handle);
-end;
-
-function FilePos(Handle: TFileHandle): TFileInt;
-var
-  regs : trealregs;
-begin
-  regs.realebx:=handle;
-  regs.realecx:=0;
-  regs.realedx:=0;
-  regs.realeax:=$4201;
-  RealIntr($21,regs);
-  if (regs.realflags and carryflag) <> 0 then
-   Begin
-     InOutRes:=lo(regs.realeax);
-     filepos:=-1;
-   end
-  else
-   filepos:=lo(regs.realedx) shl 16+lo(regs.realeax);
-end;
-
-function FileSize(Handle: TFileHandle): TFileInt;
-var
-  aktfilepos : longint;
-begin
-  aktfilepos:=filepos(handle);
-  filesize:=seekfile(handle,0,2);
-  seekfile(handle,aktfilepos,0);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:24  michael
-  + removed logs
- 
-}

+ 0 - 130
api/go32v2/keyboard.inc

@@ -1,130 +0,0 @@
-{
-  System independent keyboard interface for go32v2
-
-<<<<<<< keyboard.inc
-  $Id$
-
-  WARNING this code needs %fs to contain the DOS memory selector
-  don't forget to reload it after calling C functions
-  that could change it PM
-=======
-  $Id$
->>>>>>> 1.3
-}
-uses
-  go32;
-
-procedure InitKeyboard;
-begin
-end;
-
-procedure DoneKeyboard;
-begin
-end;
-
-function GetKeyEvent: TKeyEvent;
-var
-  regs : trealregs;
-begin
-  if PendingKeyEvent<>0 then
-   begin
-     GetKeyEvent:=PendingKeyEvent;
-     PendingKeyEvent:=0;
-     exit;
-   end;
-  regs.ah:=$10;
-  realintr($16,regs);
-  if (regs.al=$e0) and (regs.ah<>0) then
-   regs.al:=0;
-  GetKeyEvent:=regs.ax or ((mem[$40:$17] and $f) shl 16);
-end;
-
-
-function PollKeyEvent: TKeyEvent;
-var
-  regs : trealregs;
-begin
-  if PendingKeyEvent<>0 then
-   exit(PendingKeyEvent);
-  regs.ah:=$11;
-  realintr($16,regs);
-  if (regs.realflags and zeroflag<>0) then
-   exit(0);
-  if (regs.al=$e0) and (regs.ah<>0) then
-   regs.al:=0;
-  PollKeyEvent:=regs.ax or ((mem[$40:$17] and $f) shl 16);
-end;
-
-
-function PollShiftStateEvent: TKeyEvent;
-begin
-  PollShiftStateEvent:=((mem[$40:$17] and $f) shl 16);
-end;
-
-
-{ Function key translation }
-type
-  TTranslationEntry = packed record
-    Min, Max: Byte;
-    Offset: Word;
-  end;
-const
-  TranslationTableEntries = 12;
-  TranslationTable: array [1..TranslationTableEntries] of TTranslationEntry =
-    ((Min: $3B; Max: $44; Offset: kbdF1),   { function keys F1-F10 }
-     (Min: $54; Max: $5D; Offset: kbdF1),   { Shift fn keys F1-F10 }
-     (Min: $5E; Max: $67; Offset: kbdF1),   { Ctrl fn keys F1-F10 }
-     (Min: $68; Max: $71; Offset: kbdF1),   { Alt fn keys F1-F10 }
-     (Min: $85; Max: $86; Offset: kbdF11),  { function keys F11-F12 }
-     (Min: $87; Max: $88; Offset: kbdF11),  { Shift+function keys F11-F12 }
-     (Min: $89; Max: $8A; Offset: kbdF11),  { Ctrl+function keys F11-F12 }
-     (Min: $8B; Max: $8C; Offset: kbdF11),  { Alt+function keys F11-F12 }
-     (Min:  71; Max:  73; Offset: kbdHome), { Keypad keys kbdHome-kbdPgUp }
-     (Min:  75; Max:  77; Offset: kbdLeft), { Keypad keys kbdLeft-kbdRight }
-     (Min:  79; Max:  81; Offset: kbdEnd),  { Keypad keys kbdEnd-kbdPgDn }
-     (Min: $52; Max: $53; Offset: kbdInsert));
-
-
-function TranslateKeyEvent(KeyEvent: TKeyEvent): TKeyEvent;
-var
-  I: Integer;
-  ScanCode: Byte;
-begin
-  if KeyEvent and $03000000 = $03000000 then
-   begin
-     if KeyEvent and $000000FF <> 0 then
-      begin
-        TranslateKeyEvent := KeyEvent and $00FFFFFF;
-        exit;
-      end
-     else
-      begin
-        { This is a function key }
-        ScanCode := (KeyEvent and $0000FF00) shr 8;
-        for I := 1 to TranslationTableEntries do
-         begin
-           if (TranslationTable[I].Min <= ScanCode) and (ScanCode <= TranslationTable[I].Max) then
-            begin
-              TranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) +
-                (ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
-              exit;
-            end;
-         end;
-      end;
-   end;
-  TranslateKeyEvent := KeyEvent;
-end;
-
-
-function TranslateKeyEventUniCode(KeyEvent: TKeyEvent): TKeyEvent;
-begin
-  TranslateKeyEventUniCode := KeyEvent;
-  ErrorHandler(errKbdNotImplemented, nil);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:24  michael
-  + removed logs
- 
-}

+ 0 - 718
api/go32v2/mouse.inc

@@ -1,718 +0,0 @@
-{
-  System dependent mouse implementation for go32v2
-
-  $Id$
-}
-
-uses
-  video,go32;
-
-var
-  RealSeg : Word;                                    { Real mode segment }
-  RealOfs : Word;                                    { Real mode offset }
-  CurrentMask : word;
-  MouseCallback : Pointer;                           { Mouse call back ptr }
-  UnderNT: boolean;
-{$ifdef DEBUG}
-  EntryEDI,EntryESI : longint;
-  EntryDS,EntryES : word;
-{$endif DEBUG}
-  { Real mode registers in text segment below $ffff limit
-    for Windows NT
-    NOTE this might cause problem if someone want to
-    protect text section against writing (would be possible
-    with CWSDPMI under raw dos, not implemented yet !) }
-  ActionRegs    : TRealRegs;external name '___v2prt0_rmcb_regs';
-  v2prt0_ds_alias : word;external name '___v2prt0_ds_alias';
-const
-  MousePresent : boolean = false;
-{$ifdef DEBUG}
-  MouseError   : longint = 0;
-  CallCounter  : longint = 0;
-{$endif DEBUG}
-  drawmousecursor : boolean = false;
-  mouseisvisible : boolean = false;
-  { position where the mouse was drawn the last time }
-  oldmousex : longint = -1;
-  oldmousey : longint = -1;
-  mouselock : boolean = false;
-
-{ if the cursor is drawn by this the unit, we must be careful }
-{ when drawing while the interrupt handler is called          }
-procedure lockmouse;assembler;
-
-  asm
-  .Ltrylockagain:
-     movb    $1,%al
-     xchgb   mouselock,%al
-     orb     %al,%al
-     jne     .Ltrylockagain
-  end;
-
-procedure unlockmouse;
-
-  begin
-     mouselock:=false;
-  end;
-
-
-{$ASMMODE ATT}
-procedure MouseInt;assembler;
-asm
-        movb    %bl,mousebuttons
-        movw    %cx,mousewherex
-        movw    %dx,mousewherey
-        shrw    $3,%cx
-        shrw    $3,%dx
-        { should we draw the mouse cursor? }
-        cmpb    $0,drawmousecursor
-        je      .Lmouse_nocursor
-        cmpb    $0,mouseisvisible
-        je      .Lmouse_nocursor
-        pushw   %fs
-        pushl   %eax
-        pushl   %edi
-        { check lock }
-        movb    $1,%al
-        xchgb   mouselock,%al
-        orb     %al,%al
-        { don't update the cursor yet, because hide/showcursor is called }
-        jne    .Ldont_draw
-
-        { load start of video buffer }
-        movzwl  videoseg,%edi
-        shll    $4,%edi
-        movw    dosmemselector,%fs
-
-        { calculate address of old mouse cursor }
-        movl    oldmousey,%eax
-        imulw   screenwidth,%ax
-        addl    oldmousex,%eax
-        leal    1(%edi,%eax,2),%eax
-        { remove old cursor }
-        xorb    $0x7f,%fs:(%eax)
-
-        { store position of old cursor }
-        movzwl  %cx,%ecx
-        movl    %ecx,oldmousex
-        movzwl  %dx,%edx
-        movl    %edx,oldmousey
-
-        { calculate address of new cursor }
-        movl    %edx,%eax
-        imulw   screenwidth,%ax
-        addl    %ecx,%eax
-        leal    1(%edi,%eax,2),%eax
-        { draw new cursor }
-        xorb    $0x7f,%fs:(%eax)
-
-        { unlock mouse }
-        movb    $0,mouselock
-
-.Ldont_draw:
-        popl    %edi
-        popl    %eax
-        popw    %fs
-.Lmouse_nocursor:
-        cmpb    MouseEventBufSize,PendingMouseEvents
-        je      .Lmouse_exit
-        movl    PendingMouseTail,%edi
-        movw    %bx,(%edi)
-        movw    %cx,2(%edi)
-        movw    %dx,4(%edi)
-        movw    $0,6(%edi)
-        addl    $8,%edi
-        leal    PendingMouseEvent,%eax
-        addl    MouseEventBufSize*8,%eax
-        cmpl    %eax,%edi
-        jne     .Lmouse_nowrap
-        leal    PendingMouseEvent,%edi
-.Lmouse_nowrap:
-        movl    %edi,PendingMouseTail
-        incb    PendingMouseEvents
-.Lmouse_exit:
-end;
-
-
-
-PROCEDURE Mouse_Trap; ASSEMBLER;
-ASM
-   PUSH %ES;                                          { Save ES register }
-   PUSH %DS;                                          { Save DS register }
-   PUSHL %EDI;                                        { Save register }
-   PUSHL %ESI;                                        { Save register }
-   { ; caution : ds is not the selector for our data !! }
-{$ifdef DEBUG}
-   MOVL  %EDI,%ES:EntryEDI
-   MOVL  %ESI,%ES:EntryESI
-   MOVW  %DS,%AX
-   MOVW  %AX,%ES:EntryDS
-   MOVW  %ES,%AX
-   MOVW  %AX,%ES:EntryES
-{$endif DEBUG}
- {  movw  %cs:v2prt0_ds_alias,%ax v2prt0 is not locked !!
-   movw  %ax,%ds
-   movw  %ax,%es }
-   PUSH %ES;                                          { Push data seg }
-   POP %DS;                                           { Load data seg }
-{$ifdef DEBUG}
-   incl callcounter
-   CMPL $ACTIONREGS,%edi
-   JE  .L_ActionRegsOK
-   INCL MouseError
-   JMP  .L_NoCallBack
-.L_ActionRegsOK:
-{$endif DEBUG}
-   MOVL MOUSECALLBACK, %EAX;                          { Fetch callback addr }
-   CMPL $0, %EAX;                                     { Check for nil ptr }
-   JZ .L_NoCallBack;                                  { Ignore if nil }
-   MOVL %EDI,%EAX;                                    { %EAX = @actionregs }
-   MOVL (%EAX), %EDI;                                 { EDI from actionregs }
-   MOVL 4(%EAX), %ESI;                                { ESI from actionregs }
-   MOVL 16(%EAX), %EBX;                               { EBX from actionregs }
-   MOVL 20(%EAX), %EDX;                               { EDX from actionregs }
-   MOVL 24(%EAX), %ECX;                               { ECX from actionregs }
-   MOVL 28(%EAX), %EAX;                               { EAX from actionregs }
-   CALL *MOUSECALLBACK;                               { Call callback proc }
-.L_NoCallBack:
-   POPL %ESI;                                         { Recover register }
-   POPL %EDI;                                         { Recover register }
-   POP %DS;                                           { Restore DS register }
-   POP %ES;                                           { Restore ES register }
-   {  This works for WinNT
-   movzwl %si,%eax
-   but CWSDPMI need this }
-   movl %esi,%eax
-   MOVL %ds:(%Eax), %EAX;
-   MOVL %EAX, %ES:42(%EDI);                           { Set as return addr }
-   ADDW $4, %ES:46(%EDI);                             { adjust stack }
-   IRET;                                              { Interrupt return }
-END;
-
-PROCEDURE Mouse_Trap_NT; ASSEMBLER;
-ASM
-   PUSH %ES;                                          { Save ES register }
-   PUSH %DS;                                          { Save DS register }
-   PUSHL %EDI;                                        { Save register }
-   PUSHL %ESI;                                        { Save register }
-   { ; caution : ds is not the selector for our data !! }
-{$ifdef DEBUG}
-   MOVL  %EDI,%ES:EntryEDI
-   MOVL  %ESI,%ES:EntryESI
-   MOVW  %DS,%AX
-   MOVW  %AX,%ES:EntryDS
-   MOVW  %ES,%AX
-   MOVW  %AX,%ES:EntryES
-{$endif DEBUG}
- {  movw  %cs:v2prt0_ds_alias,%ax v2prt0 is not locked !!
-   movw  %ax,%ds
-   movw  %ax,%es }
-   PUSH %ES;                                          { Push data seg }
-   POP %DS;                                           { Load data seg }
-{$ifdef DEBUG}
-   incl callcounter
-   CMPL $ACTIONREGS,%edi
-   JE  .L_ActionRegsOK
-   INCL MouseError
-   JMP  .L_NoCallBack
-.L_ActionRegsOK:
-{$endif DEBUG}
-   MOVL MOUSECALLBACK, %EAX;                          { Fetch callback addr }
-   CMPL $0, %EAX;                                     { Check for nil ptr }
-   JZ .L_NoCallBack;                                  { Ignore if nil }
-   MOVL %EDI,%EAX;                                    { %EAX = @actionregs }
-   MOVL (%EAX), %EDI;                                 { EDI from actionregs }
-   MOVL 4(%EAX), %ESI;                                { ESI from actionregs }
-   MOVL 16(%EAX), %EBX;                               { EBX from actionregs }
-   MOVL 20(%EAX), %EDX;                               { EDX from actionregs }
-   MOVL 24(%EAX), %ECX;                               { ECX from actionregs }
-   MOVL 28(%EAX), %EAX;                               { EAX from actionregs }
-   CALL *MOUSECALLBACK;                               { Call callback proc }
-.L_NoCallBack:
-   POPL %ESI;                                         { Recover register }
-   POPL %EDI;                                         { Recover register }
-   POP %DS;                                           { Restore DS register }
-   POP %ES;                                           { Restore ES register }
-   movzwl %si,%eax
-   MOVL %ds:(%Eax), %EAX;
-   MOVL %EAX, %ES:42(%EDI);                           { Set as return addr }
-   ADDW $4, %ES:46(%EDI);                             { adjust stack }
-   IRET;                                              { Interrupt return }
-END;
-
-Function Allocate_mouse_bridge : boolean;
-var
-  error : word;
-begin
-  ASM
-    LEAL ACTIONREGS, %EDI;                       { Addr of actionregs }
-    LEAL MOUSE_TRAP, %ESI;                       { Procedure address }
-    CMPB $0, UnderNT
-    JZ  .LGo32
-    LEAL MOUSE_TRAP_NT, %ESI;                       { Procedure address }
-  .LGo32:
-    PUSH %DS;                                    { Save DS segment }
-    PUSH %ES;                                    { Save ES segment }
-    MOVW v2prt0_ds_alias,%ES;                    { ES now has dataseg  alias that is never invalid }
-    PUSH %CS;
-    POP  %DS;                                    { DS now has codeseg }
-    MOVW $0x303, %AX;                            { Function id }
-    INT  $0x31;                                  { Call DPMI bridge }
-    JNC .L_call_ok;                              { Branch if ok }
-    POP  %ES;                                    { Restore ES segment }
-    POP  %DS;                                    { Restore DS segment }
-    MOVW $0,REALSEG;
-    MOVW $0,REALOFS;
-    JMP  .L_exit
-  .L_call_ok:
-    POP  %ES;                                    { Restore ES segment }
-    POP  %DS;                                    { Restore DS segment }
-    MOVW %CX,REALSEG;                            { Transfer real seg }
-    MOVW %DX,REALOFS;                            { Transfer real ofs }
-    MOVW $0, %AX;                                { Force error to zero }
-  .L_exit:
-    MOVW %AX, ERROR;                             { Return error state }
-  END;
-  Allocate_mouse_bridge:=error=0;
-end;
-
-Procedure Release_mouse_bridge;
-begin
-  ASM
-     MOVW $0x304, %AX;                            { Set function id }
-     MOVW REALSEG, %CX;                           { Bridged real seg }
-     MOVW REALOFS, %DX;                           { Bridged real ofs }
-     INT $0x31;                                   { Release bridge }
-     MOVW $0,REALSEG;
-     MOVW $0,REALOFS;
-  END;
-end;
-
-PROCEDURE Mouse_Action (Mask : Word; P : Pointer);
-VAR
-  Error : Word;
-  Rg    : TRealRegs;
-BEGIN
-  Error := 0;                                         { Preset no error }
-  If (P <> MouseCallBack) or (Mask<>CurrentMask) Then                        { Check func different }
-   Begin
-   { Remove old calback }
-     If (CurrentMask <> 0) Then
-      Begin
-        Rg.AX := 12;                                   { Function id }
-        Rg.CX := 0;                                    { Zero mask register }
-        Rg.ES := 0;                                    { Zero proc seg }
-        Rg.DX := 0;                                    { Zero proc ofs }
-        RealIntr($33, Rg);                             { Stop INT 33 callback }
-      End;
-     if RealSeg=0 then
-       error:=1;
-    { test addresses for Windows NT }
-    if (longint(@actionregs)>$ffff) {or
-       (longint(@mouse_trap)>$ffff)} then
-      begin
-         error:=1;
-      end
-    else If (P = Nil) Then
-     Begin
-       Mask := 0;                                    { Zero mask register }
-     End;
-    If (Error = 0) Then
-     Begin
-       MouseCallback := P;                            { Set call back addr }
-       if Mask<>0 then
-         begin
-           Rg.AX := 12;                                   { Set function id }
-           Rg.CX := Mask;                                 { Set mask register }
-           If Mask<>0 then
-             begin
-               Rg.ES := RealSeg;                              { Real mode segment }
-               Rg.DX := RealOfs;                              { Real mode offset }
-             end
-           else
-             begin
-               Rg.ES:=0;
-               Rg.DX:=0;
-             end;
-           RealIntr($33, Rg);                             { Set interrupt 33 }
-         end;
-       CurrentMask:=Mask;
-     End;
-   End;
-  If (Error <> 0) Then
-   Begin
-     Writeln('GO32V2 mouse handler set failed !!');
-     ReadLn;                                          { Wait for user to see }
-   End;
-END;
-
-
-{ We need to remove the mouse callback before exiting !! PM }
-
-const StoredExit : Pointer = Nil;
-      FirstMouseInitDone : boolean = false;
-
-procedure MouseSafeExit;
-begin
-  ExitProc:=StoredExit;
-  if MouseCallBack<>Nil then
-    Mouse_Action(0, Nil);
-  if not FirstMouseInitDone then
-    exit;
-  FirstMouseInitDone:=false;
-  Unlock_Code(Pointer(@Mouse_Trap), 400);            { Release trap code }
-  Unlock_Code(Pointer(@Mouse_Trap_NT), 400);            { Release trap code }
-  Unlock_Code(Pointer(@MouseInt), 400);               { Lock MouseInt code  }
-  Unlock_Data(ActionRegs, SizeOf(TRealRegs));        { Release registers }
-  UnLock_Data(MouseCallBack,SizeOf(Pointer));
-  { unlock Mouse Queue and related stuff ! }
-  Unlock_Data(PendingMouseEvent,
-        MouseEventBufSize*Sizeof(TMouseEvent));
-  Unlock_Data(PendingMouseTail,SizeOf(longint));
-  Unlock_Data(PendingMouseEvents,sizeof(byte));
-  Unlock_Data(MouseButtons,SizeOf(byte));
-  Unlock_Data(MouseWhereX,SizeOf(word));
-  Unlock_Data(MouseWhereY,SizeOf(word));
-  Unlock_Data(drawmousecursor,SizeOf(boolean));
-  Unlock_Data(mouseisvisible,SizeOf(boolean));
-  Unlock_Data(mouselock,SizeOf(boolean));
-  Unlock_Data(videoseg,SizeOf(word));
-  Unlock_Data(dosmemselector,SizeOf(word));
-  Unlock_Data(screenwidth,SizeOf(word));
-  Unlock_Data(OldMouseX,SizeOf(longint));
-  Unlock_Data(OldMouseY,SizeOf(longint));
-{$ifdef DEBUG}
-  Unlock_Data(EntryEDI, SizeOf(longint));
-  Unlock_Data(EntryESI, SizeOf(longint));
-  Unlock_Data(EntryDS, SizeOf(word));
-  Unlock_Data(EntryES, SizeOf(word));
-  Unlock_Data(MouseError, SizeOf(longint));
-  Unlock_Data(callcounter, SizeOf(longint));
-{$endif DEBUG}
-  Release_mouse_bridge;
-end;
-
-function RunningUnderWINNT: boolean;
-var r: trealregs;
-begin
-  fillchar(r,sizeof(r),0);
-  r.ax:=$3306;
-  realintr($21,r);
-  RunningUnderWINNT:=(r.bx=$3205);
-end;
-
-procedure InitMouse;
-begin
-  UnderNT:=RunningUnderWINNT;
-  if not MousePresent then
-    begin
-      if DetectMouse=0 then
-        begin
-          Writeln('No mouse driver found ');
-          exit;
-        end
-      else
-        MousePresent:=true;
-    end;
-  PendingMouseHead:=@PendingMouseEvent;
-  PendingMouseTail:=@PendingMouseEvent;
-  PendingMouseEvents:=0;
-  FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
-
-  { don't do this twice !! PM }
-
-  If not FirstMouseInitDone then
-    begin
-      StoredExit:=ExitProc;
-      ExitProc:=@MouseSafeExit;
-      Lock_Code(Pointer(@Mouse_Trap), 400);              { Lock trap code }
-      Lock_Code(Pointer(@Mouse_Trap_NT), 400);              { Lock trap code }
-      Lock_Code(Pointer(@MouseInt), 400);               { Lock MouseInt code  }
-      Lock_Data(ActionRegs, SizeOf(TRealRegs));          { Lock registers }
-      Lock_Data(MouseCallBack, SizeOf(pointer));
-      { lock Mouse Queue and related stuff ! }
-      Lock_Data(PendingMouseEvent,
-        MouseEventBufSize*Sizeof(TMouseEvent));
-      Lock_Data(PendingMouseTail,SizeOf(longint));
-      Lock_Data(PendingMouseEvents,sizeof(byte));
-      Lock_Data(MouseButtons,SizeOf(byte));
-      Lock_Data(MouseWhereX,SizeOf(word));
-      Lock_Data(MouseWhereY,SizeOf(word));
-      Lock_Data(drawmousecursor,SizeOf(boolean));
-      Lock_Data(mouseisvisible,SizeOf(boolean));
-      Lock_Data(mouselock,SizeOf(boolean));
-      Lock_Data(videoseg,SizeOf(word));
-      Lock_Data(dosmemselector,SizeOf(word));
-      Lock_Data(screenwidth,SizeOf(word));
-      Lock_Data(OldMouseX,SizeOf(longint));
-      Lock_Data(OldMouseY,SizeOf(longint));
-{$ifdef DEBUG}
-      Lock_Data(EntryEDI, SizeOf(longint));
-      Lock_Data(EntryESI, SizeOf(longint));
-      Lock_Data(EntryDS, SizeOf(word));
-      Lock_Data(EntryES, SizeOf(word));
-      Lock_Data(MouseError, SizeOf(longint));
-      Lock_Data(callcounter, SizeOf(longint));
-{$endif DEBUG}
-      Allocate_mouse_bridge;
-      FirstMouseInitDone:=true;
-    end;
-  If MouseCallBack=Nil then
-    Mouse_Action($ffff, @MouseInt);                    { Set masks/interrupt }
-  drawmousecursor:=false;
-  mouseisvisible:=false;
-  if (screenwidth>80) or (screenheight>50) then
-    DoCustomMouse(true);
-  ShowMouse;
-end;
-
-
-procedure DoneMouse;
-begin
-  HideMouse;
-  If (MouseCallBack <> Nil) Then
-    Mouse_Action(0, Nil);                            { Clear mask/interrupt }
-end;
-
-
-function DetectMouse:byte;assembler;
-asm
-        movl    $0x200,%eax
-        movl    $0x33,%ebx
-        int     $0x31
-        movw    %cx,%ax
-        orw     %ax,%dx
-        jz      .Lno_mouse
-        xorl    %eax,%eax
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-        orw     %ax,%ax
-        jz      .Lno_mouse
-        movl    %ebx,%eax
-.Lno_mouse:
-end;
-
-
-procedure ShowMouse;
-
-begin
-   if drawmousecursor then
-     begin
-        lockmouse;
-        if not(mouseisvisible) then
-          begin
-             oldmousex:=getmousex-1;
-             oldmousey:=getmousey-1;
-             mem[videoseg:(((screenwidth*oldmousey)+oldmousex)*2)+1]:=
-               mem[videoseg:(((screenwidth*oldmousey)+oldmousex)*2)+1] xor $7f;
-             mouseisvisible:=true;
-          end;
-        unlockmouse;
-     end
-   else
-     asm
-             cmpb    $1,MousePresent
-             jne     .LShowMouseExit
-             movl    $1,%eax
-             pushl   %ebp
-             int     $0x33
-             popl    %ebp
-     .LShowMouseExit:
-     end;
-end;
-
-
-procedure HideMouse;
-
-begin
-   if drawmousecursor then
-     begin
-        lockmouse;
-        if mouseisvisible then
-          begin
-             mouseisvisible:=false;
-             mem[videoseg:(((screenwidth*oldmousey)+oldmousex)*2)+1]:=
-               mem[videoseg:(((screenwidth*oldmousey)+oldmousex)*2)+1] xor $7f;
-             oldmousex:=-1;
-             oldmousey:=-1;
-          end;
-        unlockmouse;
-     end
-   else
-     asm
-             cmpb    $1,MousePresent
-             jne     .LHideMouseExit
-             movl    $2,%eax
-             pushl   %ebp
-             int     $0x33
-             popl    %ebp
-     .LHideMouseExit:
-     end;
-end;
-
-
-function GetMouseX:word;assembler;
-asm
-        cmpb    $1,MousePresent
-        jne     .LGetMouseXError
-        movl    $3,%eax
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-        movzwl  %cx,%eax
-        shrl    $3,%eax
-        incl    %eax
-        ret
-.LGetMouseXError:
-        xorl    %eax,%eax
-end;
-
-
-function GetMouseY:word;assembler;
-asm
-        cmpb    $1,MousePresent
-        jne     .LGetMouseYError
-        movl    $3,%eax
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-        movzwl  %dx,%eax
-        shrl    $3,%eax
-        incl    %eax
-        ret
-.LGetMouseYError:
-        xorl    %eax,%eax
-end;
-
-
-function GetMouseButtons:word;assembler;
-asm
-        cmpb    $1,MousePresent
-        jne     .LGetMouseButtonsError
-        movl    $3,%eax
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-        movw    %bx,%ax
-        ret
-.LGetMouseButtonsError:
-        xorl    %eax,%eax
-end;
-
-
-procedure SetMouseXY(x,y:word);assembler;
-asm
-        cmpb    $1,MousePresent
-        jne     .LSetMouseXYExit
-        movw    x,%cx
-        movw    y,%dx
-        movl    $4,%eax
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-.LSetMouseXYExit:
-end;
-
-Procedure SetMouseXRange (Min,Max:Longint);
-begin
-  If Not(MousePresent) Then Exit;
-  asm
-        movl    $7,%eax
-        movl    min,%ecx
-        movl    max,%edx
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-  end;
-end;
-
-Procedure SetMouseYRange (min,max:Longint);
-begin
-  If Not(MousePresent) Then Exit;
-  asm
-        movl    $8,%eax
-        movl    min,%ecx
-        movl    max,%edx
-        pushl   %ebp
-        int     $0x33
-        popl    %ebp
-  end;
-end;
-
-procedure DoCustomMouse(b : boolean);
-
-  begin
-     HideMouse;
-     lockmouse;
-     oldmousex:=-1;
-     oldmousey:=-1;
-     SetMouseXRange(0,(screenwidth-1)*8);
-     SetMouseYRange(0,(screenheight-1)*8);
-     if b then
-       begin
-          mouseisvisible:=false;
-          drawmousecursor:=true;
-       end
-     else
-       drawmousecursor:=false;
-     unlockmouse;
-  end;
-
-const
-  LastCallcounter : longint = 0;
-
-procedure GetMouseEvent(var MouseEvent: TMouseEvent);
-begin
-  if not MousePresent then
-    begin
-      Fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
-    end;
-{$ifdef DEBUG}
-  if mouseError>0 then
-    Writeln('Errors in mouse Handler ',MouseError);
-{$ifdef EXTMOUSEDEBUG}
-  if callcounter>LastCallcounter then
-    Writeln('Number of calls in mouse Handler ',Callcounter);
-{$endif EXTMOUSEDEBUG}
-  LastCallcounter:=Callcounter;
-{$endif DEBUG}
-  repeat until PendingMouseEvents>0;
-  MouseEvent:=PendingMouseHead^;
-  inc(PendingMouseHead);
-  if longint(PendingMouseHead)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
-   PendingMouseHead:=@PendingMouseEvent;
-  dec(PendingMouseEvents);
-  if (LastMouseEvent.x<>MouseEvent.x) or (LastMouseEvent.y<>MouseEvent.y) then
-   MouseEvent.Action:=MouseActionMove;
-  if (LastMouseEvent.Buttons<>MouseEvent.Buttons) then
-   begin
-     if (LastMouseEvent.Buttons=0) then
-      MouseEvent.Action:=MouseActionDown
-     else
-      MouseEvent.Action:=MouseActionUp;
-   end;
-  LastMouseEvent:=MouseEvent;
-end;
-
-
-function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
-begin
-  if PendingMouseEvents>0 then
-   begin
-     MouseEvent:=PendingMouseHead^;
-     PollMouseEvent:=true;
-   end
-  else
-   PollMouseEvent:=false;
-end;
-
-{
-  $Log$
-  Revision 1.3  2000-08-16 18:51:57  peter
-    * Fixes from Gabor (merged)
-
-  Revision 1.2  2000/07/13 11:32:24  michael
-  + removed logs
-
-}

+ 0 - 163
api/go32v2/vesamode.pas

@@ -1,163 +0,0 @@
-{
-   $Id$
-   VESA-Textmode support for the DOS version of the FPC API
-
-   Copyright (c) 1999 by Florian Klaempfl
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-}
-unit vesamode;
-
-  interface
-
-  implementation
-
-    uses
-       dos,go32,dpmiexcp,video,mouse;
-
-    type
-       twordarray = array[0..0] of word;
-
-       pwordarray = ^twordarray;
-       TVESAInfoBlock = record
-	 VESASignature   : ARRAY[0..3] OF CHAR;
-	 VESAVersion     : WORD;
-	 OEMStringPtr    : PChar;
-	 Capabilities    : LONGINT;
-	 VideoModePtr    : pwordarray;
-	 TotalMemory     : WORD;
-	 Reserved        : ARRAY[1..242] OF BYTE;
-       end;
-
-    function ReturnSuperVGAInfo(var ib : TVESAInfoBLock) : Word;
-
-      var
-	 regs : registers;
-
-      begin
-	 regs.ah:=$4f;
-	 regs.al:=0;
-	 regs.es:=tb_segment;
-	 regs.di:=tb_offset;
-	 intr($10,regs);
-	 dosmemget(tb_segment,tb_offset,ib,sizeof(ib));
-	 ReturnSuperVGAInfo:=regs.ax;
-      end;
-
-    function SetSuperVGAMode(m : word) : word;
-
-      var
-	 regs : registers;
-
-      begin
-	 regs.ah:=$4f;
-	 regs.al:=2;
-	 regs.bx:=m;
-	 intr($10,regs);
-	 SetSuperVGAMode:=regs.ax;
-      end;
-
-    function SetVESAMode(const VideoMode: TVideoMode; Params: Longint): Boolean;
-
-      var
-	 w : word;
-
-      begin
-	 w:=SetSuperVGAMode(Params);
-         if w<>$4f then
-	   SetVESAMode:=false
-	 else
-           begin
-              SetVESAMode:=true;
-              ScreenWidth:=VideoMode.Col;
-              ScreenHeight:=VideoMode.Row;
-              ScreenColor:=true;
-              // cheat to get a correct mouse
-              {
-              mem[$40:$84]:=ScreenHeight-1;
-              mem[$40:$4a]:=ScreenWidth;
-              memw[$40:$4c]:=ScreenHeight*((ScreenWidth shl 1)-1);
-              }
-              DoCustomMouse(true);
-           end;
-      end;
-
-var
-   infoblock : TVESAInfoBLock;
-   i : longint;
-   m : word;
-
-begin
-   ReturnSuperVGAInfo(infoblock);
-   if not((infoblock.VESASignature[0]<>'V') or
-      (infoblock.VESASignature[1]<>'E') or
-      (infoblock.VESASignature[2]<>'S') or
-      (infoblock.VESASignature[3]<>'A')) then
-     begin
-{$R-}
-   i:=0;
-   while true do
-     begin
-	dosmemget(hi(dword(infoblock.VideoModePtr)),lo(dword(infoblock.VideoModePtr))+i*2,m,2);
-	case m of
-           264:
-             RegisterVideoMode(80,60,true,@SetVESAMode,264);
-           265:
-             RegisterVideoMode(132,25,true,@SetVESAMode,265);
-           266:
-             RegisterVideoMode(132,43,true,@SetVESAMode,266);
-           267:
-             RegisterVideoMode(132,50,true,@SetVESAMode,267);
-           268:
-             RegisterVideoMode(132,60,true,@SetVESAMode,268);
-	   $ffff:
-	     break;
-	end;
-	inc(i);
-     end;
-   end;
-end.
-{
-  $Log$
-  Revision 1.1  2000-07-13 06:29:38  michael
-  + Initial import
-
-  Revision 1.3  2000/02/07 22:54:44  florian
-    * custommouse define removed, i.e. code is always active
-    * the xor value for the mouse cursor must be $7f instead of $ff
-
-  Revision 1.2  2000/02/06 14:29:45  florian
-    * mouse support for vesa resolutions under go32v2, needs currently the define
-      custommouse
-
-  Revision 1.1  2000/01/06 01:20:30  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.2  1999/12/23 22:37:38  pierre
-    * Use @SetVesaMode for normal FPC syntax
-    * variable I was not initialized in unit initialization!!
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.2  1999/03/14 17:43:02  florian
-    + 80x50 mode support added
-    * some bugs in VESA mode support removed
-
-  Revision 1.1  1999/03/13 17:29:39  florian
-    + first implementation for VESA 1.x, only standard modes are supported
-
-}

+ 0 - 314
api/go32v2/video.inc

@@ -1,314 +0,0 @@
-{
-  System independent low-level video interface for go32v2
-
-  $Id$
-}
-
-{$ASMMODE ATT}
-
-uses
-  mouse,
-  go32;
-
-
-procedure TargetEntry;
-begin
-end;
-
-procedure TargetExit;
-begin
-end;
-
-var
-  OldVideoBuf : PVideoBuf;
-
-  { used to know if LastCursorType is valid }
-const
-  InitVideoCalled : boolean = false;
-  LastCursorType : word = crUnderline;
-
-{ allways set blink state again }
-
-procedure SetHighBitBlink;
-var
-  regs : trealregs;
-begin
-  regs.ax:=$1003;
-  regs.bx:=$0001;
-  realintr($10,regs);
-end;
-
-function BIOSGetScreenMode(var Cols,Rows: word; var Color: boolean): boolean;
-var r: trealregs;
-    L: longint;
-    LSel,LSeg: word;
-    B: array[0..63] of byte;
-type TWord = word; PWord = ^TWord;
-var Size: word;
-    OK: boolean;
-begin
-  L:=global_dos_alloc(64);
-  LSeg:=(L shr 16);
-  LSel:=(L and $ffff);
-
-  r.ah:=$1b; r.bx:=0;
-  r.es:=LSeg; r.di:=0;
-  realintr($10,r);
-  OK:=(r.al=$1b);
-  if OK then
-  begin
-    dpmi_dosmemget(LSeg,0,B,64);
-    Cols:=PWord(@B[5])^; Rows:=B[$22];
-    Color:=PWord(@B[$27])^<>0;
-  end;
-  global_dos_free(LSel);
-  BIOSGetScreenMode:=OK;
-end;
-
-procedure InitVideo;
-var
-  regs : trealregs;
-begin
-  VideoSeg:=$b800;
-  if (ScreenWidth=$ffff) or (ScreenHeight=$ffff) or
-    (ScreenWidth=0) or (ScreenHeight=0) then
-    begin
-       ScreenColor:=true;
-       regs.ah:=$0f;
-       realintr($10,regs);
-       if (regs.al and 1)=0 then
-         ScreenColor:=false;
-       if regs.al=7 then
-         begin
-            ScreenColor:=false;
-            VideoSeg:=$b000;
-         end
-       else
-         VideoSeg:=$b800;
-       ScreenWidth:=regs.ah;
-       regs.ax:=$1130;
-       regs.bx:=0;
-       realintr($10,regs);
-       ScreenHeight:=regs.dl+1;
-       BIOSGetScreenMode(ScreenWidth,ScreenHeight,ScreenColor);
-    end;
-  regs.ah:=$03;
-  regs.bh:=0;
-  realintr($10,regs);
-  CursorLines:=regs.cl;
-  CursorX:=regs.dl;
-  CursorY:=regs.dh;
-  If InitVideoCalled then
-    Begin
-      FreeMem(VideoBuf,VideoBufSize);
-      FreeMem(OldVideoBuf,VideoBufSize);
-    End;
-{ allocate pmode memory buffer }
-  VideoBufSize:=ScreenWidth*ScreenHeight*2;
-  GetMem(VideoBuf,VideoBufSize);
-  GetMem(OldVideoBuf,VideoBufSize);
-  InitVideoCalled:=true;
-  SetHighBitBlink;
-  SetCursorType(LastCursorType);
-  { ClearScreen; removed here
-    to be able to catch the content of the monitor }
-end;
-
-
-procedure DoneVideo;
-begin
-  If InitVideoCalled then
-    Begin
-      LastCursorType:=GetCursorType;
-      ClearScreen;
-      SetCursorType(crUnderLine);
-      SetCursorPos(0,0);
-      FreeMem(VideoBuf,VideoBufSize);
-      VideoBuf:=nil;
-      FreeMem(OldVideoBuf,VideoBufSize);
-      OldVideoBuf:=nil;
-      InitVideoCalled:=false;
-      VideoBufSize:=0;
-    End;
-end;
-
-
-function GetCapabilities: Word;
-begin
-  GetCapabilities := $3F;
-end;
-
-
-procedure SetCursorPos(NewCursorX, NewCursorY: Word);
-var
-  regs : trealregs;
-begin
-  regs.ah:=$02;
-  regs.bh:=0;
-  regs.dh:=NewCursorY;
-  regs.dl:=NewCursorX;
-  realintr($10,regs);
-  CursorY:=regs.dh;
-  CursorX:=regs.dl;
-end;
-
-{ I don't know the maximum value for the scan line
-  probably 7 or 15 depending on resolution !!
-  }
-function GetCursorType: Word;
-var
-  regs : trealregs;
-begin
-  regs.ah:=$03;
-  regs.bh:=0;
-  realintr($10,regs);
-  GetCursorType:=crHidden;
-  if (regs.ch and $60)=0 then
-   begin
-     GetCursorType:=crBlock;
-     if (regs.ch and $1f)<>0 then
-      begin
-        GetCursorType:=crHalfBlock;
-        if regs.cl+1=(regs.ch and $1F) then
-         GetCursorType:=crUnderline;
-      end;
-   end;
-end;
-
-
-procedure SetCursorType(NewType: Word);
-var
-  regs : trealregs;
-const
-  MaxCursorLines = 7;
-begin
-  regs.ah:=$01;
-  regs.bx:=NewType;
-  case NewType of
-   crHidden    : regs.cx:=$2000;
-   crHalfBlock : begin
-                   regs.ch:=MaxCursorLines shr 1;
-                   regs.cl:=MaxCursorLines;
-                 end;
-   crBlock     : begin
-                   regs.ch:=0;
-                   regs.cl:=MaxCursorLines;
-                 end;
-   else          begin
-                   regs.ch:=MaxCursorLines-1;
-                   regs.cl:=MaxCursorLines;
-                 end;
-  end;
-  realintr($10,regs);
-end;
-
-
-function DefaultVideoModeSelector(const VideoMode: TVideoMode; Params: Longint): Boolean;
-type
-  wordrec=packed record
-    lo,hi : word;
-  end;
-var
-  regs : trealregs;
-begin
-  regs.ax:=wordrec(Params).lo;
-  regs.bx:=wordrec(Params).hi;
-  realintr($10,regs);
-  defaultvideomodeselector:=true;
-  DoCustomMouse(false);
-end;
-
-function VideoModeSelector8x8(const VideoMode: TVideoMode; Params: Longint): Boolean;
-type
-  wordrec=packed record
-    lo,hi : word;
-  end;
-var
-  regs : trealregs;
-begin
-  regs.ax:=3;
-  regs.bx:=0;
-  realintr($10,regs);
-  regs.ax:=$1112;
-  regs.bx:=$0;
-  realintr($10,regs);
-  videomodeselector8x8:=true;
-  ScreenColor:=true;
-  ScreenWidth:=80;
-  ScreenHeight:=50;
-  DoCustomMouse(false);
-end;
-
-procedure ClearScreen;
-begin
-  FillWord(VideoBuf^,VideoBufSize shr 1,$0720);
-  UpdateScreen(true);
-end;
-
-
-procedure UpdateScreen(Force: Boolean);
-begin
-  if LockUpdateScreen<>0 then
-   exit;
-  if not force then
-   begin
-     asm
-        movl    VideoBuf,%esi
-        movl    OldVideoBuf,%edi
-        movl    VideoBufSize,%ecx
-        shrl    $2,%ecx
-        repe
-        cmpsl
-        orl     %ecx,%ecx
-        jz      .Lno_update
-        movb    $1,force
-.Lno_update:
-     end;
-   end;
-  if Force then
-   begin
-{     dosmemput(videoseg,0,videobuf^,VideoBufSize);}
-      asm
-        pushw %es
-        pushl %edi
-        pushl %esi
-
-        xor  %edi, %edi
-        movw videoseg, %di
-        shll $0x4, %edi
-        movl videobuf, %esi
-        movl videobufsize, %ecx
-        movw %fs, %ax
-        movw %ax, %es
-        rep movsb
-
-        popl  %esi
-        popl  %edi
-        popw  %es
-      end ['EAX','ECX'];
-     move(videobuf^,oldvideobuf^,VideoBufSize);
-   end;
-end;
-
-
-procedure RegisterVideoModes;
-begin
-  RegisterVideoMode(40, 25, False,@DefaultVideoModeSelector, $00000000);
-  RegisterVideoMode(40, 25, True, @DefaultVideoModeSelector, $00000001);
-  RegisterVideoMode(80, 25, False,@DefaultVideoModeSelector, $00000002);
-  RegisterVideoMode(80, 25, True, @DefaultVideoModeSelector, $00000003);
-  RegisterVideoMode(80, 50, True, @VideoModeSelector8x8, 0);
-end;
-
-{
-  $Log$
-  Revision 1.4  2000-10-04 11:53:31  pierre
-   Add TargetEntry and TargetExit (merged)
-
-  Revision 1.3  2000/08/16 18:51:57  peter
-    * Fixes from Gabor (merged)
-
-  Revision 1.2  2000/07/13 11:32:24  michael
-  + removed logs
-
-}

+ 0 - 1
api/inc/Makefile.api

@@ -1 +0,0 @@
-APIOBJECTS=apicomm callspec video keyboard mouse filectrl filesys

+ 0 - 328
api/inc/apicomm.pas

@@ -1,328 +0,0 @@
-{****************************************************************************
-
-   $Id$
-
-   Common types, and definitions
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-   $Id$
- ****************************************************************************
-
- Changelog:
-
-   Common version 0.2.6
-
-   Date       Version  Who     Comments
-   07/12/97   0.1      Bazsi   Initial implementation (bazsi)
-   07/18/97   0.2      Bazsi   Linux specific error codes added
-   07/18/97   0.2.1    Bazsi   Some syntactical errors removed...
-   07/28/97   0.2.2    Bazsi   Base error code for Video registered
-   07/29/97   0.2.3    Bazsi   Some basic types added (PByte, PWord etc)
-   08/08/97   0.2.4    Bazsi   Finalized error handling code (Brad's code added)
-   08/27/97   0.2.5    Bazsi   BP doesn't like function types as return-values
-                               for functions, returning Pointer instead
-   09/06/97   0.2.6    Bazsi   Added base error code for Keyboard
-   11/06/97   0.2.7    Bazsi   Added base error code for FileCtrl
-
- Todo:
-
- *  Some types found in the DOS unit should be included here (TextRec maybe
-    renamed to TTextRec, FileRec etc.)
- *  Other platform specific error codes.
-
- ****************************************************************************}
-unit ApiComm;
-
-interface
-
-{$i platform.inc}
-
-const
-  { Error codes }
-  errOk                 = 0;
-  errVioBase            = 1000;
-  errKbdBase            = 1010;
-  errFileCtrlBase	= 1020;
-  errMouseBase          = 1030;
-  { The following ranges have been defined for error codes:
-     0      - 1000           OS dependent codes
-     1000   - 10000          API reserved codes
-     10000  -                Add-on unit errors
-    Before anyone adding a unit, contact [email protected] to assign a base
-    error code, to avoid collisions.
-
-    The symbolic names of error codes should be defined in the unit which uses
-    those error codes, except for OS dependent ones, which should be defined here
-    enclosed in IFDEFs. (The reason is that not always you can't always decide
-    which error-code belongs to one unit or the other) }
-
-{$IFDEF OS_Unix}
-  { for a more complete description of each error check /usr/include/asm/errno.h }
-  errNotPermitted         =   1;
-  errFileNotFound         =   2;
-  errNoSuchProcess        =   3;
-  errInterruptedCall      =   4;
-  errIOError              =   5;
-  errNoDevAddr            =   6;
-  errTooManyArguments     =   7;
-  errExecError            =   8;
-  errBadFileHandle        =   9;
-  errNoChild              =  10;
-  errTryAgain             =  11;
-  errWouldBlock           =  errTryAgain;
-  errOutOfMemory          =  12;
-  errNoPermission         =  13;
-  errInvalidAddress       =  14;  { Invalid pointer passed to kernel }
-  errNotBlockDev          =  15;
-  errDeviceBusy           =  16;
-  errFileExists           =  17;
-  errCrossDevice          =  18;
-  errNoSuchDev            =  19;
-  errNotDirectory         =  20;
-  errIsDirectory          =  21;
-  errInvalidArgument      =  22;
-  errFileTableOverflow    =  23;
-  errTooManyOpenFiles     =  24;
-  errNotATTY              =  25;
-  errTextBusy             =  26;
-  errFileTooLarge         =  27;
-  errDiskFull             =  28;
-  errIllegalSeek          =  29;
-  errReadOnlyFS           =  30;
-  errTooManyLinks         =  31;
-  errBrokenPipe		  =  32;
-  errMathDomain           =  33;  { Math domain error, what does this mean? }
-  errMathRange            =  34;  { Math result out of range }
-  errDeadLock             =  35;
-  errFileNameTooLong      =  36;
-  errNoLock               =  37;  { No record locks available }
-  errNotImplemented       =  38;  { Kernel function not implemented }
-  errDirNotEmpty          =  39;
-  errSymlinkLoop          =  40;
-  errNoMessage            =  41;  { ??? maybe the IPC getmsg call returns this }
-  { Here are some errors that are too cryptic for me, I think they are not used
-    under Linux, only on some mainframes (channel errors etc) }
-  errBadFont              =  59;
-  errNotStream            =  60;
-  errNoData               =  61;
-  errTimeOut              =  62;
-  errNoMoreStreams        =  63;
-  errNoNetwork            =  64;
-  errPackageNotInstalled  =  65; { ??? }
-  errRemote               =  66;
-  errSevereLink           =  67;
-  errAdvertise            =  68; { Advertise error??? }
-  errSrMount              =  69;
-  errCommunication        =  70; { Communication error on send? }
-  errProtocol             =  71; { Protocol error }
-  errMuiltiHop            =  72;
-  errDotDot               =  73; { RFS specific error ???}
-  errBadMessage           =  74; { Not a data message }
-  errOverflow             =  75;
-  errNotUnique            =  76; { Network name not unique }
-  errBadFileHandleState   =  77;
-  errRemoteChange         =  78; { Remote address changed }
-  errLibAccess            =  79; { Cannot access the needed shared lib }
-  errLibCorrupt           =  80; { Shared library corrupted }
-  errLibScn               =  81;
-  errLibTooMany           =  82; { Too many shared libraries }
-  errLibExec              =  83; { Attempting to execute a shared lib }
-  errIllegalSequence      =  84; { Illegal byte sequence ??? }
-  errRestart              =  85; { interrupted system call should be restarted }
-  errStreamPipe           =  86;
-  errTooManyUsers         =  87;
-  errNotSocket            =  88;
-  errDestAddrRequired     =  89;
-  errMessageTooLong       =  90;
-  errProtocolType         =  91;
-  errNoSuchProtocol       =  92;
-  errProtocolNotSupported =  93;
-  errSocketTypeNotSupported = 94;
-  errOperationNotSupported=  95;
-  errPFamilyNotSupported  =  96; { Protocol family not supported }
-  errAFamilyNotSupported  =  97; { Address family not supported }
-  errAddressInUse         =  98;
-  errAddressNotAvailable  =  99;
-  errNetDown              = 100;
-  errNetUnreachable       = 101;
-  errNetReset             = 102;
-  errConnAborted          = 103;
-  errConnReset            = 104;
-  errNoBufs               = 105;
-  errAlreadyConn          = 106;
-  errNotConn              = 107;
-  errShutdown             = 108;
-  errTooManyRefs          = 109;
-  errConnTimeOut          = 110;
-  errConnRefused          = 111;
-  errHostDown             = 112;
-  errNoRoute              = 113; { No route to host }
-  errOperationProgress    = 114; { Operation already in progress }
-  errStaleNFSHandle       = 115;
-  errStrucClean           = 116; { Structure needs cleaning ? }
-  { Xenix specific codes left out }
-  errRemoteIO             = 121;
-  errQuotaExceeded        = 122;
-{$ENDIF}
-{$IFDEF OS_DOS}
-  { DOS specific error-codes to be added }
-{$ENDIF}
-
-
-
-type
-{$IFDEF BIT_32}
-  CPUWord = Longint;
-  CPUInt = Longint;
-{$ELSE}
-  CPUWord = Word;
-  CPUInt = Integer;
-{$ENDIF}
-
-  PByte = ^Byte;
-  PWord = ^Word;
-  PLongint = ^Longint;
-
-{ This code is taken from Brad Williams code, with some modifications }
-type
-  TErrorHandlerReturnValue = (errRetry, errAbort, errContinue);
-  { errRetry = retry the operation,
-    errAbort = abort, return error code,
-    errContinue = abort, without returning errorcode }
-
-  TErrorHandler = function (Code: Longint; Info: Pointer): TErrorHandlerReturnValue;
-    { ErrorHandler is the standard procedural interface for all error functions.
-      Info may contain any data type specific to the error code passed to the
-      function. }
-
-function GetErrorCode: Longint;
-{ Returns the last error code, and resets it to 0 (errOK) }
-function GetErrorInfo: Pointer;
-{ Returns the info assigned to the previous error, doesn't reset the value to nil }
-{$IFDEF PPC_BP}
-function SetErrorHandler(AErrorHandler: TErrorHandler): Pointer;
-{$ELSE}
- {$IFDEF PPC_VIRTUAL}
-function SetErrorHandler(AErrorHandler: TErrorHandler): Pointer;
- {$ELSE}
-function SetErrorHandler(AErrorHandler: TErrorHandler): TErrorHandler;
- {$ENDIF}
-{$ENDIF}
-{ Sets ErrorHandler to AErrorHandler, and returns the old one }
-function DefaultErrorHandler(AErrorCode: Longint; AErrorInfo: Pointer): TErrorHandlerReturnValue;
-{ Default error handler, simply sets error code, and returns errContinue }
-
-const
-  ErrorCode: Longint = errOk;
-  ErrorInfo: Pointer = nil;
-  ErrorHandler: TErrorHandler = DefaultErrorHandler;
-
-implementation
-
-function GetErrorCode: Longint;
-begin
-  GetErrorCode := ErrorCode;
-  ErrorCode := 0;
-end;
-
-function GetErrorInfo: Pointer;
-begin
-  GetErrorInfo := ErrorInfo;
-end;
-
-{$IFDEF PPC_BP}
-function SetErrorHandler(AErrorHandler: TErrorHandler): Pointer;
-begin
-  SetErrorHandler := @ErrorHandler;
-  ErrorHandler := AErrorHandler;
-end;
-{$ELSE}
- {$IFDEF PPC_VIRTUAL}
-function SetErrorHandler(AErrorHandler: TErrorHandler): Pointer;
-begin
-  SetErrorHandler := @ErrorHandler;
-  ErrorHandler := AErrorHandler;
-end;
- {$ELSE}
-function SetErrorHandler(AErrorHandler: TErrorHandler): TErrorHandler;
-begin
-  SetErrorHandler := ErrorHandler;
-  ErrorHandler := AErrorHandler;
-end;
- {$ENDIF}
-{$ENDIF}
-
-function DefaultErrorHandler(AErrorCode: Longint; AErrorInfo: Pointer): TErrorHandlerReturnValue;
-begin
-  ErrorCode := AErrorCode;
-  ErrorInfo := AErrorInfo;
-  DefaultErrorHandler := errAbort; { return error code }
-end;
-
-end.
-{
-  $Log$
-  Revision 1.3  2000-11-14 11:07:18  pierre
-   * fix comment bug
-
-  Revision 1.2  2000/11/13 14:35:57  marco
-   * Unix Renamefest for defines.
-
-  Revision 1.1  2000/07/13 06:29:38  michael
-  + Initial import
-
-  Revision 1.2  2000/07/09 07:41:47  hajny
-    * changes needed for VP/2 to compile it
-
-  Revision 1.1  2000/02/29 11:43:16  pierre
-    Common renamed APIComm to avoid problems with free vision
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/12/23 19:36:47  peter
-    * place unitfiles in target dirs
-
-  Revision 1.1  1999/11/24 23:36:37  peter
-    * moved to packages dir
-
-  Revision 1.1  1998/12/04 12:48:24  peter
-    * moved some dirs
-
-  Revision 1.5  1998/10/28 00:02:05  peter
-    + mouse
-    + video.clearscreen, video.videobufsize
-
-  Revision 1.4  1998/10/26 11:22:48  peter
-    * updates
-
-
-   Date       Version  Who     Comments
-   07/12/97   0.1      Bazsi   Initial implementation (bazsi)
-   07/18/97   0.2      Bazsi   Linux specific error codes added
-   07/18/97   0.2.1    Bazsi   Some syntactical errors removed...
-   07/28/97   0.2.2    Bazsi   Base error code for Video registered
-   07/29/97   0.2.3    Bazsi   Some basic types added (PByte, PWord etc)
-   08/08/97   0.2.4    Bazsi   Finalized error handling code (Brad's code added)
-   08/27/97   0.2.5    Bazsi   BP doesn't like function types as return-values
-                               for functions, returning Pointer instead
-   09/06/97   0.2.6    Bazsi   Added base error code for Keyboard
-   11/06/97   0.2.7    Bazsi   Added base error code for FileCtrl
-}

+ 0 - 358
api/inc/callspec.pas

@@ -1,358 +0,0 @@
-{
-   $Id$
-
-   This unit provides compiler-independent mechanisms to call special
-   functions, i.e. local functions/procedures, constructors, methods,
-   destructors, etc. As there are no procedural variables for these
-   special functions, there is no Pascal way to call them directly.
-
-   Copyright (c) 1997 Matthias K"oppe <[email protected]>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-unit CallSpec;
-
-{
-  As of this version, the following compilers are supported. Please
-  port CallSpec to other compilers (including earlier versions) and
-  send your code to the above address.
-
-  Compiler                    Comments
-  --------------------------- -------------------------------------
-  Turbo Pascal 6.0
-  Borland/Turbo Pascal 7.0
-  FPC Pascal 0.99.8
-}
-
-interface
-
-{$i platform.inc}
-
-{
-  The frame pointer points to the local variables of a procedure.
-  Use CurrentFramePointer to address the locals of the current procedure;
-  use PreviousFramePointer to addess the locals of the calling procedure.
-}
-type
-{$ifdef BIT_16}
-   FramePointer = Word;
-{$endif}
-{$ifdef BIT_32}
-   FramePointer = pointer;
-{$endif}
-
-function CurrentFramePointer: FramePointer;
-function PreviousFramePointer: FramePointer;
-
-{ This version of CallSpec supports four classes of special functions.
-  (Please write if you need other classes.)
-  For each, two types of argument lists are allowed:
-
-  `Void' indicates special functions with no explicit arguments.
-    Sample: constructor T.Init;
-  `Pointer' indicates special functions with one explicit pointer argument.
-    Sample: constructor T.Load(var S: TStream);
-}
-
-{ Constructor calls.
-
-  Ctor     Pointer to the constructor.
-  Obj      Pointer to the instance. NIL if new instance to be allocated.
-  VMT      Pointer to the VMT (obtained by TypeOf()).
-  returns  Pointer to the instance.
-}
-function CallVoidConstructor(Ctor: pointer; Obj: pointer; VMT: pointer): pointer;
-function CallPointerConstructor(Ctor: pointer; Obj: pointer; VMT: pointer; Param1: pointer): pointer;
-
-{ Method calls.
-
-  Method   Pointer to the method.
-  Obj      Pointer to the instance. NIL if new instance to be allocated.
-  returns  Pointer to the instance.
-}
-function CallVoidMethod(Method: pointer; Obj: pointer): pointer;
-function CallPointerMethod(Method: pointer; Obj: pointer; Param1: pointer): pointer;
-
-{ Local-function/procedure calls.
-
-  Func     Pointer to the local function (which must be far-coded).
-  Frame    Frame pointer of the wrapping function.
-}
-
-function CallVoidLocal(Func: pointer; Frame: FramePointer): pointer;
-function CallPointerLocal(Func: pointer; Frame: FramePointer; Param1: pointer): pointer;
-
-{ Calls of functions/procedures local to methods.
-
-  Func     Pointer to the local function (which must be far-coded).
-  Frame    Frame pointer of the wrapping method.
-  Obj      Pointer to the object that the method belongs to.
-}
-function CallVoidMethodLocal(Func: pointer; Frame: FramePointer; Obj: pointer): pointer;
-function CallPointerMethodLocal(Func: pointer; Frame: FramePointer; Obj: pointer; Param1: pointer): pointer;
-
-
-implementation
-
-{$ifdef PPC_FPC}
-
-{$ASMMODE ATT}
-
-{ This indicates an FPC version which uses the same call scheme for
-  method-local and procedure-local procedures, but which expects the
-  ESI register be loaded with the Self pointer in method-local procs. }
-
-type
-  VoidLocal = function(_EBP: FramePointer): pointer;
-  PointerLocal = function(_EBP: FramePointer; Param1: pointer): pointer;
-  VoidMethodLocal = function(_EBP: FRAMEPOINTER): pointer;
-  PointerMethodLocal = function(_EBP: FRAMEPOINTER; Param1: pointer): pointer;
-  VoidConstructor = function(VMT: pointer; Obj: pointer): pointer;
-  PointerConstructor = function(VMT: pointer; Obj: pointer; Param1: pointer): pointer;
-  VoidMethod = function(Obj: pointer): pointer;
-  PointerMethod = function(Obj: pointer; Param1: pointer): pointer;
-
-
-function CallVoidConstructor(Ctor: pointer; Obj: pointer; VMT: pointer): pointer;
-begin
-  { load the object pointer }
-  asm
-        movl Obj, %esi
-  end;
-  CallVoidConstructor := VoidConstructor(Ctor)(VMT, Obj)
-end;
-
-
-function CallPointerConstructor(Ctor: pointer; Obj: pointer; VMT: pointer; Param1: pointer): pointer;
-begin
-  { load the object pointer }
-  asm
-        movl Obj, %esi
-  end;
-  CallPointerConstructor := PointerConstructor(Ctor)(VMT, Obj, Param1)
-end;
-
-
-function CallVoidMethod(Method: pointer; Obj: pointer): pointer;
-begin
-  { load the object pointer }
-  asm
-        movl Obj, %esi
-  end;
-  CallVoidMethod := VoidMethod(Method)(Obj)
-end;
-
-
-function CallPointerMethod(Method: pointer; Obj: pointer; Param1: pointer): pointer;
-begin
-  { load the object pointer }
-  asm
-        movl Obj, %esi
-  end;
-  CallPointerMethod := PointerMethod(Method)(Obj, Param1)
-end;
-
-
-function CallVoidLocal(Func: pointer; Frame: FramePointer): pointer;
-begin
-  CallVoidLocal := VoidLocal(Func)(Frame)
-end;
-
-
-function CallPointerLocal(Func: pointer; Frame: FramePointer; Param1: pointer): pointer;
-begin
-  CallPointerLocal := PointerLocal(Func)(Frame, Param1)
-end;
-
-
-function CallVoidMethodLocal(Func: pointer; Frame: FramePointer; Obj: pointer): pointer;
-begin
-  { load the object pointer }
-  asm
-        movl Obj, %esi
-  end;
-  CallVoidMethodLocal := VoidMethodLocal(Func)(Frame)
-end;
-
-
-function CallPointerMethodLocal(Func: pointer; Frame: FramePointer; Obj: pointer; Param1: pointer): pointer;
-begin
-  { load the object pointer }
-  asm
-        movl Obj, %esi
-  end;
-  CallPointerMethodLocal := PointerMethodLocal(Func)(Frame, Param1)
-end;
-
-
-function CurrentFramePointer: FramePointer;assembler;
-asm
-    movl %ebp,%eax
-end ['EAX'];
-
-
-function PreviousFramePointer: FramePointer;assembler;
-asm
-    movl (%ebp), %eax
-end ['EAX'];
-
-{$endif PPC_FPC}
-
-
-{$ifdef PPC_BP}
-type
-  VoidConstructor = function(VmtOfs: Word; Obj: pointer): pointer;
-  PointerConstructor = function(Param1: pointer; VmtOfs: Word; Obj: pointer): pointer;
-  VoidMethod = function(Obj: pointer): pointer;
-  PointerMethod = function(Param1: pointer; Obj: pointer): pointer;
-
-function CallVoidConstructor(Ctor: pointer; Obj: pointer; VMT: pointer): pointer;
-begin
-  CallVoidConstructor := VoidConstructor(Ctor)(Ofs(VMT^), Obj)
-end;
-
-
-function CallPointerConstructor(Ctor: pointer; Obj: pointer; VMT: pointer; Param1: pointer): pointer;
-begin
-  CallPointerConstructor := PointerConstructor(Ctor)(Param1, Ofs(VMT^), Obj)
-end;
-
-
-function CallVoidMethod(Method: pointer; Obj: pointer): pointer;
-begin
-  CallVoidMethod := VoidMethod(Method)(Obj)
-end;
-
-
-function CallPointerMethod(Method: pointer; Obj: pointer; Param1: pointer): pointer;
-begin
-  CallPointerMethod := PointerMethod(Method)(Param1, Obj)
-end;
-
-
-function CallVoidLocal(Func: pointer; Frame: FramePointer): pointer; assembler;
-asm
-{$IFDEF Windows}
-        MOV     AX,[Frame]
-        AND     AL,0FEH
-        PUSH    AX
-{$ELSE}
-        push    [Frame]
-{$ENDIF}
-        call    dword ptr Func
-end;
-
-
-function CallPointerLocal(Func: pointer; Frame: FramePointer; Param1: pointer): pointer; assembler;
-asm
-        mov     ax, word ptr Param1
-        mov     dx, word ptr Param1+2
-        push    dx
-        push    ax
-{$IFDEF Windows}
-        MOV     AX,[Frame]
-        AND     AL,0FEH
-        PUSH    AX
-{$ELSE}
-        push    [Frame]
-{$ENDIF}
-        call    dword ptr Func
-end;
-
-
-function CallVoidMethodLocal(Func: pointer; Frame: FramePointer; Obj: pointer): pointer; assembler;
-asm
-{$IFDEF Windows}
-        MOV     AX,[Frame]
-        AND     AL,0FEH
-        PUSH    AX
-{$ELSE}
-        push    [Frame]
-{$ENDIF}
-        call    dword ptr Func
-end;
-
-
-function CallPointerMethodLocal(Func: pointer; Frame: FramePointer; Obj: pointer; Param1: pointer): pointer; assembler;
-asm
-        mov     ax, word ptr Param1
-        mov     dx, word ptr Param1+2
-        push    dx
-        push    ax
-{$IFDEF Windows}
-        MOV     AX,[Frame]
-        AND     AL,0FEH
-        PUSH    AX
-{$ELSE}
-        push    [Frame]
-{$ENDIF}
-        call    dword ptr Func
-end;
-
-
-function CurrentFramePointer: FramePointer; assembler;
-asm
-        mov     ax, bp
-end;
-
-
-function PreviousFramePointer: FramePointer; assembler;
-asm
-        mov     ax, ss:[bp]
-end;
-
-{$endif PPC_BP}
-
-
-end.
-{
-  $Log$
-  Revision 1.1  2000-07-13 06:29:38  michael
-  + Initial import
-
-  Revision 1.1  2000/01/06 01:20:30  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/12/23 19:36:47  peter
-    * place unitfiles in target dirs
-
-  Revision 1.1  1999/11/24 23:36:37  peter
-    * moved to packages dir
-
-  Revision 1.2  1998/12/16 21:57:16  peter
-    * fixed currentframe,previousframe
-    + testcall to test the callspec unit
-
-  Revision 1.1  1998/12/04 12:48:24  peter
-    * moved some dirs
-
-  Revision 1.5  1998/12/04 09:53:44  peter
-    * removed objtemp global var
-
-  Revision 1.4  1998/11/24 17:14:24  peter
-    * fixed esi loading
-
-
-  Date       Version  Who     Comments
-  ---------- -------- ------- -------------------------------------
-  19-Sep-97  0.1      mkoeppe Initial version.
-  22-Sep-97  0.11     fk      0.9.3 support added, self isn't expected
-                              on the stack in local procedures of methods
-  23-Sep-97  0.12     mkoeppe Cleaned up 0.9.3 conditionals.
-  03-Oct-97  0.13     mkoeppe Fixed esi load in FPC 0.9
-  22-Oct-98  0.14     pfv     0.99.8 support for FPC
-}

+ 0 - 210
api/inc/filectrl.pas

@@ -1,210 +0,0 @@
-{
-   $Id$
-
-   System independent low-level file interface
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-unit FileCtrl;
-
-interface
-{$I platform.inc}
-
-uses
-  ApiComm, FileSys;
-
-{ The following platforms are supported
-    OS/2 either 1.x, or 2.x
-    Linux
-    DOS  16 bit, DPMI, Windows 3.1
-    Win32
-}
-
-const
-{ standard file handles under DOS, under linux only stdin, stdout and strerr
-  is defined }
-  stdin         = 0;
-  stdout        = 1;
-  stderr        = 2;
-  stdaux        = 3;
-  stdprn        = 4;
-
-  { file access constants }
-  filRead       = 0;
-  filWrite      = 1;
-  filReadWrite  = 2;
-
-  { seek constants }
-  skBeg         = 0;
-  skCur         = 1;
-  skEnd         = 2;
-
-  FilePerms: Word = $1A4;  { rw-r--r-- }
-
-type
-{$IFDEF BIT_16}
-  TFileHandle = Word;
-{$ELSE}
-  TFileHandle = Longint;
-{$ENDIF}
-
-{ System independent calls }
-{ All of these functions do what their name imply, set ErrorCode (in Common)
-  to the returned error. }
-
-{ Under linux, I'll use FilePerms as permissions, instead of expecting an
-  additional parameter }
-
-{$IFDEF PPC_Feature_Overriding}
-function OpenFile(FName: PChar; Flags: Longint): TFileHandle;
-function CreateFile(FName: PChar): TFileHandle;
-procedure DeleteFile(FName: PChar); { should be moved to FileSys }
-{$ENDIF}
-function OpenFileStr(FName: PChar; Flags: Longint): TFileHandle;
-function CreateFileStr(FName: PChar): TFileHandle;
-procedure DeleteFileStr(FName: PChar); { should be moved to FileSys }
-
-function OpenFile(FName: TFileName; Flags: Longint): TFileHandle;
-function CreateFile(FName: TFileName): TFileHandle;
-procedure DeleteFile(FName: TFileName);
-
-procedure CloseFile(Handle: TFileHandle);
-function SeekFile(Handle: TFileHandle; Pos: TFileInt; SeekType: Word): TFileInt;
-function ReadFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-function WriteFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-procedure FlushFile(Handle: TFileHandle);
-procedure TruncateFile(Handle: TFileHandle);
-function EndOfFile(Handle: TFileHandle): Boolean;
-function FilePos(Handle: TFileHandle): TFileInt;
-function FileSize(Handle: TFileHandle): TFileInt;
-
-procedure CopyFile(F1, F2: TFileHandle; Length: TFileInt);
-
-implementation
-
-{ Include system dependent part }
-{$i filectrl.inc}
-
-function OpenFile(FName: TFileName; Flags: Longint): TFileHandle;
-begin
-  FName := FName + #0;
-  OpenFile := OpenFileStr(@FName[1], Flags);
-end;
-
-function CreateFile(FName: TFileName): TFileHandle;
-begin
-  FName := FName+#0;
-  CreateFile := CreateFileStr(@FName[1]);
-end;
-
-procedure DeleteFile(FName: TFileName);
-begin
-  FName := FName + #0;
-  DeleteFileStr(@FName[1]);
-end;
-
-{$IFDEF PPC_Feature_Overriding}
-function OpenFile(FName: PChar; Flags: Longint): TFileHandle;
-begin
-  OpenFile := OpenFileStr(FName, Flags);
-end;
-
-function CreateFile(FName: PChar): TFileHandle;
-begin
-  CreateFile := CreateFileStr(FName);
-end;
-
-procedure DeleteFile(FName: PChar);
-begin
-  DeleteFileStr(FName);
-end;
-{$ENDIF}
-
-
-procedure CopyFile(F1, F2: TFileHandle; Length: TFileInt);
-var
-  Buf: array [0..1023] of Byte;
-  Len: Word;
-begin
-  while (ErrorCode = 0) and (Length <> 0) do begin
-    if Length < 1024 then Len := Length else Len := 1024;
-    Len := ReadFile(F1, Buf, Len);
-    WriteFile(F2, Buf, Len);
-    Dec(Length, Len);
-  end;
-end;
-
-end.
-{
-  $Log$
-  Revision 1.2  2000-12-17 20:40:25  hajny
-    * OS/2 implementation corrected and finished
-
-  Revision 1.1  2000/07/13 06:29:38  michael
-  + Initial import
-
-  Revision 1.2  2000/02/29 11:43:16  pierre
-    Common renamed APIComm to avoid problems with free vision
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/12/23 19:36:47  peter
-    * place unitfiles in target dirs
-
-  Revision 1.1  1999/11/24 23:36:37  peter
-    * moved to packages dir
-
-  Revision 1.3  1999/04/13 09:29:44  daniel
-  * Reverted a terrible mistake
-
-  Revision 1.1  1998/12/04 12:48:24  peter
-    * moved some dirs
-
-  Revision 1.6  1998/10/26 11:22:49  peter
-    * updates
-
-
-   Date       Version  Who     Comments
-   07/06/97   0.1      bazsi   Initial implementation
-                               many of the platforms implemented, but not
-                               tested at all
-   07/07/97   0.1.1    bazsi   Some changes suggested by Marco Schmidt
-                               (TFileInt)
-                               Tested under Linux (FPC) and DOS (BP).
-   07/12/97   0.1.2    bazsi   Converted to the new error-handling scheme,
-                               began adding error codes, but this will be
-                               changed (!)
-   07/18/97   0.2      bazsi   Error codes moved to common
-   07/18/97   0.2.1    bazsi   Corrected some syntactical errors (haven't
-                               checked before uploading...)
-   07/19/97   0.2.2    bazsi   Overriden versions using Pascal style strings
-   07/19/97   0.3      bazsi   EndOfFile, TruncateFile added, FlushFile
-                               implemented on Linux, DOS
-   07/28/97   0.3.1    bazsi   Corrected some DOS 16 bit bugs (setting ErrorCode)
-   08/07/97   0.3.2    bazsi   renamed to .PAS
-                               PChar versions are named xxxxStr, overriden
-                               versions are provided if PPC_Feature_Overriding is
-                               defined (the Str versions are provided in both cases)
-   08/24/97   0.3.3    bazsi   FileSys added to uses clause
-
-   04/15/98   0.3.4    Michael Updated Linux implementation.
-   05/05/98   0.3.5    mkoeppe Fixed ReadFile, WriteFile return value in Linux.
-
-}

+ 0 - 1113
api/inc/filesys.pas

@@ -1,1113 +0,0 @@
-{
-   $Id$
-
-   Unit to access the file system
-   All file operations except those on open files (see FileCtrl for that)
-
-   Copyright by Marco Schmidt <[email protected]>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-unit FileSys;
-
-interface
-
-{$I platform.inc} { Conditional directives :
-                    compiler, operating system }
-
-uses
-  ApiComm          { Error handling }
-
-{$IFDEF PPC_FPC}
-  , Strings
-{$ENDIF}
-
-{$IFDEF OS_DOS}
-  , DOS           { GetFAttr, GetFTime, FindFirst, FindNext, ... }
-{$else not OS_DOS}
- {$ifdef PPC_FPC}
-  {$ifdef OS_WINDOWS}
-  {$define OS_DOS}
-  , DOS
-  {$endif OS_WIN32}
-  {$IFDEF OS_OS2}
-  {$DEFINE OS_DOS}
-  , DOS
-  {$ENDIF OS_OS2}
- {$endif PPC_FPC}
-{$ENDIF}
-
-{$IFDEF OS_Unix}
-  , linux
-{$ENDIF}
-  ;
-
-
-const
-
-  { Maximum length of a file name (must be <= 255, for we use
-    standard Pascal strings) }
-  MaxNameLength = {$IFDEF PPC_BP}
-                  79;
-                  {$ELSE}
-                  255;
-                  {$ENDIF}
-
-  { Character to separate directories in a path }
-  PathSeparator = {$IFDEF OS_Unix}
-                  '/';
-                  {$ELSE}
-                  '\';
-                  {$ENDIF}
-
-  { Defines if a character is inserted into a number string every three
-    digits;
-    true :  returns "3,555,234"
-    false : returns "3555234" }
-  SeparateThousands : Boolean = true;
-
-  { Character to be used to separate three digits in FileIntToString }
-  ThousandsSeparator : Char = ',';
-
-  { "CheckName" function return values }
-  cnUnknown     = 0;
-  cnFile        = 1;
-  cnDirectory   = 2;
-
-  { File attribute bit masks }
-
-  faReadOnly    = $0001;
-  faSystem      = $0002;
-  faHidden      = $0004;
-  faVolumeID    = $0008;
-  faDirectory   = $0010;
-  faArchive     = $0020;
-  faAnyFile     = faReadOnly or
-                  faSystem or
-                  faHidden or
-                  faVolumeID or
-                  faDirectory or
-                  faArchive;      { = $003f }
-
-  { Wildcard characters for use with "ContainsWildcards" }
-
-  NumWildcardChars = 2;
-  WildcardChars : Array[0..NumWildcardChars-1] of Char =
-      ('*', '?');
-
-type
-  { file attribute type }
-  TFileAttr = {$IFDEF PPC_BP}
-              Word;               { DOS: RSHVAD }
-              {$ELSE}
-              Longint;            { Any other OS }
-              {$ENDIF}
-
-  { Stores date and time in a system-independent way }
-  TDateTime = packed record
-    DOW    : Byte; { 0=Sunday, 1=Monday, ... }
-    Day    : Byte; { 1..31 }
-    Month  : Byte; { 1..12 }
-    Year   : Word; { 1601..3999 }
-    IsLeap : Boolean; { is "Year" a leap year ? }
-    Hour   : Byte; { 0..23 }
-    Minute : Byte; { 0..59 }
-    Second : Byte; { 0..59 }
-    Valid  : Boolean; { set by "CheckDateTime" }
-  end;
-
-  { Stores file size & offset values;
-    may have to be changed for other environments }
-  TFileInt  = Longint; { 32 bit signed, as we have no unsigned 32 bit type }
-
-  { directory / file name }
-  TFileName = String[MaxNameLength];
-
-  { record to describe a file or directory entry;
-    used in combination with a file search }
-  TFileDescriptor = packed record
-    { fields available for all platforms }
-    Attr             : TFileAttr;
-    IsDirectory      : Boolean;
-    LastModification : TDateTime;
-    Name             : TFileName;
-    Size             : TFileInt;
-    { platform-specific fields }
-    {$IFDEF OS_Unix}
-    Created          : TDateTime;
-    LastAccessed     : TDateTime;
-    {$ENDIF OS_Unix}
-  end;
-
-  { Search record declaration for FPC for DOS (we're not using the DOS unit
-    that provides SearchRec) }
-
-  {$IFDEF PPC_FPC}
-    {$IFDEF OS_DOS}
-
-    type
-      TDOSSearchRec = packed record
-        Fill:     Array[1..21] of Byte;
-        Attr:     Byte;
-        Time:     Longint;
-        Reserved: Word; { requires the DOS extender (DJ GNU-C) }
-        Size:     Longint;
-        Name:     String[15]; { the same size as declared by (DJ GNU C) }
-      end;
-
-    {$ENDIF OS_DOS}
-  {$ENDIF PPC_FPC}
-
-  { File search record to be used with
-    StartSearch, ContinueSearch and TerminateSearch }
-
-  TFileSearch = packed record
-    { Input fields for all platforms }
-    Specs   : TFileName;
-    { OS-specific input fields }
-    {$IFDEF OS_DOS}
-    Attr    : TFileAttr;
-    {$ENDIF}
-
-    { Output fields for all platforms }
-    FD      : TFileDescriptor;
-    Success : Boolean;
-
-    { OS-specific output fields }
-
-    {$IFDEF OS_Unix}
-    GL : PGlob;
-    {$ELSE OS_Unix}
-    SR      : DOS.SearchRec;
-    {$ENDIF OS_Unix}
-  end;
-
-procedure CheckDateTime(var DT: TDateTime);
-function  CheckName(AName: TFileName): Byte;
-function  ContainsWildcards(AName: TFileName): Boolean;
-procedure ContinueSearch(var FS: TFileSearch);
-procedure CreateDir(AName: TFileName);
-function  DateToString(const DT: TDateTime): String;
-procedure DeleteDir(AName: TFileName);
-procedure DeleteFile(AName: TFileName);
-function  EqualNames(Name1, Name2: TFileName): Boolean;
-function  Exists(AName: TFileName): Boolean;
-function  ExpandName(AName: TFileName): TFileName;
-function  FileAttrToString(AFileAttr: TFileAttr): String;
-function  FileIntToString(FI: TFileInt): String;
-function  GetCurrentDir: TFileName;
-procedure GetFAttr(AName: TFileName; var Attr: TFileAttr);
-procedure GetFTime(AName: TFileName; var DT: TDateTime);
-function  IsValidName(AName: TFileName) : Boolean;
-procedure RenameDir(OldName, NewName: TFileName);
-procedure RenameFile(OldName, NewName: TFileName);
-procedure SetCurrentDir(AName: TFileName);
-procedure SetFAttr(AName: TFileName; AFileAttr: TFileAttr);
-procedure SetFTime(AName: TFileName; DT: TDateTime);
-procedure SplitName(AName: TFileName; var Path, RawName, Extension: TFileName);
-procedure StartSearch(var FS: TFileSearch);
-procedure TerminateSearch(var FS: TFileSearch);
-function  TimeToString(DT: TDateTime): String;
-
-implementation
-
-{ Structure of the implementation section
-  ---------------------------------------
-  - proc. & functions that do not appear in the interface section and
-    are the same for all platforms
-  - proc. & functions that do appear in the interface section and
-    are the same for all platforms
-  - proc. & functions that do not appear in the interface section and
-    are DOS-specific
-  - proc. & functions that do appear in the interface section and
-    are not the same for all platforms
-}
-
-{ procedures and functions that do not appear in the interface section and
-  are the same for all platforms }
-
-function weekday(y,m,d : longint) : longint;
-
-{ Calculates th day of the week. Florian provided this.
-  returns -1 on error }
-
-    var
-       century_offset : integer;
-       temp : longint;
-       _is_leap_year : boolean;
-
-    const
-       month_table : array[1..12] of longint = (1,4,4,0,2,5,0,3,6,1,4,6);
-
-  function is_leap_year(y : longint) : boolean;
-
-    begin
-       if (y mod 100)=0 then
-         is_leap_year:=((y mod 400)=0)
-       else
-         is_leap_year:=(y mod 4)=0;
-    end;
-
-  { Beginning of weekday }
-  begin
-       if (m<1) or (m>12) then
-         begin
-            weekday:=-1;
-            exit;
-         end;
-       case y of
-          1700..1799 : century_offset:=4;
-          1800..1899 : century_offset:=2;
-          1900..1999 : century_offset:=0;
-          2000..2099 : century_offset:=-1;
-          else
-            begin
-               if (y>=2100) then
-                 begin
-                 end;
-               weekday:=-1;
-               exit;
-            end;
-       end;
-       _is_leap_year:=is_leap_year(y);
-       y:=y mod 100;
-       temp:=(y div 12)+(y mod 12)+((y mod 12) div 4);
-       temp:=temp mod 7;
-       temp:=(temp+month_table[m]+d) mod 7;
-       { do some corrections for special years }
-       { other century ? }
-       inc(temp,century_offset);
-       { leap year correction }
-       if _is_leap_year and (m<3) then
-         dec(temp);
-       { now is sonday 1, but should be for example 0 }
-       dec(temp);
-       { the result could be less than zero }
-       while temp<0 do
-         inc(temp,7);
-       weekday:=temp mod 7;
-    end;
-
-
-{ Returns Longint value as String }
-function LongToStr(L: Longint): String;
-var
-  S: String[20];
-begin
-  System.Str(L, S);
-  LongToStr := S;
-end;
-
-{ Returns Longint value as String, adding a leading '0' character if value
-  is >= 0 and <= 9 (LZ = leading zero) }
-function LongToStrLZ(L: Longint): String;
-var
-  Z: String[1];
-begin
-  if (L >= 0) and (L <= 9)
-    then Z := '0'
-    else Z := '';
-  LongToStrLZ := Z + LongToStr(L);
-end;
-
-{ Procedures and functions that do appear in the interface section and are
-  the same for all platforms }
-
-{ Checks if date and time in "dt" is valid; also determines the day of the
-  week }
-procedure CheckDateTime(var DT: TDateTime);
-const
-  MonthLength : array[1..12] of Byte =
-    (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
-begin
-  DT.Valid := false;
-  { check data that is within a fixed range }
-  with DT do
-    if (Hour < 0) or (Hour > 23) or
-       (Minute < 0) or (Minute > 59) or
-       (Second < 0) or (Second > 59) or
-       (Month < 1) or (Month > 12) or
-       (Day < 1) or
-       (Year < 1600) or (Year > 3999)
-      then  exit;
-  { determine if year is leap year }
-  DT.IsLeap := ((dt.Year mod 4) = 0) and
-                 (not (((dt.Year mod 100)  = 0) and
-                      ((dt.Year mod 400) <> 0)));
-  { check if day is within limits }
-  if ( DT.IsLeap      and (dt.Month = 2) and (dt.Day > 29)) or
-     ((not dt.IsLeap) and (dt.Day > MonthLength[dt.Month]))
-    then exit;
-  { date seems to be alright, compute day of the week
-    (formula taken from DDJ 06/95 [#231], p.11) }
-  if weekday (dt.year,dt.month,dt.day)<0 then
-     dt.dow:=0
-  else
-     dt.dow:=weekday(dt.year,dt.month,dt.day);
-{  Removed - caused segfault in linux. Michael.
-
-  dt.DOW := (((( 3 * (dt.Year) - ( 7 * ((dt.Year) +
-            ((dt.Month)+9) div 12)) div 4 +
-            (23 * (dt.Month)) div 9 + (dt.Day) + 2 +
-            (((dt.Year) - Ord ((dt.Month) < 3)) div 100 + 1)
-             * 3 div 4 - 16 ) + 1 ) mod 7));
-}
-  dt.Valid := true;
-end;
-
-{ Returns if AName contains at least one of the characters from global
-  constant WildcardChars }
-function ContainsWildcards(AName: TFileName): Boolean;
-var
-  I, J: Longint;
-begin
-  ContainsWildcards := false;
-  if (Length(AName) = 0)
-    then exit;
-  { compare each character in AName with each character in WildCards }
-  for I := 1 to Length (AName) do
-    for J := 0 to NumWildcardChars-1 do
-      if (AName[I] = WildcardChars[J])
-        then begin
-               ContainsWildcards := true;
-               exit;
-             end;
-end;
-
-{ Returns date part of TDateTime as String : "Tue 29 Jul 1997" }
-function DateToString(const DT: TDateTime): String;
-const
-  DOWNames : array[0..6] of String[3] =
-    ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
-  MonthNames : array[1..12] of String[3] =
-    ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-     'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
-begin
-  if DT.Valid
-    then DateToString := DOWNames [dt.DOW] + ' ' +
-                         LongToStrLZ (dt.Day) + ' ' +
-                         MonthNames [dt.Month] + ' ' +
-                         LongToStr   (dt.Year)
-    else DateToString := '';
-end;
-
-{ Returns if two names are considered equal for the file system }
-function  EqualNames(Name1, Name2: TFileName): Boolean;
-{$IFDEF OS_DOS}
-var
-  I: Byte;
-begin
-  { case-insensitive comparision of strings }
-  EqualNames := false;
-  if (Length(Name1) <> Length(Name2)) or (Length(Name1) = 0)
-    then exit;
-  for I := 1 to Length(Name1) do
-    if (Upcase(Name1[I]) <> Upcase(Name2[I]))
-      then exit;
-  EqualNames := true;
-end;
-{$ELSE}
-begin
-  { case-sensitive comparision of strings }
-  EqualNames := (Name1 = Name2);
-end;
-{$ENDIF}
-
-{ Returns if name "AName" is in use (as file or directory) }
-function Exists(AName: TFileName): Boolean;
-begin
-  Exists := (CheckName (AName) <> cnUnknown);
-end;
-
-{ Splits AName into its path, raw name and extension; example:
-  "c:\pp\fv\archive.zip" will be split into path "c:\pp\fv\",
-  raw name "archive" and extension "zip" }
-procedure SplitName(AName: TFileName; var Path, RawName, Extension: TFileName);
-var
-  HasDot, HasSeparator: Boolean;
-  I, NameLength, DotOffset, SeparatorOffset: Longint;
-begin
-  NameLength := Length(AName);
-  Path := '';
-  RawName := '';
-  Extension := '';
-  { search for last separator in name }
-  SeparatorOffset := -1;
-  HasSeparator := false;
-  I := NameLength;
-  while (I > 0) and (not HasSeparator) do begin
-    if (AName[i] = PathSeparator)
-      then begin
-             HasSeparator := true;
-             SeparatorOffset := I;
-           end;
-    Dec(I);
-  end;
-  if HasSeparator
-    then begin
-           Path := System.Copy(AName, 1, SeparatorOffset);
-           SeparatorOffset := SeparatorOffset + 1;
-         end
-    else SeparatorOffset := 1;
-  I := SeparatorOffset;
-  { search for last dot in name (not in path /
-    think of 'dir/files.old/filename') }
-  HasDot := false;
-  while (I <= NameLength) do begin
-    if (AName[I] = '.')
-      then begin
-             HasDot := true;
-             DotOffset := I;
-           end;
-    Inc(I);
-  end;
-  if HasDot
-    then begin
-           RawName := System.Copy (AName,
-                                   SeparatorOffset,
-                                   DotOffset-SeparatorOffset);
-           Extension := System.Copy (AName,
-                                     DotOffset + 1,
-                                     NameLength - DotOffset);
-         end
-    else begin
-           { no extension }
-           RawName := System.Copy (AName,
-                                   SeparatorOffset,
-                                   NameLength - SeparatorOffset);
-         end;
-end;
-
-{ Returns time part of "DT" as "23:04:38" }
-function TimeToString(DT: TDateTime): String;
-begin
-  if DT.Valid
-    then TimeToString := LongToStrLZ(DT.Hour) + ':' +
-                         LongToStrLZ(DT.Minute) + ':' +
-                         LongToStrLZ(DT.Second)
-    else TimeToString := '';
-end;
-
-{$IFDEF OS_DOS} { procedures & functions for the DOS platform }
-
-{ Functions and procedures not declared in the interface section }
-
-{ Returns date part of dt in DOS format, as unsigned 16 bit integer }
-procedure GetDOSDate(DT: TDateTime; var W: Word);
-begin
-  W := (DT.Day and $1f) or
-       ((DT.Month and $f) shl 5) or
-       (((DT.Year - 1980) and $7f) shl 9);
-end;
-
-{ Returns time part of DT in DOS format, as unsigned 16 bit integer }
-procedure GetDOSTime(DT: TDateTime; var W: Word);
-begin
-  W := ((DT.Second shr 1) and $1f) or
-       ((DT.Minute and $3f) shl 5) or
-       ((DT.Hour and $1f) shl 11);
-end;
-
-{ Returns date and time as 32 bit integer value (DOS time format) }
-procedure GetDOSDateTime(DT : TDateTime; var L: Longint);
-var
-  W: Word;
-begin
-  GetDOSTime(DT, W);
-  L := W;
-  GetDOSDate(DT, W);
-  L := L + (W * 65536); { shifting by 16 doesn't work everywhere ... }
-end;
-
-{ Sets date part of DT to W }
-procedure SetDOSDate(W: Word; var DT: TDateTime);
-begin
-  DT.Day := W and $1f;
-  DT.Month := (W shr 5) and $f;
-  DT.Year := 1980 + (W shr 9) and $7f;
-end;
-
-{ Sets time part of DT to W }
-procedure SetDOSTime(W: Word; var DT: TDateTime);
-begin
-  DT.Second := (W and $1f) shl 1;
-  DT.Minute := (W shr 5) and $3f;
-  DT.Hour := (W shr 11) and $1f;
-end;
-
-{ Sets DT to data from L }
-procedure SetDOSDateTime(L: Longint; var DT: TDateTime);
-begin
-  SetDOSTime(L mod 65536, DT);
-  SetDOSDate(L div 65536, DT);
-end;
-
-{ Converts DOS.SearchRec to TFileDesciptor }
-procedure SearchRecToFileDescriptor (    SR: DOS.SearchRec;
-                                     var FD: TFileDescriptor);
-begin
-  FD.Name := SR.Name;
-  FD.Attr := SR.Attr;
-  FD.Size := SR.Size;
-  FD.IsDirectory := ((SR.Attr and faDirectory) <> 0);
-  SetDOSDateTime(SR.Time, FD.LastModification);
-  CheckDateTime(FD.LastModification);
-end;
-
-{$ENDIF} { OS_DOS }
-
-{$IFDEF OS_UNIX}
-{ Functions and procedures not decalred in interface section,
-  Unix operating systems }
-
-Procedure EpochToDateTime (Epoch : Longint; var DT : TDateTime);
-{ Returns a Checked datetime, starting from a Unix epoch-style time }
-
-var y,m,d,h,mi,s : Word; { needed because of call by var }
-
-begin
-  Linux.EpochToLocal(Epoch,Y,M,D,h,mi,s);
-  DT.Year   :=y;
-  DT.Month  :=m;
-  DT.Day    :=d;
-  DT.Hour   :=h;
-  DT.Minute :=mi;
-  DT.Second :=s;
-  CheckDateTime (DT);
-end;
-
-Procedure StatToFileDescriptor (Info : Stat; Var Fd : TFileDescriptor);
-{Starting from a stat record, returns a TFileDescriptor record.
- Name is not filled in !}
-begin
-  Fd.Attr:=Info.Mode;
-  Fd.IsDirectory:=S_ISDIR(Info.mode);
-  EpochToDateTime(Info.Mtime,Fd.LastModification);
-  EpochToDateTime(Info.Atime,Fd.LastAccessed);
-  EpochToDateTime(Info.Ctime,Fd.Created);
-  Fd.Size:=Info.size;
-end;
-{$ENDIF} {OS_Unix}
-
-{ Functions and procedures declared in the interface section }
-
-{ Returns type of name as cnXXXX constant (unknown, file, directory) }
-function CheckName(AName: TFileName): Byte;
-var
-  FS: TFileSearch;
-begin
-  FS.Specs := AName;
-  {$IFDEF OS_DOS}
-  FS.Attr := faAnyFile;
-  {$ENDIF}
-  StartSearch(fs);
-  if FS.Success
-    then begin
-           if FS.FD.IsDirectory
-             then CheckName := cnDirectory
-             else CheckName := cnFile;
-         end
-    else CheckName := cnUnknown;
-  TerminateSearch(FS);
-end;
-
-{ Continues a file search started by StartSearch }
-procedure ContinueSearch(var FS: TFileSearch);
-{$IFDEF OS_Unix}
-Var g : PGLob;
-    info : stat;
-
-begin
-  if Not FS.Success then exit;
-  FS.Success:=False;
-  if FS.GL=nil then exit; { Paranoia setting }
-  g:=FS.GL;
-  FS.GL:=FS.GL^.NEXT;
-  strdispose(g^.name);
-  dispose (g);
-  If FS.GL=Nil then exit;
-  linux.fstat(strpas(FS.GL^.Name),info);
-  if linuxerror<>0 then
-    begin
-    StatToFileDescriptor (info,FS.FD);
-    FS.FD.Name:=strpas(FS.GL^.Name);
-    FS.Success:=True;
-    end;
-end;
-{$ELSE OS_Unix}
-begin
-  if fs.Success
-    then begin
-           DOS.FindNext(FS.SR);
-           FS.Success := (DOS.DOSError = 0);
-           if FS.Success
-             then SearchRecToFileDescriptor(fs.sr, fs.fd);
-         end;
-end;
-{$ENDIF OS_Unix}
-
-{ Create a new subdirectory AName }
-procedure CreateDir(AName : TFileName);
-begin
-  {$I-}
-  System.MkDir(AName);
-  {$I+}
-  ErrorCode := System.IOResult;
-end;
-
-{ Deletes the directory AName }
-procedure DeleteDir(AName : TFileName);
-begin
-  {$I-}
-  System.RmDir(AName);
-  {$I+}
-  ErrorCode := System.IOResult;
-end;
-
-{ Deletes the file AName }
-procedure DeleteFile(AName: TFileName);
-var
-  F: file;
-begin
-  Assign(F, AName);
-  {$I-}
-  System.Erase(F);
-  {$I+}
-  ErrorCode := System.IOResult;
-end;
-
-{ Returns the full version of AName }
-function ExpandName(AName : TFileName): TFileName;
-begin
-{$IFDEF OS_Unix}
-  ExpandName := Linux.FExpand(AName);
-{$ELSE}
-  ExpandName := DOS.FExpand(AName);
-{$ENDIF}
-end;
-
-{ Returns a string version of AFileAttr; OS-dependent }
-function FileAttrToString(AFileAttr: TFileAttr): String;
-{$IFDEF OS_DOS}
-{ Volume Label and Directory are not regarded }
-const
-  NumChars = 4;
-  AttrChars: String[NumChars] = 'RSHA';
-  AttrMasks: Array[0..NumChars-1] of Word = (1, 2, 4, 32);
-var
-  I: Word;
-  S: String[NumChars];
-begin
-  s[0] := Chr(NumChars);
-  for I := 1 to NumChars do begin
-    if ((AFileAttr and AttrMasks[i-1]) = 0)
-      then S[I] := '.'
-      else S[I] := AttrChars[i];
-  end;
-  FileAttrToString := S;
-end;
-{$ELSE OS_DOS}
-{$IFDEF OS_Unix}
-var temp : string[9];
-    i : longint;
-
-const
-    full = 'rwxrwxrwx';
-
-begin
-  temp:='---------';
-  for i:=0 to 8 do
-    if (AFileAttr and (1 shl i))=(1 shl I) then temp[9-i]:=full[9-i];
-  FileAttrToString := Temp;
-end;
-{$ELSE OS_Unix}
-begin
-  FileAttrToString:='';
-end;
-{$ENDIF OS_Unix}
-{$ENDIF OS_DOS}
-
-{ Returns a string version of the file integer value fi }
-function FileIntToString(fi: TFileInt): String;
-var
-  S: String[14]; { maximum is "-2,147,483,648" }
-  I: Integer;    { must be signed ! }
-begin
-  Str(fi, S);
-  if SeparateThousands
-    then begin
-           I := System.Length(S) - 2;
-           while (I > 1) and (not (I = 2) and (s[1] = '-')) do begin
-             System.Insert (ThousandsSeparator, S, I);
-             Dec(I, 3);
-           end;
-         end;
-  FileIntToString := S;
-end;
-
-{ Returns the currently set directory }
-function GetCurrentDir: TFileName;
-{$IFDEF PPC_BP}
-var
-  I: Byte;
-  R: DOS.Registers;
-  S: TFileName;
-begin
-  { to get a full name, we have to get the drive letter ourselves }
-
-  { get current drive letter first }
-  R.AH := $19;
-  DOS.MsDos(R);
-
-  S[1] := Chr(Ord('A') + R.AL);
-  S[2] := ':';
-  S[3] := '\';
-
-  { get current directory }
-  R.AH := $47;
-  R.DL := $00;
-  R.DS := Seg(S[4]);
-  R.SI := Ofs(S[4]);
-  DOS.MsDos (r);
-  if ((R.Flags and FCarry) <> 0)
-    then begin
-           { error }
-         end;
-
-  { determine length of current directory }
-  I := 4;
-  while (S[I] <> #0) and (I < MaxNameLength) do
-    Inc(I);
-  S[0] := Chr(I - 1);
-
-  GetCurrentDir := S;
-end;
-{$ELSE}
-var
-  S: TFileName;
-begin
-  System.GetDir(0, S);
-  GetCurrentDir := S;
-end;
-{$ENDIF}
-
-{ Gets attribute of AName }
-procedure GetFAttr(AName: TFileName; var Attr: TFileAttr);
-{$IFDEF OS_DOS}
-var
-  F: file;
-  W: word;
-begin
-  Assign(F, AName);
-  {$I-}
-  DOS.GetFAttr(F, W);
-  Attr:=W;
-  {$I+}
-  ErrorCode := DOS.DOSError;
-end;
-{$ELSE}
-{$IFDEF OS_Unix}
-var
-  info : stat;
-begin
-  Linux.FStat (AName,Info);
-  ErrorCode:=LinuxError;
-  if ErrorCode<>0 then exit;
-  Attr:=Info.Mode;
-end;
-{$ELSE}
-begin
-end;
-{$ENDIF}
-{$ENDIF}
-
-{ Gets date and time of last modification of AName }
-procedure GetFTime(AName: TFileName; var DT: TDateTime);
-{$IFDEF OS_DOS}
-var
-  F: file;
-  L: Longint;
-begin
-  DT.Valid := false;
-  { open file }
-  Assign(F, AName);
-  {$I-}
-  Reset(F);
-  {$I+}
-  ErrorCode := System.IOResult;
-  if (ErrorCode <> errOK)
-    then exit;
-  { get date/time of last modification in DOS format }
-  {$I-}
-  DOS.GetFTime(F, L);
-  {$I+}
-  ErrorCode := DOS.DOSError;
-  if (ErrorCode <> errOK)
-    then exit;
-  { close file }
-  {$I-}
-  Close(F);
-  {$I+}
-  ErrorCode := System.IOResult;
-  { convert date/time L to TDateTime format }
-  GetDOSDateTime(DT, L);
-  CheckDateTime(DT);
-end;
-{$ELSE}
-{$IFDEF OS_Unix}
-var info : Stat;
-
-begin
-  Linux.FStat (AName,Info);
-  ErrorCode:=LinuxError;
-  if ErrorCode<>0 then exit;
-  EpochToDateTime (info.mtime,DT);
-end;
-{$ELSE}
-begin
-end;
-{$ENDIF}
-{$ENDIF}
-
-{ Returns if AName is a valid file name (not if it actually exists) }
-function IsValidName(AName: TFileName): Boolean;
-{$IFDEF OS_DOS}
-  { isn't ready yet }
-
-  { Returns if a name (without a path) is valid }
-  function ValidName(S: TFileName): Boolean;
-  var
-    I: Byte;
-  begin
-    ValidName := false;
-    if (Length(S) > 12)
-      then exit;
-    I := Pos('.', S);
-
-    ValidName := true;
-  end;
-
-const
-  InvalidChars: String[2] = '*?';
-
-var
-  I, J: Longint;
-  P, R, E: TFileName;
-begin
-  IsValidName := false;
-  { check for invalid characters }
-  for I := 1 to Length(AName) do
-    for J := 1 to Length(InvalidChars) do
-      if (AName[I] = InvalidChars[J])
-        then exit;
-  SplitName(AName, P, R, E);
-  if (Length(R) > 0) or (Length(E) > 0)
-    then begin
-           if (not ValidName(R + E))
-             then exit;
-         end;
-
-  IsValidName := true;
-end;
-{$ELSE}
-{$IFDEF OS_Unix}
-begin
-  IsVAlidName:=((pos('?',AName)=0) and (pos('*',AName)=0))
-end;
-{$ELSE}
-begin
-  IsValidName:=True;
-end;
-{$ENDIF}
-{$ENDIF}
-
-{ Renames directory from OldName to NewName }
-procedure RenameDir(OldName, NewName : TFileName);
-begin
-  { for DOS, renaming files and directories should be the same ... }
-  RenameFile(OldName, NewName);
-end;
-
-{ Renames file from OldName to NewName }
-procedure RenameFile(OldName, NewName : TFileName);
-var
-  F: file;
-begin
-  Assign(F, OldName);
-  {$I-}
-  System.Rename(F, NewName);
-  {$I+}
-  ErrorCode := IOResult;
-end;
-
-{ Sets current directory to AName }
-procedure SetCurrentDir(AName : TFileName);
-begin
-  {$I-}
-  System.ChDir(AName);
-  {$I+}
-  ErrorCode := IOResult;
-end;
-
-{ Sets attribute of file AName to AFileAttr }
-procedure SetFAttr(AName: TFileName; AFileAttr: TFileAttr);
-{$IFDEF OS_DOS}
-var
-  F: file;
-begin
-  Assign(F, AName);
-  {$I-}
-  DOS.SetFAttr(F, AFileAttr);
-  {$I+}
-  ErrorCode := DOS.DOSError;
-end;
-{$ELSE}
-{$IFDEF OS_Unix}
-begin
-  Linux.Chmod (Aname,AFileAttr);
-  ErrorCode:=LinuxError;
-end;
-{$ELSE}
-begin
-end;
-{$ENDIF}
-{$ENDIF}
-
-{ Sets date and time of last modification of file AName to dt }
-procedure SetFTime(AName: TFileName; DT: TDateTime);
-{$IFDEF OS_DOS}
-var
-  F: file;
-  L: Longint;
-begin
-  GetDOSDateTime(DT, L);
-  Assign(f, AName);
-  {$I-}
-  DOS.SetFTime(F, L);
-  {$I+}
-  ErrorCode := DOS.DOSError;
-end;
-{$ELSE}
-{$IFDEF OS_Unix}
-var
-  utim : utimebuf;
-begin
-  utim.actime:=LocalToEpoch(DT.Year,DT.Month,DT.Day,DT.Hour,DT.Minute,DT.second);
-  utim.modtime:=utim.actime;
-  utime (AName,utim);
-  ErrorCode:=linuxerror
-end;
-{$ELSE}
-begin
-end;
-{$ENDIF}
-{$ENDIF}
-
-{ Starts a file search, using input data from fs }
-procedure StartSearch(var FS: TFileSearch);
-{$IFDEF OS_Unix}
-var
-  info : stat;
-begin
-  FS.Success:=False;
-  FS.GL:=Linux.Glob(FS.Specs);
-  if FS.GL=nil then exit;
-  linux.fstat(strpas(FS.GL^.Name),info);
-  if linuxerror=0 then
-    begin
-    StatToFileDescriptor (info,FS.FD);
-    FS.FD.Name:=strpas(FS.GL^.Name);
-    FS.Success:=True;
-    end;
-end;
-{$ELSE OS_Unix}
-{ this version works for every platform/os/bits combination that has a
-  working DOS unit : BP/FPC/Virtual Pascal }
-begin
-  DOS.FindFirst(fs.Specs, fs.Attr, fs.sr);
-  fs.Success := (DOS.DOSError = 0);
-  if fs.Success
-    then SearchRecToFileDescriptor(FS.SR, FS.FD);
-end;
-{$ENDIF OS_Unix}
-
-{ Terminates a file search }
-procedure TerminateSearch (var FS: TFileSearch);
-begin
-{$IFDEF OS_Unix}
-GlobFree (FS.GL);
-{$ELSE}
-  {$IFNDEF PPC_BP}
-  DOS.FindClose(fs.sr);
-  {$ENDIF}
-{$ENDIF}
-end;
-
-{ Unit initialization }
-begin
-  { Empty, though we could retrieve the thousands separator and
-    date/time formats here (in case the OS supports that) }
-end.
-{
-  $Log$
-  Revision 1.4  2000-12-14 19:26:34  hajny
-    * made compilable for OS/2 target
-
-  Revision 1.3  2000/11/23 10:17:48  sg
-  * Linux.EpochToLocal has var arguments of type Word, not Integer - so
-    some local variables had to be changed
-
-  Revision 1.2  2000/11/13 14:35:57  marco
-   * Unix Renamefest for defines.
-
-  Revision 1.1  2000/07/13 06:29:38  michael
-  + Initial import
-
-  Revision 1.2  2000/02/29 11:43:16  pierre
-    Common renamed APIComm to avoid problems with free vision
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/12/23 19:36:47  peter
-    * place unitfiles in target dirs
-
-  Revision 1.1  1999/11/24 23:36:37  peter
-    * moved to packages dir
-
-  Revision 1.4  1999/05/17 13:55:18  pierre
-   * FPC win32 also need dos unit
-
-  Revision 1.3  1999/04/13 09:25:47  daniel
-  * Reverted a terrible mistake
-
-  Revision 1.1  1998/12/04 12:48:24  peter
-    * moved some dirs
-
-  Revision 1.5  1998/10/26 11:22:50  peter
-    * updates
-
-
-  ?            0.1      marco   Initial implementation
-  ?                             Several fixes ...
-  08/29/1997   0.4      marco   Some platform adjustments
-  09/16/1997   0.4.1    marco   Added "EqualNames"
-  09/17/1997   0.5      michael Implemented linux part.
-  09/20/1997   0.5.1    marco   Added LastAccessed/Created to Linux part of
-                                file descriptor
-  04/15/1998   0.5.2    michael Updated linux part.
-}

+ 0 - 280
api/inc/keyboard.pas

@@ -1,280 +0,0 @@
-{
-   $Id$
-
-   Keyboard unit, part of the portable API for Pascal
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-unit Keyboard;
-
-interface
-{$i platform.inc}
-
-uses
-{$ifdef DEBUG}
-{$ifdef win32}
-  windows,
-{$endif win32}
-{$endif DEBUG}
-
-  ApiComm;
-
-const
-  { We have an errorcode base of 1010 }
-  errKbdInitError               = errKbdBase + 0;
-  errKbdNotImplemented          = errKbdBase + 1;
-
-type
-  TKeyEvent = Longint;
-
-{ The structure of a TKeyEvent follows in LSB-MSB order:
-  2 bytes: depending on flags either the physical representation of a key
-           (under DOS scancode, ascii code pair), or the translated
-           ASCII/unicode character
-  1 byte:  shift-state when this key was pressed (or shortly after)
-  1 byte:  flags, the following flags are defined:
-           bit0-1
-                   0: the lowest two bytes is the translated ASCII value
-                   1: the lowest two bytes is the translated Unicode value
-                      (wide-char)
-                   2: the lowest two bytes is a function key, and the lowest
-                      two bytes contains its platform independent code
-                   3: the lowest two bytes is the physical representation
-           bit2
-                   0: the key is pressed
-                   1: the key is released (This event is not guaranteed to occur on all platforms)
-           bit3-7  undefined, should be 0
-
-
-  If there are two keys returning the same char-code, there's no way to find
-  out which one was pressed (Gray+ and Simple+). If you need to know which
-  was pressed, you'll need to use the untranslated keycodes, which is system
-  dependent. System dependent constants may be defined to cover those, with
-  possibily having the same name (but different value). }
-
-{ System independent function key codes }
-const
-  kbdF1        = $FF01;
-  kbdF2        = $FF02;
-  kbdF3        = $FF03;
-  kbdF4        = $FF04;
-  kbdF5        = $FF05;
-  kbdF6        = $FF06;
-  kbdF7        = $FF07;
-  kbdF8        = $FF08;
-  kbdF9        = $FF09;
-  kbdF10       = $FF0A;
-  kbdF11       = $FF0B;
-  kbdF12       = $FF0C;
-  kbdF13       = $FF0D;
-  kbdF14       = $FF0E;
-  kbdF15       = $FF0F;
-  kbdF16       = $FF10;
-  kbdF17       = $FF11;
-  kbdF18       = $FF12;
-  kbdF19       = $FF13;
-  kbdF20       = $FF14;
-  { $15 - $1F reserved for future Fxx keys }
-  kbdHome      = $FF20;
-  kbdUp        = $FF21;
-  kbdPgUp      = $FF22;
-  kbdLeft      = $FF23;
-  kbdMiddle    = $FF24;
-  kbdRight     = $FF25;
-  kbdEnd       = $FF26;
-  kbdDown      = $FF27;
-  kbdPgDn      = $FF28;
-
-  kbdInsert    = $FF29;
-  kbdDelete    = $FF2A;
-  { $2B - $2F reserved for future keypad keys }
-
-  { possible flag values }
-  kbASCII       = $00;
-  kbUniCode     = $01;
-  kbFnKey       = $02;
-  kbPhys        = $03;
-
-  kbReleased    = $04;
-
-  { shiftstate flags }
-  kbLeftShift   = 1;
-  kbRightShift  = 2;
-  kbShift       = kbLeftShift or kbRightShift;
-  kbCtrl        = 4;
-  kbAlt         = 8;
-
-var
-  PendingKeyEvent : TKeyEvent;
-
-
-procedure InitKeyboard;
-{ Initializes the keyboard interface, additional platform specific parameters
-  can be passed by global variables (RawMode etc.) for the first implementation
-  under DOS it does nothing }
-
-procedure DoneKeyboard;
-{ Deinitializes the keyboard interface }
-
-function GetKeyEvent: TKeyEvent;
-{ Returns the last keyevent, and waits for one if not available }
-
-procedure PutKeyEvent(KeyEvent: TKeyEvent);
-{ Adds the given KeyEvent to the input queue. Please note that depending on
-  the implementation this can hold only one value (NO FIFOs etc) }
-
-function PollKeyEvent: TKeyEvent;
-{ Checks if a keyevent is available, and returns it if one is found. If no
-  event is pending, it returns 0 }
-
-function PollShiftStateEvent: TKeyEvent;
-{ Return the current shiftstate in a keyevent }
-
-function TranslateKeyEvent(KeyEvent: TKeyEvent): TKeyEvent;
-{ Performs ASCII translation of the KeyEvent }
-
-function TranslateKeyEventUniCode(KeyEvent: TKeyEvent): TKeyEvent;
-{ Performs Unicode translation of the KeyEvent }
-
-function GetKeyEventFlags(KeyEvent: TKeyEvent): Byte;
-{ Returns the flags part of the given KeyEvent }
-
-function GetKeyEventChar(KeyEvent: TKeyEvent): Char;
-{ Returns the charcode part of the given KeyEvent, if it contains a translated
-  keycode }
-
-function GetKeyEventUniCode(KeyEvent: TKeyEvent): Word;
-{ Returns the unicode part of the given KeyEvent, if it contains a translated
-  unicode character }
-
-function GetKeyEventCode(KeyEvent: TKeyEvent): Word;
-{ Returns the translated function keycode part of the given KeyEvent, if it
-  contains a translated function keycode }
-
-function GetKeyEventShiftState(KeyEvent: TKeyEvent): Byte;
-{ Returns the shift-state values of the given KeyEvent }
-
-function IsFunctionKey(KeyEvent: TKeyEvent): Boolean;
-{ Returns true if the given key was a function key or not }
-{$ifdef DEBUG}
-{$ifdef win32}
-var last_ir : INPUT_RECORD;
-{$endif win32}
-{$ifdef Unix}
-Function RawReadKey:char;
-{$endif unix}
-{$endif DEBUG}
-
-implementation
-
-{ Include platform dependent routines }
-
-{$i keyboard.inc}
-
-
-{ Platform independent routines }
-
-procedure PutKeyEvent(KeyEvent: TKeyEvent);
-begin
-  PendingKeyEvent := KeyEvent;
-end;
-
-function GetKeyEventFlags(KeyEvent: TKeyEvent): Byte;
-begin
-  GetKeyEventFlags := (KeyEvent and $FF000000) shr 24;
-end;
-
-function GetKeyEventChar(KeyEvent: TKeyEvent): Char;
-begin
-  if KeyEvent and $03000000 = $00000000 then
-    GetKeyEventChar := Chr(KeyEvent and $000000FF)
-   else
-    GetKeyEventChar := #0;
-end;
-
-function GetKeyEventUniCode(KeyEvent: TKeyEvent): Word;
-begin
-  if KeyEvent and $03000000 = $01000000 then
-    GetKeyEventUniCode := KeyEvent and $0000FFFF
-   else
-    GetKeyEventUniCode := 0;
-end;
-
-function GetKeyEventCode(KeyEvent: TKeyEvent): Word;
-begin
-  GetKeyEventCode := KeyEvent and $0000FFFF
-end;
-
-function GetKeyEventShiftState(KeyEvent: TKeyEvent): Byte;
-begin
-  GetKeyEventShiftState := (KeyEvent and $00FF0000) shr 16;
-end;
-
-function IsFunctionKey(KeyEvent: TKeyEvent): Boolean;
-begin
-  IsFunctionKey := KeyEvent and $03000000 = $02000000;
-end;
-
-end.
-{
-  $Log$
-  Revision 1.3  2000-11-13 14:35:57  marco
-   * Unix Renamefest for defines.
-
-  Revision 1.2  2000/10/26 23:10:21  peter
-    * fixes merge
-
-  Revision 1.1  2000/07/13 06:29:38  michael
-  + Initial import
-
-  Revision 1.2  2000/02/29 11:43:16  pierre
-    Common renamed APIComm to avoid problems with free vision
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/12/23 19:36:47  peter
-    * place unitfiles in target dirs
-
-  Revision 1.2  1999/12/09 21:29:15  pierre
-   + some debug code for win32
-
-  Revision 1.3  1999/11/24 23:36:56  peter
-    * moved to packages dir
-
-  Revision 1.2  1998/12/12 19:12:58  peter
-    * keyboard updates
-    * make test target, make all only makes units
-
-  Revision 1.1  1998/12/04 12:48:24  peter
-    * moved some dirs
-
-  Revision 1.6  1998/10/29 12:49:47  peter
-    * more fixes
-
-  Revision 1.5  1998/10/28 21:18:22  peter
-    * more fixes
-
-  Revision 1.4  1998/10/26 11:22:51  peter
-    * updates
-
-
-   Date       Version   Who     Comments
-   07/28/98   0.2       Bazsi   Added some constants
-}

+ 0 - 198
api/inc/mouse.pas

@@ -1,198 +0,0 @@
-{
-   $Id$
-
-   Mouse unit, part of the portable API for Pascal
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-unit Mouse;
-interface
-{$ifdef TP}
-  {$G+}
-{$endif}
-
-{$i platform.inc}
-
-uses
-  ApiComm;
-
-const
-  { We have an errorcode base of 1010 }
-  errMouseInitError               = errMouseBase + 0;
-  errMouseNotImplemented          = errMouseBase + 1;
-
-type
-  PMouseEvent=^TMouseEvent;
-  TMouseEvent=packed record { 8 bytes }
-    buttons : word;
-    x,y     : word;
-    Action  : word;
-  end;
-
-const
-  MouseActionDown = $0001;                         { Mouse down event }
-  MouseActionUp   = $0002;                         { Mouse up event }
-  MouseActionMove = $0004;                         { Mouse move event }
-
-  MouseLeftButton   = $01;                         { Left mouse button }
-  MouseRightButton  = $02;                         { Right mouse button }
-  MouseMiddleButton = $04;                         { Middle mouse button }
-
-{$ifdef OS_WINDOWS}
-  MouseEventBufSize = 255;
-{$else OS_WINDOWS}
-  MouseEventBufSize = 16;
-{$endif OS_WINDOWS}
-
-var
-  PendingMouseEvent  : array[0..MouseEventBufSize-1] of TMouseEvent;
-  PendingMouseHead,
-  PendingMouseTail   : PMouseEvent;
-  PendingMouseEvents : byte;
-
-  LastMouseEvent : TMouseEvent;
-
-  MouseIntFlag : Byte;                                { Mouse in int flag }
-  MouseButtons : Byte;                                { Mouse button state }
-  MouseWhereX,
-  MouseWhereY  : Word;                                { Mouse position }
-
-
-procedure InitMouse;
-{ Initialize the mouse interface }
-
-procedure DoneMouse;
-{ Deinitialize the mouse interface }
-
-function DetectMouse:byte;
-{ Detect if a mouse is present, returns the amount of buttons or 0
-  if no mouse is found }
-
-procedure ShowMouse;
-{ Show the mouse cursor }
-
-procedure HideMouse;
-{ Hide the mouse cursor }
-
-function GetMouseX:word;
-{ Return the current X position of the mouse }
-
-function GetMouseY:word;
-{ Return the current Y position of the mouse }
-
-function GetMouseButtons:word;
-{ Return the current button state of the mouse }
-
-procedure SetMouseXY(x,y:word);
-{ Place the mouse cursor on x,y }
-
-procedure GetMouseEvent(var MouseEvent:TMouseEvent);
-{ Returns the last Mouseevent, and waits for one if not available }
-
-procedure PutMouseEvent(const MouseEvent: TMouseEvent);
-{ Adds the given MouseEvent to the input queue. Please note that depending on
-  the implementation this can hold only one value (NO FIFOs etc) }
-
-function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
-{ Checks if a Mouseevent is available, and returns it if one is found. If no
-  event is pending, it returns 0 }
-
-{$ifdef go32v2}
-{ tells the mouse unit to draw the mouse cursor itself }
-procedure DoCustomMouse(b : boolean);
-{$endif go32v2}
-
-implementation
-
-{ Include platform dependent routines }
-
-{$i mouse.inc}
-
-{ Platform independent routines }
-{$IFNDEF OS2}
-procedure PutMouseEvent(const MouseEvent: TMouseEvent);
-begin
-  if PendingMouseEvents<MouseEventBufSize then
-   begin
-     PendingMouseTail^:=MouseEvent;
-     inc(PendingMouseTail);
-     if longint(PendingMouseTail)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
-      PendingMouseTail:=@PendingMouseEvent;
-      { why isn't this done here ?
-        so the win32 version do this by hand:
-       inc(PendingMouseEvents); }
-   end
-  else
-end;
-{$ENDIF}
-end.
-{
-  $Log$
-  Revision 1.1  2000-07-13 06:29:38  michael
-  + Initial import
-
-  Revision 1.5  2000/03/12 15:05:14  peter
-    * $G+ is only needed for tp
-
-  Revision 1.4  2000/02/29 11:43:16  pierre
-    Common renamed APIComm to avoid problems with free vision
-
-  Revision 1.3  2000/02/07 22:54:44  florian
-    * custommouse define removed, i.e. code is always active
-    * the xor value for the mouse cursor must be $7f instead of $ff
-
-  Revision 1.2  2000/02/06 14:28:19  florian
-    * mouse support for vesa resolutions under go32v2, needs currently the define
-      custommouse
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.2  1999/12/31 17:25:24  marco
-
-
-  Added $G+, TP version required it.
-
-  Revision 1.1  1999/12/23 19:36:47  peter
-    * place unitfiles in target dirs
-
-  Revision 1.1  1999/11/24 23:36:37  peter
-    * moved to packages dir
-
-  Revision 1.5  1999/07/29 11:38:56  peter
-    * fixed comment for tp7
-
-  Revision 1.4  1999/07/17 22:37:07  florian
-    * implemented mouse handling
-
-  Revision 1.3  1999/04/23 17:54:58  hajny
-  PutMouseEvent modified for support of two queues in OS/2
-
-  Revision 1.2  1998/12/11 00:13:17  peter
-    + SetMouseXY
-    * use far for exitproc procedure
-
-  Revision 1.1  1998/12/04 12:48:24  peter
-    * moved some dirs
-
-  Revision 1.1  1998/10/28 00:02:07  peter
-    + mouse
-    + video.clearscreen, video.videobufsize
-
-}

+ 0 - 332
api/inc/platform.inc

@@ -1,332 +0,0 @@
-{
-   $Id$
-   Include file to sort out compilers/platforms/targets
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-
-   This include file defines some conditional defines to allow us to select
-   the compiler/platform/target in a consequent way.
-
-    OS_XXXX         The operating system used (XXXX may be one of:
-                       DOS, OS2, Linux, Windows, Go32, FreeBSD,Linux)
-    PPC_XXXX        The compiler used: BP, FPK, Virtual, Speed
-    BIT_XX          The number of bits of the target platform: 16 or 32
-    PROC_XXXX       The mode of the target processor (Real or Protected)
-                    This shouldn't be used, except for i386 specific parts.
-    ASM_XXXX        This is the assembler type: BP, ISO-ANSI, FPK
-
- ****************************************************************************
-
-   Changelog:
-
-     Date       Version        Who        Comments
-     02 Jul 97  0.1            Bazsi      Initial implementation~
-     28 Aug 97  0.2            LdeB       Fixed OS2 platform sort out
-     29 Aug 97  0.3            LdeB       Added assembler type change
-     29 Aug 97  0.4            LdeB       OS_DOS removed from Windows
-     23 Oct 97  0.5            LdeB       Delphi & Speed compilers added
-     05 May 98  0.6            LdeB       Virtual pascal 2.0 added
-     19 May 98  0.7            LdeB       Delphi2/3 definitions altered
-      6 Aug 98  0.8            CEC/LdeB   FPC only support - fixed for Win32
-     10 Aug 98  0.9            LdeB       BP_VMTLink def/Undef for object reg.
-     27 Aug 98  1.0            LdeB       Fixed Atari etc not $UNDEF OS_DOS.
-
-     25 Oct 98  1.1            pfv        Delphi4
-     13 nov 00  1.2	       mvdv	  Unix renamefest Addition of FreeBSD
-					   and change of Linux conditional
-					   meaning
- ****************************************************************************
-
-    This is how the IFDEF and UNDEF statements below should translate.
-
-
- PLATFORM  SYSTEM    COMPILER  COMP ID      CPU MODE        BITS    ASSEMBLER
- --------  ------    --------  -------      --------        ----    ---------
-
- DOS      OS_DOS      BP/TP7   PPC_BP       PROC_Real       BIT_16  ASM_BP
-                      FPC      PPC_FPC      PROC_Protected  BIT_32  ASM_FPC
-
- DPMI     OS_DOS      BP/TP7   PPC_BP       PROC_Protected  BIT_16  ASM_BP
-
- LINUX    OS_LINUX    FPC      PPC_FPC      PROC_Protected  BIT_32  ASM_FPC
-
- FREEBSD  OS_FREEBSD  FPC      PPC_FPC      PROC_Protected  BIT_32  ASM_FPC
-
- WINDOWS  OS_WINDOWS  BP/TP7   PPC_BP       PROC_Protected  BIT_16  ASM_BP
-                      DELPHI   PPC_DELPHI   PROC_Protected  BIT_16  ASM_BP
-                      DELPHI2  PPC_DELPHI&2 PROC_Protected  BIT_16  ASM_BP
-
- WIN95/NT OS_WINDOWS  DELPHI2  PPC_DELPHI&2 PROC_Protected  BIT_32  ASM_BP
-                      DELPHI3  PPC_DELPHI&3 PROC_Protected  BIT_32  ASM_BP
-                      DELPHI4  PPC_DELPHI&3 PROC_Protected  BIT_32  ASM_BP
-                      VIRTUAL  PPC_VIRTUAL  PROC_Protected  BIT 32  ASM_BP
-
- OS2      OS_OS2      BPOS2    PPC_BPOS2    PROC_Protected  BIT_16  ASM_BP
-                      VIRTUAL  PPC_VIRTUAL  PROC_Protected  BIT_32  ASM_BP
-                      SPEED    PPC_SPEED    PROC_Protected  BIT_32  ASM_BP
-                      FPC      PPC_FPC      PROC_Protected  BIT_32  ASM_FPC
- ****************************************************************************}
-{****************************************************************************
-
-FOR ALL COMPILERS BP_VMTLink will be defined but FPC and Delphi3 undefine it
-
- ****************************************************************************}
-{****************************************************************************
-
-FOR FPC THESE ARE THE TRANSLATIONS
-
-  PLATFORM  SYSTEM    COMPILER  HANDLE SIZE      ASM          CPU
- --------  ------    --------  -----------      ----         ---
-
- DOS      OS_DOS,
-	  OS_GO32      FPC     32-bit           AT&T         CPU86
-
- WIN32    OS_WINDOWS   FPC     32-bit           AT&T         ----
-
- LINUX    OS_LINUX,
-	  OS_UNIX      FPC     32-bit           AT&T         ----
-
- FREEBSD  OS_FREEBSD, 
-          OS_BSD,
-	  OS_UNIX      FPC     32-bit           AT&T         ----
-
- OS2      OS_OS2       FPC     ?????            AT&T         CPU86
-
- ATARI    OS_ATARI     FPC     32-bit           Internal     CPU68
-
- MACOS    OS_MAC       FPC     ?????            Internal     CPU68
-
- AMIGA    OS_AMIGA     FPC     32-bit           Internal     CPU68
-
-
-Note: All Unices have OS_UNIX in common. All BSD's (Open,Net,Free) have
-      OS_BSD in common.
-
- ****************************************************************************}
-
-{---------------------------------------------------------------------------}
-{  Initial assume BORLAND 16 BIT DOS COMPILER - Updated 27Aug98 LdB         }
-{---------------------------------------------------------------------------}
-{$DEFINE OS_DOS}
-{$DEFINE PROC_Real}
-{$DEFINE BIT_16}
-{$DEFINE PPC_BP}
-{$DEFINE ASM_BP}
-{$DEFINE BP_VMTLink}
-
-{---------------------------------------------------------------------------}
-{  BORLAND 16 BIT DPMI changes protected mode - Updated 27Aug98 LdB         }
-{---------------------------------------------------------------------------}
-{$IFDEF DPMI}
-  {$UNDEF PROC_Real}
-  {$DEFINE PROC_Protected}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  FPC 32 BIT COMPILER changes ASM, 32 bits etc - Updated 27Aug98 LdB       }
-{---------------------------------------------------------------------------}
-{$IFDEF FPC}
-  {$UNDEF PROC_Real}
-  {$DEFINE PROC_Protected}
-  {$UNDEF BIT_16}
-  {$DEFINE BIT_32}
-  {$UNDEF PPC_BP}
-  {$DEFINE PPC_FPC}
-  {$UNDEF ASM_BP}
-  {$DEFINE ASM_FPC}
-  {$UNDEF BP_VMTLink}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  FPC LINUX COMPILER changes operating system - Updated 12nov00 MvdV       }
-{  Note: Other linux compilers would need to change other details           }
-{---------------------------------------------------------------------------}
-{$IFDEF UNIX}
-  {$UNDEF OS_DOS}
-  {$DEFINE OS_UNIX}
-  {$IFNDEF BSD}			     {Work around. BSD still defines "linux"
-						            in 1.1 for now} 
-   {$DEFINE OS_LINUX}
-  {$ELSE}
-    {$DEFINE OS_FREEBSD}
-    {$DEFINE OS_BSD}
-  {$ENDIF}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  FPC GO32V2 COMPILER changes operating system - Updated 27Aug98 LdB       }
-{---------------------------------------------------------------------------}
-{$IFDEF GO32V2}
-  {$DEFINE OS_GO32}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  32 BIT WINDOWS COMPILERS changes bit size - Updated 27Aug98 LdB          }
-{---------------------------------------------------------------------------}
-{$IFDEF WIN32}
-  {$IFNDEF WINDOWS}
-    {$DEFINE WINDOWS}
-  {$ENDIF}
-  {$UNDEF BIT_16}
-  {$DEFINE BIT_32}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  WINDOWS COMPILERS change op system and proc mode - Updated 27Aug98 LdB   }
-{---------------------------------------------------------------------------}
-{$IFDEF WINDOWS}
-  {$UNDEF OS_DOS}
-  {$DEFINE OS_WINDOWS}
-  {$UNDEF PROC_Real}
-  {$DEFINE PROC_Protected}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  DELPHI1 COMPILER changes compiler type - Updated 27Aug98 LdB             }
-{---------------------------------------------------------------------------}
-{$IFDEF VER80}
-  {$UNDEF PPC_BP}
-  {$DEFINE PPC_DELPHI}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  DELPHI2 COMPILER changes compiler type - Updated 27Aug98 LdB             }
-{---------------------------------------------------------------------------}
-{$IFDEF VER90}
-  {$UNDEF PPC_BP}
-  {$DEFINE PPC_DELPHI}
-  {$DEFINE PPC_DELPHI2}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  DELPHI3 COMPILER changes compiler type - Updated 27Aug98 LdB             }
-{---------------------------------------------------------------------------}
-{$IFDEF VER100}
-  {$UNDEF PPC_BP}
-  {$DEFINE PPC_DELPHI}
-  {$DEFINE PPC_DELPHI3}
-  {$UNDEF BP_VMTLink}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  DELPHI4 COMPILER changes compiler type - Updated 25Oct98 pfv             }
-{---------------------------------------------------------------------------}
-{$IFDEF VER120}
-  {$UNDEF PPC_BP}
-  {$DEFINE PPC_DELPHI}
-  {$DEFINE PPC_DELPHI3}
-  {$DEFINE PPC_DELPHI4}
-  {$UNDEF BP_VMTLink}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  OS2 COMPILERS change compiler type and mode - Updated 27Aug98 LdB        }
-{  Note: Assumes BPOS2 16BIT OS2 patch except for FPC which undefines this  }
-{---------------------------------------------------------------------------}
-{$IFDEF OS2}
-  {$UNDEF OS_DOS}
-  {$DEFINE OS_OS2}
-  {$UNDEF PROC_Real}
-  {$DEFINE PROC_Protected}
-  {$UNDEF PPC_BP}
-  {$DEFINE PPC_BPOS2}
-  {$IFDEF FPC}
-    {$UNDEF PPC_BPOS2}
-  {$ENDIF}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  VIRTUAL PASCAL changes compiler type/32 bit - Updated 27Aug98 LdB        }
-{  Note: VP2 can compile win 32 code so changes op system as needed         }
-{---------------------------------------------------------------------------}
-{$IFDEF VirtualPascal}
-  {$UNDEF BIT_16}
-  {$DEFINE BIT_32}
-  {$IFDEF PPC_BPOS2}
-    {$UNDEF PPC_BPOS2}
-  {$ENDIF}
-  {$DEFINE PPC_VIRTUAL}
-  {$IFDEF WIN32}
-    {$UNDEF PPC_BP}
-    {$UNDEF OS_OS2}
-    {$DEFINE OS_WINDOWS}
-  {$ENDIF}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  SPEED COMPILER changes compiler type/32 bit  - Updated 27Aug98 LdB       }
-{---------------------------------------------------------------------------}
-{$IFDEF Speed}
-  {$UNDEF BIT_16}
-  {$DEFINE BIT_32}
-  {$UNDEF PPC_BPOS2}
-  {$DEFINE PPC_SPEED}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  FPC AMIGA COMPILER changes op system and CPU type - Updated 27Aug98 LdB  }
-{---------------------------------------------------------------------------}
-{$IFDEF AMIGA}
-  {$UNDEF OS_DOS}
-  {$DEFINE OS_AMIGA}
-  {$IFDEF CPU86}
-    {$UNDEF CPU86}
-  {$ENDIF}
-  {$IFNDEF CPU68}
-    {$DEFINE CPU68}
-  {$ENDIF}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  FPC ATARI COMPILER changes op system and CPU type - Updated 27Aug98 LdB  }
-{---------------------------------------------------------------------------}
-{$IFDEF ATARI}
-  {$UNDEF OS_DOS}
-  {$DEFINE OS_ATARI}
-  {$IFDEF CPU86}
-    {$UNDEF CPU86}
-  {$ENDIF}
-  {$IFNDEF CPU68}
-    {$DEFINE CPU68}
-  {$ENDIF}
-{$ENDIF}
-
-{---------------------------------------------------------------------------}
-{  FPC MAC COMPILER changes op system and CPU type - Updated 27Aug98 LdB    }
-{---------------------------------------------------------------------------}
-{$IFDEF MACOS}
-  {$UNDEF OS_DOS}
-  {$DEFINE OS_MAC}
-  {$IFDEF CPU86}
-    {$UNDEF CPU86}
-  {$ENDIF}
-  {$IFNDEF CPU68}
-    {$DEFINE CPU68}
-  {$ENDIF}
-{$ENDIF}
-
-{
-  $Log$
-  Revision 1.3  2000-11-13 14:35:57  marco
-   * Unix Renamefest for defines.
-
-  Revision 1.2  2000/07/13 11:32:24  michael
-  + removed logs
- 
-}

+ 0 - 254
api/inc/video.pas

@@ -1,254 +0,0 @@
-{
-   $Id$
-
-   System independent low-level video interface
-   Based on Daniel Mantion's interface designs
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-
-  Todo:
-   - getting escape sequences from termcap
-
- ****************************************************************************}
-unit Video;
-
-interface
-
-uses
-  ApiComm;
-
-{$i platform.inc}
-
-type
-  PVideoMode = ^TVideoMode;
-  TVideoMode = record
-    Col,Row : Word;
-    Color   : Boolean;
-  end;
-  TVideoModeSelector = function (const VideoMode: TVideoMode; Params: Longint): Boolean;
-
-  TVideoCell = Word;
-  PVideoCell = ^TVideoCell;
-
-  TVideoBuf = array[0..32759] of TVideoCell;
-  PVideoBuf = ^TVideoBuf;
-
-const
-  { Foreground and background color constants }
-  Black         = 0;
-  Blue          = 1;
-  Green         = 2;
-  Cyan          = 3;
-  Red           = 4;
-  Magenta       = 5;
-  Brown         = 6;
-  LightGray     = 7;
-
-  { Foreground color constants }
-  DarkGray      = 8;
-  LightBlue     = 9;
-  LightGreen    = 10;
-  LightCyan     = 11;
-  LightRed      = 12;
-  LightMagenta  = 13;
-  Yellow        = 14;
-  White         = 15;
-
-  { Add-in for blinking }
-  Blink         = 128;
-
-  { Capabilities bitmask }
-  cpUnderLine     = $0001;
-  cpBlink         = $0002;
-  cpColor         = $0004;
-  cpChangeFont    = $0008;
-  cpChangeMode    = $0010;
-  cpChangeCursor  = $0020;
-
-  { Possible cursor types }
-  crHidden        = 0;
-  crUnderLine     = 1;
-  crBlock         = 2;
-  crHalfBlock     = 3;
-
-  { Possible error codes }
-  vioOK              = 0;
-  errVioInit         = errVioBase + 1; { Initialization error, shouldn't occur on DOS, but may
-                         on Linux }
-  errVioNotSupported = errVioBase + 2; { call to an unsupported function }
-  errVioNoSuchMode   = errVioBase + 3; { No such video mode }
-
-const
-  ScreenWidth  : Word = 0;
-  ScreenHeight : Word = 0;
-
-var
-  ScreenColor  : Boolean;
-  CursorX,
-  CursorY      : Word;
-  LockUpdateScreen : Word;
-  VideoBuf     : PVideoBuf;
-  VideoBufSize : Longint;
-  CursorLines  : Byte;
-const
-  LowAscii     : Boolean = true;
-  NoExtendedFrame : Boolean = false;
-  FVMaxWidth = 132;
-
-procedure InitVideo;
-{ Initializes the video subsystem }
-procedure DoneVideo;
-{ Deinitializes the video subsystem }
-function GetCapabilities: Word;
-{ Return the capabilities of the current environment }
-procedure ClearScreen;
-{ Clears the screen }
-procedure UpdateScreen(Force: Boolean);
-{ Force specifies whether the whole screen has to be redrawn, or (if target
-  platform supports it) its parts only }
-procedure SetCursorPos(NewCursorX, NewCursorY: Word);
-{ Position the cursor to the given position }
-function GetCursorType: Word;
-{ Return the cursor type: Hidden, UnderLine or Block }
-procedure SetCursorType(NewType: Word);
-{ Set the cursor to the given type }
-function DefaultVideoModeSelector(const VideoMode: TVideoMode; Params: Longint): Boolean;
-
-procedure GetVideoMode(var Mode: TVideoMode);
-{ Return dimensions of the current video mode }
-procedure SetVideoMode(Mode: TVideoMode);
-{ Set video-mode to have Mode dimensions, may return errVioNoSuchMode }
-procedure RegisterVideoMode(Col, Row: Word; Color: Boolean; VideoModeSelector: TVideoModeSelector; Params: Longint);
-{ Registers a video mode to be selectable by SetVideoMode }
-
-{ moved to interface because we need a way to retrieve the modes }
-{ System independent part }
-type
-  PVideoModeList = ^TVideoModeList;
-  TVideoModeList = record
-    Col, Row: Word;
-    Color: Boolean;
-    VideoModeSelector: TVideoModeSelector;
-    Params: Longint;
-    Next: PVideoModeList;
-  end;
-
-const
-  Modes: PVideoModeList = nil;
-{$ifdef go32v2}
-var
-  VideoSeg    : word;
-{$endif go32v2}
-implementation
-
-
-{ Include system dependent part }
-{ must declare TargetEntry and TargetExit procedures
-  which can be empty of course }
-{$i video.inc}
-
-procedure GetVideoMode(var Mode: TVideoMode);
-begin
-  Mode.Col := ScreenWidth;
-  Mode.Row := ScreenHeight;
-  Mode.Color := ScreenColor;
-end;
-
-procedure SetVideoMode(Mode: TVideoMode);
-var
-  P: PVideoModeList;
-begin
-  P := Modes;
-  while (P<>Nil) and ((P^.Row <> Mode.Row) or (P^.Col <> Mode.Col) or (P^.Color<>Mode.Color)) do
-    P := P^.Next;
-  if P <> nil then begin
-    DoneVideo;
-    ScreenWidth:=$ffff;
-    ScreenHeight:=$ffff;
-    P^.VideoModeSelector(PVideoMode(P)^, P^.Params);
-    InitVideo;
-   end
-   else begin
-    ErrorHandler(errVioNoSuchMode, @Mode);
-  end;
-end;
-
-procedure RegisterVideoMode(Col, Row: Word; Color: Boolean; VideoModeSelector: TVideoModeSelector; Params: Longint);
-var
-  P: PVideoModeList;
-begin
-  New(P);
-  P^.Col := Col;
-  P^.Row := Row;
-  P^.Color := Color;
-  P^.VideoModeSelector := VideoModeSelector;
-  P^.Params := Params;
-  P^.Next := Modes;
-  Modes := P;
-end;
-
-
-var
-  OldExitProc : pointer;
-
-procedure UnRegisterVideoModes;{$ifdef PPC_BP}far;{$endif}
-var
-  P: PVideoModeList;
-begin
-  ExitProc:=OldExitProc;
-  TargetExit;
-  while assigned(modes) do
-   begin
-     p:=modes;
-     modes:=modes^.next;
-     dispose(p);
-   end;
-end;
-
-
-begin
-  RegisterVideoModes;
-  TargetEntry;
-  OldExitProc:=ExitProc;
-  ExitProc:=@UnRegisterVideoModes;
-end.
-{
-  $Log$
-  Revision 1.6  2000-11-13 17:22:22  pierre
-   merge NoExtendedFrame
-
-  Revision 1.1.2.4  2000/11/09 08:49:22  pierre
-   + NoExtendedFrame for terminals with only one graphic set
-
-  Revision 1.5  2000/10/15 20:50:17  hajny
-    * TVideoBuf again TP-compatible
-
-  Revision 1.4  2000/10/15 09:22:40  peter
-    * FVMaxWidth
-
-  Revision 1.3  2000/10/04 11:53:31  pierre
-   Add TargetEntry and TargetExit (merged)
-
-  Revision 1.2  2000/09/24 19:52:21  hajny
-    * max TVideoBuf size extended
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-}

+ 0 - 1281
api/linux/Makefile

@@ -1,1281 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# Default target
-#####################################################################
-
-override OS_TARGET:=linux
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# Pre Settings
-#####################################################################
-
-INC=../inc
-UNIXINC=../unix
-
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Default FPCDIR
-ifeq ($(FPCDIR),wrong)
-override FPCDIR=../..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-ifndef PACKAGESDIR
-PACKAGESDIR=$(FPCDIR)/packages
-endif
-ifndef TOOLKITSDIR
-TOOLKITSDIR=
-endif
-ifndef COMPONENTSDIR
-COMPONENTSDIR=
-endif
-
-# Create units dir
-ifneq ($(FPCDIR),.)
-UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override UNITOBJECTS+=$(APIOBJECTS) terminfo
-
-# Clean
-
-
-# Install
-
-UNITSUBDIR=api
-PACKAGENAME=api
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-vpath %$(PASEXT) $(INC)
-override NEEDUNITDIR=$(UNIXINC)
-override NEEDINCDIR=$(INC) $(UNIXINC)
-ifndef TARGETDIR
-TARGETDIR=.
-endif
-
-# Packages
-
-override PACKAGES+=rtl
-
-# Libraries
-
-LIBNAME=libfpapi.so
-LIBVERSION=1.0
-
-# Info
-
-INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ppumove
-ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUMOVE),)
-PPUMOVE=
-else
-PPUMOVE:=$(firstword $(PPUMOVE))
-endif
-endif
-export PPUMOVE
-
-# ppufiles
-ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUFILES),)
-PPUFILES=
-else
-PPUFILES:=$(firstword $(PPUFILES))
-endif
-endif
-export PPUFILES
-
-# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
-# upx uses that one itself (PFV)
-ifndef UPXPROG
-ifeq ($(OS_TARGET),go32v2)
-UPXPROG:=1
-endif
-ifeq ($(OS_TARGET),win32)
-UPXPROG:=1
-endif
-ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(UPXPROG),)
-UPXPROG=
-else
-UPXPROG:=$(firstword $(UPXPROG))
-endif
-else
-UPXPROG=
-endif
-endif
-export UPXPROG
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-#####################################################################
-# Default extensions
-#####################################################################
-
-# Default needed extensions (Go32v2,Linux)
-LOADEREXT=.as
-EXEEXT=.exe
-PPLEXT=.ppl
-PPUEXT=.ppu
-OEXT=.o
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.so
-RSTEXT=.rst
-FPCMADE=fpcmade
-
-# Go32v1
-ifeq ($(OS_TARGET),go32v1)
-PPUEXT=.pp1
-OEXT=.o1
-ASMEXT=.s1
-SMARTEXT=.sl1
-STATICLIBEXT=.a1
-SHAREDLIBEXT=.so1
-FPCMADE=fpcmade.v1
-endif
-
-# Go32v2
-ifeq ($(OS_TARGET),go32v2)
-FPCMADE=fpcmade.dos
-endif
-
-# Linux
-ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.lnx
-endif
-
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
-# Win32
-ifeq ($(OS_TARGET),win32)
-PPUEXT=.ppw
-OEXT=.ow
-ASMEXT=.sw
-SMARTEXT=.slw
-STATICLIBEXT=.aw
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.w32
-endif
-
-# OS/2
-ifeq ($(OS_TARGET),os2)
-PPUEXT=.ppo
-ASMEXT=.so2
-OEXT=.oo2
-SMARTEXT=.so
-STATICLIBEXT=.ao2
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.os2
-endif
-
-# library prefix
-LIBPREFIX=lib
-ifeq ($(OS_TARGET),go32v2)
-LIBPREFIX=
-endif
-ifeq ($(OS_TARGET),go32v1)
-LIBPREFIX=
-endif
-
-# determine which .pas extension is used
-ifndef PASEXT
-ifdef EXEOBJECTS
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
-else
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
-endif
-ifeq ($(TESTPAS),)
-PASEXT=.pp
-else
-PASEXT=.pas
-endif
-endif
-
-
-# Check if the dirs really exists, else turn it off
-ifeq ($(wildcard $(UNITSDIR)),)
-UNITSDIR=
-endif
-ifeq ($(wildcard $(TOOLKITSDIR)),)
-TOOLKITSDIR=
-endif
-ifeq ($(wildcard $(PACKAGESDIR)),)
-PACKAGESDIR=
-endif
-ifeq ($(wildcard $(COMPONENTSDIR)),)
-COMPONENTSDIR=
-endif
-
-
-# PACKAGESDIR packages
-
-PACKAGERTL=1
-
-ifdef PACKAGERTL
-ifneq ($(wildcard $(FPCDIR)/rtl),)
-ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
-PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
-else
-PACKAGEDIR_RTL=$(FPCDIR)/rtl
-endif
-ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_rtl
-package_rtl:
-	$(MAKE) -C $(PACKAGEDIR_RTL) all
-endif
-UNITDIR_RTL=$(PACKAGEDIR_RTL)
-else
-PACKAGEDIR_RTL=
-ifneq ($(wildcard $(UNITSDIR)/rtl),)
-ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
-UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
-else
-UNITDIR_RTL=$(UNITSDIR)/rtl
-endif
-else
-UNITDIR_RTL=
-endif
-endif
-ifdef UNITDIR_RTL
-override NEEDUNITDIR+=$(UNITDIR_RTL)
-endif
-endif
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-
-#####################################################################
-# Compiler Command Line
-#####################################################################
-
-# Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(CPU_TARGET)
-
-# Load commandline OPT and add target and unit dir to be sure
-ifneq ($(OS_TARGET),$(OS_SOURCE))
-override FPCOPT+=-T$(OS_TARGET)
-endif
-
-# User dirs should be first, so they are looked at first
-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
-
-# Smartlinking
-ifdef LINKSMART
-override FPCOPT+=-XX
-endif
-
-# Smartlinking creation
-ifdef CREATESMART
-override FPCOPT+=-CX
-endif
-
-# Debug
-ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
-endif
-
-# Release mode (strip, optimize and don't load ppc386.cfg)
-# 0.99.12b has a bug in the optimizer so don't use it by default
-ifdef RELEASE
-ifeq ($(FPC_VERSION),0.99.12)
-override FPCOPT+=-Xs -OGp3 -n
-else
-override FPCOPT+=-Xs -OG2p3 -n
-endif
-endif
-
-# Strip
-ifdef STRIP
-override FPCOPT+=-Xs
-endif
-
-# Optimizer
-ifdef OPTIMIZE
-override FPCOPT+=-OG2p3
-endif
-
-# Verbose settings (warning,note,info)
-ifdef VERBOSE
-override FPCOPT+=-vwni
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
-endif
-
-
-# Target dirs and the prefix to use for clean/install
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
-endif
-
-# Add commandline options last so they can override
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-
-# Add defines from FPCOPTDEF to FPCOPT
-ifdef FPCOPTDEF
-override FPCOPT+=$(FPCOPTDEF)
-endif
-
-# Error file ?
-ifdef ERRORFILE
-override FPCOPT+=-Fr$(ERRORFILE)
-endif
-
-# Was a config file specified ?
-ifdef CFGFILE
-override FPCOPT+=@$(CFGFILE)
-endif
-
-# For win32 the options are passed using the environment FPCEXTCMD
-ifeq ($(OS_SOURCE),win32)
-override FPCEXTCMD:=$(FPCOPT)
-override FPCOPT:=!FPCEXTCMD
-export FPCEXTCMD
-endif
-
-# Compiler commandline
-override COMPILER:=$(FPC) $(FPCOPT)
-
-# also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
-ifeq (,$(findstring -s ,$(COMPILER)))
-EXECPPAS=
-else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
-EXECPPAS:=@$(PPAS)
-endif
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: fpc_all
-
-debug: fpc_debug
-
-smart: fpc_smart
-
-shared: fpc_shared
-
-showinstall: fpc_showinstall
-
-install: fpc_install
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: fpc_clean
-
-distclean: fpc_distclean
-
-cleanall: fpc_cleanall
-
-info: fpc_info
-
-.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
-
-#####################################################################
-# Units
-#####################################################################
-
-.PHONY: fpc_units
-
-override ALLTARGET+=fpc_units
-
-override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
-override INSTALLPPUFILES+=$(UNITPPUFILES)
-override CLEANPPUFILES+=$(UNITPPUFILES)
-
-fpc_units: $(UNITPPUFILES)
-
-#####################################################################
-# General compile rules
-#####################################################################
-
-.PHONY: fpc_packages fpc_all fpc_debug
-
-$(FPCMADE): $(ALLTARGET)
-	@$(ECHO) Compiled > $(FPCMADE)
-
-fpc_packages: $(COMPILEPACKAGES)
-
-fpc_all: fpc_packages $(FPCMADE)
-
-fpc_debug:
-	$(MAKE) all DEBUG=1
-
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
-# General compile rules, available for both possible PASEXT
-
-.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
-
-%$(PPUEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(PPUEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-#####################################################################
-# Library
-#####################################################################
-
-.PHONY: fpc_smart fpc_shared
-
-ifdef LIBVERSION
-LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
-else
-LIBFULLNAME=$(LIBNAME)
-endif
-
-# Default sharedlib units are all unit objects
-ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
-endif
-
-fpc_smart:
-	$(MAKE) all LINKSMART=1 CREATESMART=1
-
-fpc_shared: all
-ifdef HASSHAREDLIB
-ifndef LIBNAME
-	@$(ECHO) "LIBNAME not set"
-else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
-endif
-else
-	@$(ECHO) "Shared Libraries not supported"
-endif
-
-#####################################################################
-# Install rules
-#####################################################################
-
-.PHONY: fpc_showinstall fpc_install
-
-ifdef EXTRAINSTALLUNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
-endif
-
-ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-ifdef PPUFILES
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
-endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-
-fpc_showinstall: $(SHOWINSTALLTARGET)
-ifdef INSTALLEXEFILES
-	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
-endif
-ifdef INSTALLPPUFILES
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
-ifneq ($(INSTALLPPULINKFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
-endif
-
-fpc_install: $(INSTALLTARGET)
-# Create UnitInstallFiles
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(BININSTALLDIR)
-# Compress the exes if upx is defined
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(UNITINSTALLDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
-	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	$(MKDIR) $(DATAINSTALLDIR)
-	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
-endif
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Clean rules
-#####################################################################
-
-.PHONY: fpc_clean fpc_cleanall fpc_distclean
-
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
-ifdef EXTRACLEANUNITS
-override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
-endif
-
-ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
-ifdef PPUFILES
-CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
-else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
-endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
-endif
-
-fpc_clean: $(CLEANTARGET)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-ifdef CLEANPPUFILES
-	-$(DEL) $(CLEANPPUFILES)
-endif
-ifneq ($(CLEANPPULINKFILES),)
-	-$(DEL) $(CLEANPPULINKFILES)
-endif
-ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
-endif
-ifdef EXTRACLEANFILES
-	-$(DEL) $(EXTRACLEANFILES)
-endif
-ifdef LIBNAME
-	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
-endif
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-fpc_distclean: fpc_clean
-
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-	-$(DELTREE) *$(SMARTEXT)
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-#####################################################################
-# Info rules
-#####################################################################
-
-.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
-	fpc_dirinfo
-
-fpc_info: $(INFOTARGET)
-
-fpc_infocfg:
-	@$(ECHO)
-	@$(ECHO)  == Configuration info ==
-	@$(ECHO)
-	@$(ECHO)  FPC....... $(FPC)
-	@$(ECHO)  Version... $(FPC_VERSION)
-	@$(ECHO)  CPU....... $(CPU_TARGET)
-	@$(ECHO)  Source.... $(OS_SOURCE)
-	@$(ECHO)  Target.... $(OS_TARGET)
-	@$(ECHO)
-
-fpc_infoobjects:
-	@$(ECHO)
-	@$(ECHO)  == Object info ==
-	@$(ECHO)
-	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
-	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
-	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
-	@$(ECHO)
-	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
-	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
-	@$(ECHO)
-	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
-	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
-	@$(ECHO)
-
-fpc_infoinstall:
-	@$(ECHO)
-	@$(ECHO)  == Install info ==
-	@$(ECHO)
-ifdef DATE
-	@$(ECHO)  DateStr.............. $(DATESTR)
-endif
-ifdef PACKAGEPREFIX
-	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
-endif
-ifdef PACKAGENAME
-	@$(ECHO)  PackageName.......... $(PACKAGENAME)
-endif
-	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
-	@$(ECHO)
-	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
-	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
-	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
-	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
-	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
-	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
-	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
-	@$(ECHO)
-	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
-	@$(ECHO)  ZipName.............. $(ZIPNAME)
-	@$(ECHO)
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-
-#####################################################################
-# Users rules
-#####################################################################
-
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas $(UNIXINC)/keyboard.inc 
-
-mouse$(PPUEXT): $(INC)/mouse.pas $(UNIXINC)/mouse.inc 
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas $(UNIXINC)/filectrl.inc  
-
-video$(PPUEXT): $(INC)/video.pas $(UNIXINC)/video.inc 

+ 0 - 44
api/linux/Makefile.fpc

@@ -1,44 +0,0 @@
-#
-#   Makefile.fpc for Free Pascal API (used by Free Vision) for linux
-#
-
-[defaults]
-defaulttarget=linux
-
-[targets]
-units= $(APIOBJECTS) terminfo
-
-[install]
-unitsubdir=api
-packagename=api
-
-[libs]
-libname=libfpapi.so
-libversion=1.0
-
-[dirs]
-fpcdir=../..
-targetdir=.
-sourcesdir=$(INC)
-incdir=$(INC) $(UNIXINC)
-unitdir=$(UNIXINC)
-
-[presettings]
-INC=../inc
-UNIXINC=../unix
-
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-
-[rules]
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas $(UNIXINC)/keyboard.inc 
-
-mouse$(PPUEXT): $(INC)/mouse.pas $(UNIXINC)/mouse.inc 
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas $(UNIXINC)/filectrl.inc  
-
-video$(PPUEXT): $(INC)/video.pas $(UNIXINC)/video.inc 

+ 0 - 2
api/maketp.bat

@@ -1,2 +0,0 @@
-bpc /M tpapi -Uinc -Iinc -Utp -Itp -E.
-del tpapi.exe

+ 0 - 1276
api/os2/Makefile

@@ -1,1276 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# Default target
-#####################################################################
-
-override OS_TARGET:=os2
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# Pre Settings
-#####################################################################
-
-INC=../inc
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Default FPCDIR
-ifeq ($(FPCDIR),wrong)
-override FPCDIR=../..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-ifndef PACKAGESDIR
-PACKAGESDIR=$(FPCDIR)/packages
-endif
-ifndef TOOLKITSDIR
-TOOLKITSDIR=
-endif
-ifndef COMPONENTSDIR
-COMPONENTSDIR=
-endif
-
-# Create units dir
-ifneq ($(FPCDIR),.)
-UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override UNITOBJECTS+=$(APIOBJECTS)
-
-# Clean
-
-
-# Install
-
-UNITSUBDIR=api
-PACKAGENAME=api
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-vpath %$(PASEXT) $(INC)
-override NEEDINCDIR=$(INC)
-ifndef TARGETDIR
-TARGETDIR=.
-endif
-
-# Packages
-
-override PACKAGES+=rtl
-
-# Libraries
-
-LIBNAME=fpapi
-
-# Info
-
-INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ppumove
-ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUMOVE),)
-PPUMOVE=
-else
-PPUMOVE:=$(firstword $(PPUMOVE))
-endif
-endif
-export PPUMOVE
-
-# ppufiles
-ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUFILES),)
-PPUFILES=
-else
-PPUFILES:=$(firstword $(PPUFILES))
-endif
-endif
-export PPUFILES
-
-# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
-# upx uses that one itself (PFV)
-ifndef UPXPROG
-ifeq ($(OS_TARGET),go32v2)
-UPXPROG:=1
-endif
-ifeq ($(OS_TARGET),win32)
-UPXPROG:=1
-endif
-ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(UPXPROG),)
-UPXPROG=
-else
-UPXPROG:=$(firstword $(UPXPROG))
-endif
-else
-UPXPROG=
-endif
-endif
-export UPXPROG
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-#####################################################################
-# Default extensions
-#####################################################################
-
-# Default needed extensions (Go32v2,Linux)
-LOADEREXT=.as
-EXEEXT=.exe
-PPLEXT=.ppl
-PPUEXT=.ppu
-OEXT=.o
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.so
-RSTEXT=.rst
-FPCMADE=fpcmade
-
-# Go32v1
-ifeq ($(OS_TARGET),go32v1)
-PPUEXT=.pp1
-OEXT=.o1
-ASMEXT=.s1
-SMARTEXT=.sl1
-STATICLIBEXT=.a1
-SHAREDLIBEXT=.so1
-FPCMADE=fpcmade.v1
-endif
-
-# Go32v2
-ifeq ($(OS_TARGET),go32v2)
-FPCMADE=fpcmade.dos
-endif
-
-# Linux
-ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.lnx
-endif
-
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
-# Win32
-ifeq ($(OS_TARGET),win32)
-PPUEXT=.ppw
-OEXT=.ow
-ASMEXT=.sw
-SMARTEXT=.slw
-STATICLIBEXT=.aw
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.w32
-endif
-
-# OS/2
-ifeq ($(OS_TARGET),os2)
-PPUEXT=.ppo
-ASMEXT=.so2
-OEXT=.oo2
-SMARTEXT=.so
-STATICLIBEXT=.ao2
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.os2
-endif
-
-# library prefix
-LIBPREFIX=lib
-ifeq ($(OS_TARGET),go32v2)
-LIBPREFIX=
-endif
-ifeq ($(OS_TARGET),go32v1)
-LIBPREFIX=
-endif
-
-# determine which .pas extension is used
-ifndef PASEXT
-ifdef EXEOBJECTS
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
-else
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
-endif
-ifeq ($(TESTPAS),)
-PASEXT=.pp
-else
-PASEXT=.pas
-endif
-endif
-
-
-# Check if the dirs really exists, else turn it off
-ifeq ($(wildcard $(UNITSDIR)),)
-UNITSDIR=
-endif
-ifeq ($(wildcard $(TOOLKITSDIR)),)
-TOOLKITSDIR=
-endif
-ifeq ($(wildcard $(PACKAGESDIR)),)
-PACKAGESDIR=
-endif
-ifeq ($(wildcard $(COMPONENTSDIR)),)
-COMPONENTSDIR=
-endif
-
-
-# PACKAGESDIR packages
-
-PACKAGERTL=1
-
-ifdef PACKAGERTL
-ifneq ($(wildcard $(FPCDIR)/rtl),)
-ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
-PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
-else
-PACKAGEDIR_RTL=$(FPCDIR)/rtl
-endif
-ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_rtl
-package_rtl:
-	$(MAKE) -C $(PACKAGEDIR_RTL) all
-endif
-UNITDIR_RTL=$(PACKAGEDIR_RTL)
-else
-PACKAGEDIR_RTL=
-ifneq ($(wildcard $(UNITSDIR)/rtl),)
-ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
-UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
-else
-UNITDIR_RTL=$(UNITSDIR)/rtl
-endif
-else
-UNITDIR_RTL=
-endif
-endif
-ifdef UNITDIR_RTL
-override NEEDUNITDIR+=$(UNITDIR_RTL)
-endif
-endif
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-
-#####################################################################
-# Compiler Command Line
-#####################################################################
-
-# Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(CPU_TARGET)
-
-# Load commandline OPT and add target and unit dir to be sure
-ifneq ($(OS_TARGET),$(OS_SOURCE))
-override FPCOPT+=-T$(OS_TARGET)
-endif
-
-# User dirs should be first, so they are looked at first
-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
-
-# Smartlinking
-ifdef LINKSMART
-override FPCOPT+=-XX
-endif
-
-# Smartlinking creation
-ifdef CREATESMART
-override FPCOPT+=-CX
-endif
-
-# Debug
-ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
-endif
-
-# Release mode (strip, optimize and don't load ppc386.cfg)
-# 0.99.12b has a bug in the optimizer so don't use it by default
-ifdef RELEASE
-ifeq ($(FPC_VERSION),0.99.12)
-override FPCOPT+=-Xs -OGp3 -n
-else
-override FPCOPT+=-Xs -OG2p3 -n
-endif
-endif
-
-# Strip
-ifdef STRIP
-override FPCOPT+=-Xs
-endif
-
-# Optimizer
-ifdef OPTIMIZE
-override FPCOPT+=-OG2p3
-endif
-
-# Verbose settings (warning,note,info)
-ifdef VERBOSE
-override FPCOPT+=-vwni
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
-endif
-
-
-# Target dirs and the prefix to use for clean/install
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
-endif
-
-# Add commandline options last so they can override
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-
-# Add defines from FPCOPTDEF to FPCOPT
-ifdef FPCOPTDEF
-override FPCOPT+=$(FPCOPTDEF)
-endif
-
-# Error file ?
-ifdef ERRORFILE
-override FPCOPT+=-Fr$(ERRORFILE)
-endif
-
-# Was a config file specified ?
-ifdef CFGFILE
-override FPCOPT+=@$(CFGFILE)
-endif
-
-# For win32 the options are passed using the environment FPCEXTCMD
-ifeq ($(OS_SOURCE),win32)
-override FPCEXTCMD:=$(FPCOPT)
-override FPCOPT:=!FPCEXTCMD
-export FPCEXTCMD
-endif
-
-# Compiler commandline
-override COMPILER:=$(FPC) $(FPCOPT)
-
-# also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
-ifeq (,$(findstring -s ,$(COMPILER)))
-EXECPPAS=
-else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
-EXECPPAS:=@$(PPAS)
-endif
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: fpc_all
-
-debug: fpc_debug
-
-smart: fpc_smart
-
-shared: fpc_shared
-
-showinstall: fpc_showinstall
-
-install: fpc_install
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: fpc_clean
-
-distclean: fpc_distclean
-
-cleanall: fpc_cleanall
-
-info: fpc_info
-
-.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
-
-#####################################################################
-# Units
-#####################################################################
-
-.PHONY: fpc_units
-
-override ALLTARGET+=fpc_units
-
-override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
-override INSTALLPPUFILES+=$(UNITPPUFILES)
-override CLEANPPUFILES+=$(UNITPPUFILES)
-
-fpc_units: $(UNITPPUFILES)
-
-#####################################################################
-# General compile rules
-#####################################################################
-
-.PHONY: fpc_packages fpc_all fpc_debug
-
-$(FPCMADE): $(ALLTARGET)
-	@$(ECHO) Compiled > $(FPCMADE)
-
-fpc_packages: $(COMPILEPACKAGES)
-
-fpc_all: fpc_packages $(FPCMADE)
-
-fpc_debug:
-	$(MAKE) all DEBUG=1
-
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
-# General compile rules, available for both possible PASEXT
-
-.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
-
-%$(PPUEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(PPUEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-#####################################################################
-# Library
-#####################################################################
-
-.PHONY: fpc_smart fpc_shared
-
-ifdef LIBVERSION
-LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
-else
-LIBFULLNAME=$(LIBNAME)
-endif
-
-# Default sharedlib units are all unit objects
-ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
-endif
-
-fpc_smart:
-	$(MAKE) all LINKSMART=1 CREATESMART=1
-
-fpc_shared: all
-ifdef HASSHAREDLIB
-ifndef LIBNAME
-	@$(ECHO) "LIBNAME not set"
-else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
-endif
-else
-	@$(ECHO) "Shared Libraries not supported"
-endif
-
-#####################################################################
-# Install rules
-#####################################################################
-
-.PHONY: fpc_showinstall fpc_install
-
-ifdef EXTRAINSTALLUNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
-endif
-
-ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-ifdef PPUFILES
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
-endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-
-fpc_showinstall: $(SHOWINSTALLTARGET)
-ifdef INSTALLEXEFILES
-	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
-endif
-ifdef INSTALLPPUFILES
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
-ifneq ($(INSTALLPPULINKFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
-endif
-
-fpc_install: $(INSTALLTARGET)
-# Create UnitInstallFiles
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(BININSTALLDIR)
-# Compress the exes if upx is defined
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(UNITINSTALLDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
-	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	$(MKDIR) $(DATAINSTALLDIR)
-	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
-endif
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Clean rules
-#####################################################################
-
-.PHONY: fpc_clean fpc_cleanall fpc_distclean
-
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
-ifdef EXTRACLEANUNITS
-override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
-endif
-
-ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
-ifdef PPUFILES
-CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
-else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
-endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
-endif
-
-fpc_clean: $(CLEANTARGET)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-ifdef CLEANPPUFILES
-	-$(DEL) $(CLEANPPUFILES)
-endif
-ifneq ($(CLEANPPULINKFILES),)
-	-$(DEL) $(CLEANPPULINKFILES)
-endif
-ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
-endif
-ifdef EXTRACLEANFILES
-	-$(DEL) $(EXTRACLEANFILES)
-endif
-ifdef LIBNAME
-	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
-endif
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-fpc_distclean: fpc_clean
-
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-	-$(DELTREE) *$(SMARTEXT)
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-#####################################################################
-# Info rules
-#####################################################################
-
-.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
-	fpc_dirinfo
-
-fpc_info: $(INFOTARGET)
-
-fpc_infocfg:
-	@$(ECHO)
-	@$(ECHO)  == Configuration info ==
-	@$(ECHO)
-	@$(ECHO)  FPC....... $(FPC)
-	@$(ECHO)  Version... $(FPC_VERSION)
-	@$(ECHO)  CPU....... $(CPU_TARGET)
-	@$(ECHO)  Source.... $(OS_SOURCE)
-	@$(ECHO)  Target.... $(OS_TARGET)
-	@$(ECHO)
-
-fpc_infoobjects:
-	@$(ECHO)
-	@$(ECHO)  == Object info ==
-	@$(ECHO)
-	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
-	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
-	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
-	@$(ECHO)
-	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
-	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
-	@$(ECHO)
-	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
-	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
-	@$(ECHO)
-
-fpc_infoinstall:
-	@$(ECHO)
-	@$(ECHO)  == Install info ==
-	@$(ECHO)
-ifdef DATE
-	@$(ECHO)  DateStr.............. $(DATESTR)
-endif
-ifdef PACKAGEPREFIX
-	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
-endif
-ifdef PACKAGENAME
-	@$(ECHO)  PackageName.......... $(PACKAGENAME)
-endif
-	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
-	@$(ECHO)
-	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
-	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
-	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
-	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
-	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
-	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
-	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
-	@$(ECHO)
-	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
-	@$(ECHO)  ZipName.............. $(ZIPNAME)
-	@$(ECHO)
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-
-#####################################################################
-# Users rules
-#####################################################################
-
-video$(PPUEXT): $(INC)/video.pas video.inc
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc
-
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc

+ 0 - 40
api/os2/Makefile.fpc

@@ -1,40 +0,0 @@
-#
-#   Makefile.fpc for Free Pascal API (used by Free Vision) for os2
-#
-
-[defaults]
-defaulttarget=os2
-
-[targets]
-units=$(APIOBJECTS)
-
-[install]
-unitsubdir=api
-packagename=api
-
-[libs]
-libname=fpapi
-
-[dirs]
-fpcdir=../..
-targetdir=.
-sourcesdir=$(INC)
-incdir=$(INC)
-
-[presettings]
-INC=../inc
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-
-
-[rules]
-video$(PPUEXT): $(INC)/video.pas video.inc
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc
-
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc

+ 0 - 178
api/os2/filectrl.inc

@@ -1,178 +0,0 @@
-{
-  System independent filecontrol interface for os2
-
-  $Id$
-}
-
-{$IFDEF PPC_Virtual}
-  uses
-    OS2Base;
-{$ENDIF}
-{$IFDEF PPC_Speed}
-  uses
-    BseDOS;
-{$ENDIF}
-{$IFDEF PPC_FPC}
-  uses
-    DosCalls;
-{$ENDIF}
-
-{ not converted to the new error handling scheme (ie: calling
-  ErrorHandler, instead of dumping an error code to ErrorCode) }
-
-{$IFDEF BIT_16}
-
-{ There's a unit for DOSCALLS for BPOS2 available as well, should be using
-  these functions from there... }
-
-function DosClose (Handle: Word): Word; far;
-  external 'DOSCALLS' Index 59;                    { Dos close function }
-
-function DosOpen (FileName: PChar; var Handle: Word;
-  var ActionTaken: Word; FileSize: LongInt;
-  FileAttr: Word; OpenFlag, OpenMode: Word;
-  Reserved: Pointer): Word; far;
-  external 'DOSCALLS' index 70;                    { Dos open function }
-
-function DosDelete(FileName: PChar; Reserved: Longint): Word; far;
-  external 'DOSCALLS' index 60;
-
-function DosRead(Handle: Word; var BufferArea;
-  BufferLength: Word; var BytesRead : Word): Word; far;
-  external 'DOSCALLS' index 137;                   { Dos read procedure }
-
-function DosWrite(Handle: Word; var BufferArea;
-  BufferLength: Word; var BytesRead : Word): Word; far;
-  external 'DOSCALLS' index 138;                   { Dos write procedure }
-
-function DosSetFilePtr (Handle: Word; ulOffset: LongInt;
-  MoveType: Word; var NewPointer: LongInt): LongInt; far;
-  external 'DOSCALLS' index 58;                    { Dos seek procedure }
-
-function DosGetFilePtr (Handle: Word; var CurPos: longint): longint;
-begin
-  DosGetFilePtr := DosSetFilePtr (Handle, 0, skCur, CurPos);
-end;
-
-function DosResetBuffer (Handle: Word): longint; far;
-  external 'DOSCALLS' index 56;                    { Dos flush procedure }
-
-function DosSetFileSize (Handle: Word; Size: longint): longint; far;
-  external 'DOSCALLS' index 68;                    { Dos write procedure }
-
-{$ENDIF}
-
-function OpenFileStr(FName: PChar; Flags: Longint): TFileHandle;
-var
-  Handle, ActionTaken: CPUWord;
-begin
-  ErrorCode := DosOpen(FName, Handle, ActionTaken, 0, $20, 1, Flags, nil);
-  if ErrorCode <> 0 then
-    OpenFileStr := -1
-   else begin
-    OpenFileStr := Handle;
-    ErrorCode := 0;
-  end;
-end;
-
-function CreateFileStr(FName: PChar): TFileHandle;
-var
-  Handle, ActionTaken: CPUWord;
-begin
-  ErrorCode := DosOpen(FName, Handle, ActionTaken, 0, $20, $12, 1, nil);
-  if ErrorCode <> 0 then
-    CreateFileStr := -1
-   else begin
-    CreateFileStr := Handle;
-    ErrorCode := 0;
-  end;
-end;
-
-procedure CloseFile(Handle: TFileHandle);
-begin
-  ErrorCode := DosClose(Handle);
-end;
-
-procedure DeleteFileStr(FName: PChar);
-begin
-  ErrorCode := DosDelete(FName);
-end;
-
-function ReadFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  BuffRead: CPUWord;
-begin
-  ErrorCode := DosRead(Handle, Buff, Count, BuffRead);
-  if ErrorCode <> 0 then
-    ReadFile := 0
-   else begin
-    ReadFile := BuffRead;
-  end;
-end;
-
-function WriteFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  BuffWritten: CPUWord;
-begin
-  ErrorCode := DosWrite(Handle, Buff, Count, BuffWritten);
-  if ErrorCode <> 0 then
-    WriteFile := 0
-   else begin
-    WriteFile := BuffWritten;
-  end;
-end;
-
-function SeekFile(Handle: TFileHandle; Pos: TFileInt; SeekType: Word): TFileInt;
-var
-  NewPos: Longint;
-begin
-  ErrorCode := DosSetFilePtr(Handle, Pos, SeekType, NewPos);
-  if ErrorCode <> 0 then
-    SeekFile := -1
-   else begin
-    SeekFile := NewPos;
-  end;
-end;
-
-procedure FlushFile(Handle: TFileHandle);
-begin
-  ErrorCode := DosResetBuffer (Handle);
-end;
-
-procedure TruncateFile(Handle: TFileHandle);
-var
-  CurPos: longint;
-begin
-  ErrorCode := DosGetFilePtr(Handle, CurPos);
-  if ErrorCode = 0 then ErrorCode := DosSetFileSize (Handle, CurPos);
-end;
-
-function EndOfFile(Handle: TFileHandle): Boolean;
-begin
-  EndOfFile := FilePos(Handle) >= FileSize(Handle);
-end;
-
-function FilePos(Handle: TFileHandle): TFileInt;
-begin
-  FilePos := SeekFile(Handle, 0, skCur);
-end;
-
-function FileSize(Handle: TFileHandle): TFileInt;
-var
-  L: Longint;
-begin
-  L := FilePos(Handle);
-  FileSize := SeekFile(Handle, 0, skEnd);
-  SeekFile(Handle, L, skBeg);
-end;
-
-
-{
-  $Log$
-  Revision 1.3  2000-12-17 20:39:46  hajny
-    * OS/2 implementation corrected and finished
-
-  Revision 1.2  2000/07/13 11:32:25  michael
-  + removed logs
- 
-}

+ 0 - 186
api/os2/keyboard.inc

@@ -1,186 +0,0 @@
-{
-  System independent keyboard interface for os2
-
-  $Id$
-}
-uses
-{$IFDEF PPC_FPC}
- KbdCalls, DosCalls;
-{$ELSE}
- {$IFDEF PPC_VIRTUAL}
- OS2Base;
- {$ELSE}
-  {$IFDEF PPC_BPOS2}
- Os2Subs, DosProcs;
-  {$ELSE}
-   {$IFDEF PPC_SPEED}
- BseSub, BseDos;
-   {$ENDIF}
-  {$ENDIF}
- {$ENDIF} 
-{$ENDIF}
-
-{$IFDEF PPC_VIRTUAL}
-type
- TKbdKeyInfo = KbdKeyInfo;
- TKbdInfo = KbdInfo;
-{$ELSE}
- {$IFDEF PPC_SPEED}
-type
- TKbdKeyInfo = KbdKeyInfo;
- TKbdInfo = KbdInfo;
- {$ENDIF}
-{$ENDIF}
-{$IFNDEF PPC_FPC}
-type
- cardinal = longint;
-{$ENDIF}
-
-const
- DefaultKeyboard = 0;
- Handle: word = DefaultKeyboard;
-
-procedure InitKeyboard;
-var
- K: TKbdInfo;
-begin
- if KbdGetFocus (IO_Wait, DefaultKeyboard) = No_Error then
- begin
-  if KbdOpen (Handle) <> No_Error then Handle := DefaultKeyboard;
-  KbdFlushBuffer (Handle);
-  KbdFreeFocus (DefaultKeyboard);
-  KbdGetFocus (IO_Wait, Handle);
-  K.cb := 10;
-  KbdGetStatus (K, Handle);
-  K.fsMask := $14;
-  KbdSetStatus (K, Handle);
- end;
-end;
-
-procedure DoneKeyboard;
-begin
- KbdFreeFocus (Handle);
- if KbdGetFocus (IO_Wait, DefaultKeyboard) = No_Error then
- begin
-  KbdClose (Handle);
-  Handle := DefaultKeyboard;
-  KbdFreeFocus (DefaultKeyboard);
- end;
-end;
-
-function GetKeyEvent: TKeyEvent;
-var
- K: TKbdKeyInfo;
-begin
- if PendingKeyEvent <> 0 then
- begin
-  GetKeyEvent := PendingKeyEvent;
-  PendingKeyEvent := 0;
- end else
- begin
-  KbdGetFocus (IO_Wait, Handle);
-  while (KbdCharIn (K, IO_Wait, Handle) <> No_Error)
-                                   or (K.fbStatus and $40 = 0) do DosSleep (5);
-  with K do
-  begin
-   if (byte (chChar) = $E0) and (fbStatus and 2 <> 0) then chChar := #0;
-   GetKeyEvent := cardinal ($0300 or fsState and $F) shl 16 or
-                               cardinal (byte (chScan)) shl 8 or byte (chChar);
-  end;
- end;
-end;
-
-function PollKeyEvent: TKeyEvent;
-var
- K: TKbdKeyInfo;
-begin
- if PendingKeyEvent = 0 then
- begin
-  KbdGetFocus (IO_NoWait, Handle);
-  if (KbdCharIn (K, IO_NoWait, Handle) <> No_Error) or
-                 (K.fbStatus and $40 = 0) then FillChar (K, SizeOf (K), 0) else
-  with K do
-  begin
-   if (byte (chChar) = $E0) and (fbStatus and 2 <> 0) then chChar := #0;
-   PendingKeyEvent := cardinal ($0300 or fsState and $F) shl 16 or
-                               cardinal (byte (chScan)) shl 8 or byte (chChar);
-  end;
- end;
- PollKeyEvent := PendingKeyEvent;
- if PendingKeyEvent and $FFFF = 0 then PendingKeyEvent := 0;
-end;
-
-function PollShiftStateEvent: TKeyEvent;
-var
- K: TKbdInfo;
-begin
- KbdGetFocus (IO_NoWait, Handle);
- KbdGetStatus (K, Handle);
- PollShiftStateEvent := cardinal (K.fsState and $F) shl 16;
-end;
-
-type
-{$IFDEF PPC_FPC}
- TTranslationEntry = packed record
-{$ELSE}
- TTranslationEntry = record
-{$ENDIF}
-  Min, Max: byte;
-  Offset: word;
- end;
-
-const
- TranslationTableEntries = 12;
- TranslationTable: array [1..TranslationTableEntries] of TTranslationEntry =
-    ((Min: $3B; Max: $44; Offset: kbdF1),   { function keys F1-F10 }
-     (Min: $54; Max: $5D; Offset: kbdF1),   { Shift fn keys F1-F10 }
-     (Min: $5E; Max: $67; Offset: kbdF1),   { Ctrl fn keys F1-F10 }
-     (Min: $68; Max: $71; Offset: kbdF1),   { Alt fn keys F1-F10 }
-     (Min: $85; Max: $86; Offset: kbdF11),  { function keys F11-F12 }
-     (Min: $87; Max: $88; Offset: kbdF11),  { Shift+function keys F11-F12 }
-     (Min: $89; Max: $8A; Offset: kbdF11),  { Ctrl+function keys F11-F12 }
-     (Min: $8B; Max: $8C; Offset: kbdF11),  { Alt+function keys F11-F12 }
-     (Min:  71; Max:  73; Offset: kbdHome), { Keypad keys kbdHome-kbdPgUp }
-     (Min:  75; Max:  77; Offset: kbdLeft), { Keypad keys kbdLeft-kbdRight }
-     (Min:  79; Max:  81; Offset: kbdEnd),  { Keypad keys kbdEnd-kbdPgDn }
-     (Min: $52; Max: $53; Offset: kbdInsert));
-
-
-function TranslateKeyEvent (KeyEvent: TKeyEvent): TKeyEvent;
-var
- I: integer;
- ScanCode: byte;
-begin
- if KeyEvent and $03000000 = $03000000 then
- begin
-  if (KeyEvent and $000000FF <> 0) and (KeyEvent and $000000FF <> $E0) then
-                               TranslateKeyEvent := KeyEvent and $00FFFFFF else
-  begin
-{ This is a function key }
-   ScanCode := (KeyEvent and $0000FF00) shr 8;
-   I := 1;
-   while (I <= TranslationTableEntries) and
-       ((TranslationTable [I].Min > ScanCode) or
-                             (ScanCode > TranslationTable [I].Max)) do Inc (I);
-   if I > TranslationTableEntries then TranslateKeyEvent := KeyEvent else
-           TranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) +
-             (ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
-  end;
- end else TranslateKeyEvent := KeyEvent;
-end;
-
-function TranslateKeyEventUniCode (KeyEvent: TKeyEvent): TKeyEvent;
-begin
- TranslateKeyEventUniCode := KeyEvent;
- ErrorHandler (errKbdNotImplemented, nil);
-end;
-
-{
-  $Log$
-  Revision 1.3  2000-10-08 18:41:58  hajny
-    * $E0 for ext. keys correctly discarded now
-
-  Revision 1.2  2000/07/13 11:32:26  michael
-  + removed logs
- 
-}

+ 0 - 415
api/os2/mouse.inc

@@ -1,415 +0,0 @@
-{
-  System independent mouse interface for OS/2
-
-  $Id$
-}
-
-uses
- Video,
-{$IFDEF PPC_VIRTUAL}
- OS2Base;
-{$ELSE}
- {$IFDEF PPC_FPC}
- MouCalls, DosCalls;
- {$ELSE}
-  {$IFDEF PPC_SPEED}
- BseSub, BseDos;
-  {$ELSE}
-   {$IFDEF PPC_BPOS2}
- OS2Subs, DosProcs;
-   {$ENDIF}
-  {$ENDIF}
- {$ENDIF}
-{$ENDIF}
-
-{$IFDEF PPC_VIRTUAL}
-type
- cardinal = longint;
- TMouEventInfo = MouEventInfo;
- TNoPtrRect = NoPtrRect;
- TPtrLoc = PtrLoc;
- TMouQueInfo = MouQueInfo;
-{$ELSE}
- {$IFDEF PPC_SPEED}
-type
- cardinal = longword;
- TMouEventInfo = MouEventInfo;
- TNoPtrRect = NoPtrRect;
- TPtrLoc = PtrLoc;
- TMouQueInfo = MouQueInfo;
- {$ELSE}
-  {$IFDEF PPC_BPOS2}
-type
- cardinal = longint;
-  {$ENDIF}
- {$ENDIF}
-{$ENDIF}
-
-var
- PendingMouseEventOrder: array [0..MouseEventBufSize-1] of cardinal;
- MouseEventOrderHead, MouseEventOrderTail: cardinal;
-
-const
- NoMouse = $FFFF;
- DefaultMouse = 0;
- Handle: word = DefaultMouse;
- HideCounter: cardinal = 0;
- OldEventMask: longint = -1;
-
-procedure InitMouse;
-var
- Loc: TPtrLoc;
- SetPrev: boolean;
- SysEvent: TMouEventInfo;
- QI: TMouQueInfo;
- W: word;
-begin
- SetPrev := MouGetPtrPos (Loc, DefaultMouse) = 0;
- if MouGetEventMask (W, DefaultMouse) = 0 then OldEventMask := W;
- PendingMouseHead := @PendingMouseEvent;
- PendingMouseTail := @PendingMouseEvent;
- PendingMouseEvents := 0;
- FillChar (LastMouseEvent, SizeOf (TMouseEvent), 0);
- MouseEventOrderTail := 0;
- MouseEventOrderHead := 0;
- HideCounter := 0;
- if MouOpen (nil, Handle) = Error_Mouse_No_Device then Handle := NoMouse else
- begin
-  W := Mou_NoWait;
-  repeat
-   MouGetNumQueEl (QI, Handle);
-   if QI.cEvents <> 0 then MouReadEventQue (SysEvent, W, Handle);
-  until QI.cEvents = 0;
-  W := $FFFF;
-  MouSetEventMask (W, Handle);
-  if SetPrev then MouSetPtrPos (Loc, Handle);
-
-(*
- It would be possible to issue a MouRegister call here to hook our own mouse
- handler, but such handler would have to be in a DLL and it's questionable,
- whether there would be so many advantages in doing so.
-*)
-
-  MouDrawPtr (Handle);
- end;
-end;
-
-procedure DoneMouse;
-var
- W: word;
-begin
- if (Handle <> NoMouse) and (Handle <> DefaultMouse) then
- begin
-
-(*
- If our own mouse handler would be installed in InitMouse, MouDeregister would
- have appeared here.
-*)
-
-  HideCounter := 0;
-  HideMouse;
-  MouClose (Handle);
- end;
- if OldEventMask <> -1 then
- begin
-  W := OldEventMask;
-  MouSetEventMask (W, 0);
- end;
-end;
-
-function DetectMouse:byte;
-var
- Buttons: word;
- RC: longint;
- TempHandle: word;
-begin
- MouOpen (nil, TempHandle);
- if MouGetNumButtons (Buttons, TempHandle) = 0 then DetectMouse := Buttons
-                                                         else DetectMouse := 0;
- MouClose (TempHandle);
-end;
-
-procedure ShowMouse;
-begin
- if Handle <> NoMouse then
- begin
-  if HideCounter <> 0 then
-  begin
-   Dec (HideCounter);
-   if HideCounter = 0 then MouDrawPtr (Handle);
-  end;
- end;
-end;
-
-procedure HideMouse;
-var
- PtrRect: TNoPtrRect;
-begin
- if Handle <> NoMouse then
- begin
-  Inc (HideCounter);
-  case HideCounter of
-   0: Dec (HideCounter); (* HideCounter overflowed - stay at the maximum *)
-   1: begin
-       PtrRect.Row := 0;
-       PtrRect.Col := 0;
-       PtrRect.cRow := Pred (ScreenHeight);
-       PtrRect.cCol := Pred (ScreenWidth);
-       MouRemovePtr (PtrRect, Handle);
-      end;
-  end;
- end;
-end;
-
-function GetMouseX: word;
-var
- Event: TMouseEvent;
-begin
- if Handle = NoMouse then GetMouseX := 0 else
- begin
-  PollMouseEvent (Event);
-  GetMouseX := Event.X;
- end;
-end;
-
-function GetMouseY: word;
-var
- Event: TMouseEvent;
-begin
- if Handle = NoMouse then GetMouseY := 0 else
- begin
-  PollMouseEvent (Event);
-  GetMouseY := Event.Y;
- end;
-end;
-
-procedure GetMouseXY (var X: word; var Y: word);
-var
- Loc: TPtrLoc;
-begin
- if Handle = NoMouse then
- begin
-  X := 0;
-  Y := 0;
- end else if MouGetPtrPos (Loc, Handle) <> 0 then
- begin
-  X := $FFFF;
-  Y := $FFFF;
- end else
- begin
-  X := Loc.Col;
-  Y := Loc.Row;
- end;
-end;
-
-procedure SetMouseXY (X, Y: word);
-var
- Loc: TPtrLoc;
-begin
- if Handle <> NoMouse then
- begin
-  Loc.Row := Y;
-  Loc.Col := X;
-  MouSetPtrPos (Loc, Handle);
- end;
-end;
-
-procedure TranslateEvents (const SysEvent: TMouEventInfo;
-                                                       var Event: TMouseEvent);
-begin
- Event.Buttons := 0;
- Event.Action := 0;
- if SysEvent.fs and (Mouse_Motion_With_BN1_Down or Mouse_BN1_Down) <> 0 then
-                             Event.Buttons := Event.Buttons or MouseLeftButton;
- if SysEvent.fs and (Mouse_Motion_With_BN2_Down or Mouse_BN2_Down) <> 0 then
-                            Event.Buttons := Event.Buttons or MouseRightButton;
- if SysEvent.fs and (Mouse_Motion_With_BN3_Down or Mouse_BN3_Down) <> 0 then
-                           Event.Buttons := Event.Buttons or MouseMiddleButton;
- Event.X := SysEvent.Col;
- Event.Y := SysEvent.Row;
- if Event.Buttons <> LastMouseEvent.Buttons then
-  if (Event.Buttons and MouseLeftButton = 0) and
-      (LastMouseEvent.Buttons and MouseLeftButton = MouseLeftButton)
-                                   then Event.Action := MouseActionUp else
-  if (Event.Buttons and MouseRightButton = 0) and
-      (LastMouseEvent.Buttons and MouseRightButton = MouseRightButton)
-                                   then Event.Action := MouseActionUp else
-  if (Event.Buttons and MouseMiddleButton = 0) and
-   (LastMouseEvent.Buttons and MouseMiddleButton = MouseMiddleButton)
-    then Event.Action := MouseActionUp
-     else Event.Action := MouseActionDown
-      else if (Event.X <> LastMouseEvent.X) or (Event.Y <> LastMouseEvent.Y)
-                                          then Event.Action := MouseActionMove;
- LastMouseEvent := Event;
-end;
-
-procedure NullOrder;
-var
- I: cardinal;
-begin
- if PendingMouseEvents > 0 then
- begin
-  I := MouseEventOrderHead;
-  repeat
-   PendingMouseEventOrder [I] := 0;
-   if I = Pred (MouseEventBufSize) then I := 0 else Inc (I);
-  until (I <> MouseEventOrderTail);
- end;
-end;
-
-procedure LowerOrder;
-var
- I: cardinal;
-begin
- if PendingMouseEvents > 0 then
- begin
-  I := MouseEventOrderHead;
-  repeat
-   if PendingMouseEventOrder [I] <> 0 then
-   begin
-    Dec (PendingMouseEventOrder [I]);
-    if I = Pred (MouseEventBufSize) then I := 0 else Inc (I);
-   end;
-  until (I <> MouseEventOrderTail) or (PendingMouseEventOrder [I] = 0);
- end;
-end;
-
-function PollMouseEvent (var MouseEvent: TMouseEvent) :boolean;
-var
- SysEvent: TMouEventInfo;
- P, Q: PMouseEvent;
- Event: TMouseEvent;
- WF: word;
- QI: TMouQueInfo;
-begin
- if (PendingMouseEvents = 0) or
-         (PendingMouseEventOrder [MouseEventOrderHead] <> 0) and
-                                  (PendingMouseEvents < MouseEventBufSize) then
- begin
-  MouGetNumQueEl (QI, Handle);
-  if QI.cEvents = 0 then NullOrder else
-  begin
-   LowerOrder;
-   WF := Mou_NoWait;
-   if (MouReadEventQue (SysEvent, WF, Handle) = 0) then
-   begin
-    if PendingMouseHead = @PendingMouseEvent then
-                           P := @PendingMouseEvent [MouseEventBufSize - 1] else
-    begin
-     P := PendingMouseHead;
-     Dec (P);
-    end;
-    TranslateEvents (SysEvent, P^);
-    if P^.Action <> 0 then
-    begin
-     if PendingMouseEvents < MouseEventBufSize then
-     begin
-      Q := P;
-      WF := Mou_NoWait;
-      while (P^.Action = MouseActionMove) and
-       (PendingMouseEventOrder [MouseEventOrderHead] <> 0) and
-         (MouReadEventQue (SysEvent, WF, Handle) = 0) and
-                       ((SysEvent.fs <> 0) or (LastMouseEvent.Buttons <> 0)) do
-      begin
-       LowerOrder;
-       TranslateEvents (SysEvent, Event);
-       if Event.Action <> MouseActionMove then
-       begin
-        if Q = @PendingMouseEvent then
-                  Q := @PendingMouseEvent [MouseEventBufSize - 1] else Dec (Q);
-        if MouseEventOrderHead = 0 then
-                  MouseEventOrderHead := MouseEventBufSize - 1 else
-                                                     Dec (MouseEventOrderHead);
-        PendingMouseEventOrder [MouseEventOrderHead] := 0;
-        Q^ := P^;
-        Inc (PendingMouseEvents);
-        if MouseEventOrderHead = 0 then
-               MouseEventOrderHead := MouseEventBufSize - 1 else
-                                                     Dec (MouseEventOrderHead);
-        PendingMouseEventOrder [MouseEventOrderHead] := 0;
-       end else WF := Mou_NoWait;
-       P^ := Event;
-      end;
-      P := Q;
-     end;
-     Inc (PendingMouseEvents);
-     if MouseEventOrderHead = 0 then
-               MouseEventOrderHead := MouseEventBufSize - 1 else
-                                                     Dec (MouseEventOrderHead);
-     PendingMouseEventOrder [MouseEventOrderHead] := 0;
-     PendingMouseHead := P;
-    end;
-   end else NullOrder;
-  end;
- end;
- if PendingMouseEvents <> 0 then
- begin
-  MouseEvent := PendingMouseHead^;
-  LastMouseEvent := MouseEvent;
-  PollMouseEvent := true;
- end else
- begin
-  PollMouseEvent := false;
-  MouseEvent := LastMouseEvent;
-  MouseEvent.Action := 0;
- end;
-end;
-
-function GetMouseButtons: word;
-var
- Event: TMouseEvent;
-begin
- PollMouseEvent (Event);
- GetMouseButtons := Event.Buttons;
-end;
-
-procedure GetMouseEvent (var MouseEvent: TMouseEvent);
-var
- Event: TMouEventInfo;
-begin
- if (PendingMouseEvents = 0) or
-                       (PendingMouseEventOrder [MouseEventOrderHead] <> 0) then
- repeat
-  DosSleep (1);
-  PollMouseEvent (MouseEvent);
- until (PendingMouseEvents <> 0) and
-                        (PendingMouseEventOrder [MouseEventOrderHead] = 0) else
- begin
-  MouseEvent := PendingMouseHead^;
-  LastMouseEvent := MouseEvent;
- end;
- Inc (PendingMouseHead);
- if longint (PendingMouseHead) = longint (@PendingMouseEvent)
-      + SizeOf (PendingMouseEvent) then PendingMouseHead := @PendingMouseEvent;
- Inc (MouseEventOrderHead);
- if MouseEventOrderHead = MouseEventBufSize then MouseEventOrderHead := 0;
- Dec (PendingMouseEvents);
-end;
-
-procedure PutMouseEvent (const MouseEvent: TMouseEvent);
-var
- QI: TMouQueInfo;
-begin
- if PendingMouseEvents < MouseEventBufSize then
- begin
-  PendingMouseTail^ := MouseEvent;
-  Inc (PendingMouseTail);
-  if longint (PendingMouseTail) = longint (@PendingMouseEvent) +
-        SizeOf (PendingMouseEvent) then PendingMouseTail := @PendingMouseEvent;
-  MouGetNumQueEl (QI, Handle);
-  PendingMouseEventOrder [MouseEventOrderTail] := QI.cEvents;
-  Inc (MouseEventOrderTail);
-  if MouseEventOrderTail = MouseEventBufSize then MouseEventOrderTail := 0;
-  Inc (PendingMouseEvents);
- end;
-end;
-
-{
-  $Log$
-  Revision 1.3  2000-11-04 20:03:27  hajny
-    * DetectMouse correction
-
-  Revision 1.2  2000/07/13 11:32:26  michael
-  + removed logs
- 
-}

+ 0 - 565
api/os2/video.inc

@@ -1,565 +0,0 @@
-{
-  System independent low-level video interface for OS/2
-
-  $Id$
-
-}
-
-uses
-{$IFDEF PPC_FPC}
- DosCalls, VioCalls;
-{$ELSE}
- {$IFDEF PPC_VIRTUAL}
- Os2Base;
- {$ENDIF}
-{$ENDIF}
-
-{$IFNDEF FPC}
-type
-    cardinal = longint;
-{$ENDIF}
-
-const
-    InitVideoCalled: boolean = false;
-    LastCursorType: word = crUnderline;
-    EmptyCell: cardinal = $0720;
-    OrigScreen: PVideoBuf = nil;
-    OrigScreenSize: cardinal = 0;
-
-{$IFDEF PPC_VIRTUAL}
-type
-    TVioCursorInfo = VioCursorInfo;
-    TVioModeInfo = VioModeInfo;
-    TVioIntensity = VioIntensity;
-{$ENDIF}
-
-var OrigCurType: TVioCursorInfo;
-    OrigVioMode: TVioModeInfo;
-    OrigHighBit: TVioIntensity;
-    OrigCurRow: word;
-    OrigCurCol: word;
-    CellHeight: byte;
-    OldVideoBuf: PVideoBuf;
-
-procedure TargetEntry;
-
-var P: PVideoModeList;
-    PScr: pointer;
-
-begin
-{Remember original video mode, cursor type and high bit behaviour setting}
-    OrigVioMode.cb := SizeOf (OrigVioMode);
-    VioGetMode (OrigVioMode, 0);
-    VioGetCurType (OrigCurType, 0);
-    VioGetCurPos (OrigCurRow, OrigCurCol, 0);
-    with OrigHighBit do
-        begin
-            cb := 6;
-            rType := 2;
-        end;
-    VioGetState (OrigHighBit, 0);
-{Register the curent video mode in Modes if not there yet}
-    with OrigVioMode do
-        begin
-            P := Modes;
-            while (P <> nil) and ((P^.Row <> Row) or (P^.Col <> Col)
-                                      or (P^.Color <> (Color >= Colors_16))) do
-                P := P^.Next;
-            if P = nil then
-{Assume we have at least 16 colours available in "colour" modes}
-                RegisterVideoMode (Col, Row, Color >= Colors_16,
-{$IFDEF FPC}
-                                                 @DefaultVideoModeSelector, 0);
-{$ELSE}
-                                                  DefaultVideoModeSelector, 0);
-{$ENDIF}
-        end;
-{Get the address of the original videobuffer and size.}
-    if VioGetBuf (PScr, PWord (@OrigScreenSize)^, 0) = 0 then
-        begin
-{$IFDEF BIT_32}
- {$IFDEF PPC_VIRTUAL}
-            SelToFlat (PScr);
- {$ELSE}
-            PScr := SelToFlat (TFarPtr (PScr));
- {$ENDIF}
-{$ENDIF}
-            GetMem (OrigScreen, OrigScreenSize);
-            Move (PScr^, OrigScreen^, OrigScreenSize);
-        end;
-end;
-
-procedure TargetExit;
-
-begin
-end;
-
-
-procedure CheckCellHeight;
-
-var OldCD, CD: TVioCursorInfo;
-
-begin
-    VioGetCurType (OldCD, 0);
-    Move (OldCD, CD, SizeOf (CD));
-    with CD do
-        begin
-            Attr := 0;
-            yStart := word (-90);
-            cEnd := word (-100);
-        end;
-    VioSetCurType (CD, 0);
-    VioGetCurType (CD, 0);
-    CellHeight := CD.cEnd;
-    VioSetCurType (OldCD, 0);
-end;
-
-
-procedure RegisterVideoModes;
-begin
-{ BW modes are rejected on my (colour) configuration. I can't imagine
-  OS/2 running on MCGA anyway... ;-)
-
-    RegisterVideoMode (40, 25, False, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 25, False, @DefaultVideoModeSelector, 0);
-}
-{$IFDEF FPC}
-    RegisterVideoMode (40, 25, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 25, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 30, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 43, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 50, True, @DefaultVideoModeSelector, 0);
-{$ELSE}
-    RegisterVideoMode (40, 25, True, DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 25, True, DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 30, True, DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 43, True, DefaultVideoModeSelector, 0);
-    RegisterVideoMode (80, 50, True, DefaultVideoModeSelector, 0);
-{$ENDIF}
-
-{ The following modes wouldn't work on plain VGA; is it useful to check
-  for their availability on the program startup?
-
-    RegisterVideoMode (132, 25, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (132, 30, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (132, 43, True, @DefaultVideoModeSelector, 0);
-    RegisterVideoMode (132, 50, True, @DefaultVideoModeSelector, 0);
-}
-end;
-
-
-procedure SetHighBitBlink (Blink: boolean);
-
-var VI: TVioIntensity;
-
-begin
-    with VI do
-        begin
-            cb := 6;
-            rType := 2;
-            fs := byte (not (Blink));
-        end;
-    VioSetState (VI, 0);
-end;
-
-
-procedure InitVideo;
-
-var MI: TVioModeInfo;
-
-begin
-    if InitVideoCalled then
-        FreeMem (OldVideoBuf, VideoBufSize);
-    OldVideoBuf := nil;
-    InitVideoCalled := true;
-    VideoBufSize := 0;
-    MI.cb := SizeOf (MI);
-    VioGetMode (MI, 0);
-    with MI do
-        begin
-            ScreenWidth := Col;
-            ScreenHeight := Row;
-            ScreenColor := Color >= Colors_16;
-        end;
-    VioGetCurPos (CursorY, CursorX, 0);
-    LowAscii := true;
-    SetCursorType (LastCursorType);
-{Get the address of the videobuffer.}
-{$IFDEF PPC_VIRTUAL}
-    if VioGetBuf (pointer (VideoBuf), PWord (@VideoBufSize)^, 0) = 0 then
-        begin
-            SelToFlat (pointer (VideoBuf));
-{$ELSE}
-    if VioGetBuf (VideoBuf, PWord (@VideoBufSize)^, 0) = 0 then
-        begin
- {$IFDEF BIT_32}
-            VideoBuf := SelToFlat (TFarPtr (VideoBuf));
- {$ENDIF}
-{$ENDIF}
-            SetHighBitBlink (true);
-            GetMem (OldVideoBuf, VideoBufSize);
-            Move (VideoBuf^, OldVideoBuf^, VideoBufSize);
-        end
-    else
-        ErrorHandler (errVioInit, nil);
-end;
-
-
-procedure SetCursorPos (NewCursorX, NewCursorY: word);
-
-begin
-    if VioSetCurPos (NewCursorY, NewCursorX, 0) = 0 then
-        begin
-            CursorX := NewCursorX;
-            CursorY := NewCursorY;
-        end
-    else
-        {Do not set an error code; people should fix invalid NewCursorX
-         or NewCursorY values when designing, there is no need for detecting
-         these errors at runtime.}
-        RunError (225);
-end;
-
-
-function GetCursorType: word;
-
-var CD: TVioCursorInfo;
-
-begin
-    VioGetCurType (CD, 0);    {Never fails, because handle is default handle.}
-    with CD do
-        begin
-            CursorLines := Succ (cEnd) - yStart;
-            if Attr = word (-1) then
-                GetCursorType := crHidden
-            else
-{Because the cursor's start and end lines are returned, we'll have
- to guess heuristically what cursor type we have.}
-                if CursorLines = 0 then
-{Probably this does not occur, but you'll never know.}
-                    GetCursorType := crHidden
-                else if CursorLines <= Succ (CellHeight div 4) then
-                    GetCursorType := crUnderline
-                else if CursorLines <= Succ (CellHeight div 2) then
-                    GetCursorType := crHalfBlock
-                else
-                    GetCursorType := crBlock;
-        end;
-end;
-
-
-procedure SetCursorType (NewType: word);
-
-var CD: TVioCursorInfo;
-
-begin
-    VioGetCurType (CD, 0);
-    with CD do
-        begin
-            case NewType of
-                crHidden: Attr := word (-1);
-                crUnderline:
-                    begin
-                        Attr := 0;
-                        yStart := word (-90);
-                        cEnd := word (-100);
-                    end;
-                crHalfBlock:
-                    begin
-                        Attr := 0;
-                        yStart := word (-50);
-                        cEnd := word (-100);
-                    end;
-                crBlock:
-                    begin
-                        Attr := 0;
-                        yStart := 0;
-                        cEnd := word (-100);
-                    end;
-            end;
-            VioSetCurType (CD, 0);
-            VioGetCurType (CD, 0);
-            CursorLines := Succ (cEnd) - yStart;
-        end;
-end;
-
-
-procedure DoneVideo;
-
-var PScr: pointer;
-    ScrSize: cardinal;
-
-begin
-    if InitVideoCalled then
-        begin
-            LastCursorType := GetCursorType;
-            ClearScreen;
-{Restore original settings}
-            VioSetMode (OrigVioMode, 0);
-            CheckCellHeight;
-{Set CursorX and CursorY}
-            SetCursorPos (0, 0);
-            VioSetState (OrigHighBit, 0);
-            VioSetCurType (OrigCurType, 0);
-            VioSetCurPos (OrigCurRow, OrigCurCol, 0);
-            FreeMem (OldVideoBuf, VideoBufSize);
-            OldVideoBuf := nil;
-            VideoBufSize := 0;
-            InitVideoCalled := false;
-            if (OrigScreenSize <> 0) and (OrigScreen <> nil) then
-                begin
-                    ScrSize := 0;
-                    if (VioGetBuf (PScr, PWord (@ScrSize)^, 0) = 0)
-                                            and (ScrSize = OrigScreenSize) then
-                        begin
-{$IFDEF BIT_32}
- {$IFDEF PPC_VIRTUAL}
-                            SelToFlat (PScr);
- {$ELSE}
-                            PScr := SelToFlat (TFarPtr (PScr));
- {$ENDIF}
-{$ENDIF}
-                            Move (OrigScreen^, PScr^, OrigScreenSize);
-                            VioShowBuf (0, ScrSize, 0);
-                        end;
-                end;
-        end;
-end;
-
-
-function GetCapabilities: word;
-
-begin
-    GetCapabilities := $3F;
-end;
-
-
-function DefaultVideoModeSelector (const VideoMode: TVideoMode; Params: longint): boolean;
-
-var OldMI, MI: TVioModeInfo;
-
-begin
-    OldMI.cb := SizeOf (OldMI);
-    if VioGetMode (OldMI, 0) <> 0 then
-        DefaultVideoModeSelector := false
-    else
-        begin
-            with MI do
-                begin
-                    cb := 8;
-                    fbType := 1;
-                    if VideoMode.Color then
-                        Color := Colors_16
-                    else
-                        Color := Colors_2;
-                    Col := VideoMode.Col;
-                    Row := VideoMode.Row;
-                end;
-            if VioSetMode (MI, 0) = 0 then
-{$IFDEF PPC_VIRTUAL}
-                if VioGetBuf (pointer (VideoBuf),
-                                            PWord (@VideoBufSize)^, 0) = 0 then
-                    begin
-                        SelToFlat (pointer (VideoBuf));
-{$ELSE}
-                if VioGetBuf (VideoBuf, PWord (@VideoBufSize)^, 0) = 0 then
-                    begin
- {$IFDEF BIT_32}
-                        VideoBuf := SelToFlat (TFarPtr (VideoBuf));
- {$ENDIF}
-{$ENDIF}
-                        DefaultVideoModeSelector := true;
-                        SetHighBitBlink (true);
-                        CheckCellHeight;
-                        SetCursorType (LastCursorType);
-                        ClearScreen;
-                    end
-                else
-                    begin
-                        DefaultVideoModeSelector := false;
-                        VioSetMode (OldMI, 0);
-{$IFDEF PPC_VIRTUAL}
-                        VioGetBuf (pointer (VideoBuf),
-                                                    PWord (@VideoBufSize)^, 0);
-                        SelToFlat (pointer (VideoBuf));
-{$ELSE}
-                        VioGetBuf (VideoBuf, PWord (@VideoBufSize)^, 0);
- {$IFDEF BIT_32}
-                        VideoBuf := SelToFlat (TFarPtr (VideoBuf));
- {$ENDIF}
-{$ENDIF}
-                        SetHighBitBlink (true);
-                        CheckCellHeight;
-                        SetCursorType (LastCursorType);
-                        ClearScreen;
-                    end
-            else
-                begin
-                    DefaultVideoModeSelector := false;
-{$IFDEF PPC_VIRTUAL}
-                    VioGetBuf (pointer (VideoBuf), PWord (@VideoBufSize)^, 0);
-                    SelToFlat (pointer (VideoBuf));
-{$ELSE}
-                    VioGetBuf (VideoBuf, PWord (@VideoBufSize)^, 0);
- {$IFDEF BIT_32}
-                    VideoBuf := SelToFlat (TFarPtr (VideoBuf));
- {$ENDIF}
-{$ENDIF}
-                    SetHighBitBlink (true);
-                    SetCursorType (LastCursorType);
-                end;
-        end;
-end;
-
-
-procedure ClearScreen;
-
-begin
-    VioScrollDn (0, 0, word (-1), word (-1), word (-1), PWord (@EmptyCell)^, 0);
-    Move (VideoBuf^, OldVideoBuf^, VideoBufSize);
-end;
-
-
-{$IFDEF PPC_FPC}
- {$ASMMODE INTEL}
-{$ENDIF}
-
-procedure UpdateScreen (Force: boolean);
-
-{$IFDEF BIT_32}
-var SOfs, CLen: cardinal;
-{$ELSE}
-var SOfs, CLen: word;
-{$ENDIF}
-
-begin
-    if LockUpdateScreen = 0 then
-        begin
-            if not (Force) then
-                asm
-                    cld
-{$IFDEF BIT_32}
-                    mov esi, VideoBuf
-                    mov edi, OldVideoBuf
-                    mov eax, VideoBufSize
-                    mov ecx, eax
-                    shr ecx, 1
-                    shr ecx, 1
-                    repe
-                    cmpsd
-                    je @no_update
-                    inc ecx
-                    mov edx, eax
-                    mov ebx, ecx
-                    shl ebx, 1
-                    shl ebx, 1
-                    sub edx, ebx
-                    mov SOfs, edx
-                    mov Force, 1
-                    std
-                    mov edi, eax
-                    mov esi, VideoBuf
-                    add eax, esi
-                    sub eax, 4
-                    mov esi, eax
-                    mov eax, OldVideoBuf
-                    add eax, edi
-                    sub eax, 4
-                    mov edi, eax
-                    repe
-                    cmpsd
-                    inc ecx
-                    shl ecx, 1
-                    shl ecx, 1
-                    mov CLen, ecx
-@no_update:
-{$ELSE}
-                    push ds
-                    lds si, VideoBuf
-                    les di, OldVideoBuf
-                    mov ax, word ptr VideoBufSize
-                    mov cx, ax
-                    shr cx, 1
-                    repe
-                    cmpsw
-                    jz @no_update
-                    inc cx
-                    mov dx, ax
-                    mov bx, cx
-                    shl bx, 1
-                    sub dx, bx
-                    mov SOfs, dx
-                    mov Force, 1
-                    std
-                    mov di, ax
-                    mov si, offset VideoBuf
-                    add ax, si
-                    dec ax
-                    dec ax
-                    mov si, ax
-                    mov ax, offset OldVideoBuf
-                    add ax, di
-                    dec ax
-                    dec ax
-                    mov di, ax
-                    repe
-                    cmpsw
-                    inc cx
-                    shl cx, 1
-                    mov CLen, cx
-@no_update:
-                    pop ds
-{$ENDIF}
-                end
-            else
-                begin
-                    SOfs := 0;
-                    CLen := VideoBufSize;
-                end;
-            if Force then
-                begin
-                    VioShowBuf (SOfs, CLen, 0);
-                    Move (VideoBuf^ [SOfs div SizeOf (TVideoCell)],
-                            OldVideoBuf^ [SOfs div SizeOf (TVideoCell)], CLen);
-                end;
-        end;
-end;
-
-
-{
-
-  $Log$
-  Revision 1.12  2001-01-23 20:21:45  hajny
-    * another little optimization of UpdateScreen
-
-  Revision 1.11  2000/10/15 20:52:56  hajny
-    * optimization of UpdateScreen finished
-
-  Revision 1.10  2000/10/11 20:10:04  hajny
-    * compatibility enhancements
-
-  Revision 1.9  2000/10/11 05:28:29  hajny
-    * really a faster version now ;-)
-
-  Revision 1.8  2000/10/10 20:28:18  hajny
-    * screen updates speeded up
-
-  Revision 1.7  2000/10/08 18:40:58  hajny
-    * SetCursorType corrected
-
-  Revision 1.6  2000/10/08 14:13:19  hajny
-    * ClearScreen correction, screen restored on exit
-
-  Revision 1.5  2000/10/04 11:53:31  pierre
-   Add TargetEntry and TargetExit (merged)
-
-  Revision 1.4  2000/09/26 18:15:29  hajny
-    + working with VP/2 already (not FPC yet)!
-
-  Revision 1.3  2000/09/24 19:53:03  hajny
-    * OS/2 implementation almost finished, not debugged yet
-
-  Revision 1.2  2000/07/13 11:32:26  michael
-  + removed logs
-
-}

+ 0 - 1273
api/test/Makefile

@@ -1,1273 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Default FPCDIR
-ifeq ($(FPCDIR),wrong)
-override FPCDIR=../..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-ifndef PACKAGESDIR
-PACKAGESDIR=$(FPCDIR)/packages
-endif
-ifndef TOOLKITSDIR
-TOOLKITSDIR=
-endif
-ifndef COMPONENTSDIR
-COMPONENTSDIR=
-endif
-
-# Create units dir
-ifneq ($(FPCDIR),.)
-UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override EXEOBJECTS+=testkbd testmous testmou2 testvid1 testvid2 testfsys testfctl testcall
-
-# Clean
-
-
-# Install
-
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-ifndef TARGETDIR
-TARGETDIR=.
-endif
-
-# Packages
-
-override PACKAGES+=rtl api
-
-# Libraries
-
-
-# Info
-
-INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ppumove
-ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUMOVE),)
-PPUMOVE=
-else
-PPUMOVE:=$(firstword $(PPUMOVE))
-endif
-endif
-export PPUMOVE
-
-# ppufiles
-ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUFILES),)
-PPUFILES=
-else
-PPUFILES:=$(firstword $(PPUFILES))
-endif
-endif
-export PPUFILES
-
-# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
-# upx uses that one itself (PFV)
-ifndef UPXPROG
-ifeq ($(OS_TARGET),go32v2)
-UPXPROG:=1
-endif
-ifeq ($(OS_TARGET),win32)
-UPXPROG:=1
-endif
-ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(UPXPROG),)
-UPXPROG=
-else
-UPXPROG:=$(firstword $(UPXPROG))
-endif
-else
-UPXPROG=
-endif
-endif
-export UPXPROG
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-#####################################################################
-# Default extensions
-#####################################################################
-
-# Default needed extensions (Go32v2,Linux)
-LOADEREXT=.as
-EXEEXT=.exe
-PPLEXT=.ppl
-PPUEXT=.ppu
-OEXT=.o
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.so
-RSTEXT=.rst
-FPCMADE=fpcmade
-
-# Go32v1
-ifeq ($(OS_TARGET),go32v1)
-PPUEXT=.pp1
-OEXT=.o1
-ASMEXT=.s1
-SMARTEXT=.sl1
-STATICLIBEXT=.a1
-SHAREDLIBEXT=.so1
-FPCMADE=fpcmade.v1
-endif
-
-# Go32v2
-ifeq ($(OS_TARGET),go32v2)
-FPCMADE=fpcmade.dos
-endif
-
-# Linux
-ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.lnx
-endif
-
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
-# Win32
-ifeq ($(OS_TARGET),win32)
-PPUEXT=.ppw
-OEXT=.ow
-ASMEXT=.sw
-SMARTEXT=.slw
-STATICLIBEXT=.aw
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.w32
-endif
-
-# OS/2
-ifeq ($(OS_TARGET),os2)
-PPUEXT=.ppo
-ASMEXT=.so2
-OEXT=.oo2
-SMARTEXT=.so
-STATICLIBEXT=.ao2
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.os2
-endif
-
-# library prefix
-LIBPREFIX=lib
-ifeq ($(OS_TARGET),go32v2)
-LIBPREFIX=
-endif
-ifeq ($(OS_TARGET),go32v1)
-LIBPREFIX=
-endif
-
-# determine which .pas extension is used
-ifndef PASEXT
-ifdef EXEOBJECTS
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
-else
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
-endif
-ifeq ($(TESTPAS),)
-PASEXT=.pp
-else
-PASEXT=.pas
-endif
-endif
-
-
-# Check if the dirs really exists, else turn it off
-ifeq ($(wildcard $(UNITSDIR)),)
-UNITSDIR=
-endif
-ifeq ($(wildcard $(TOOLKITSDIR)),)
-TOOLKITSDIR=
-endif
-ifeq ($(wildcard $(PACKAGESDIR)),)
-PACKAGESDIR=
-endif
-ifeq ($(wildcard $(COMPONENTSDIR)),)
-COMPONENTSDIR=
-endif
-
-
-# PACKAGESDIR packages
-
-PACKAGERTL=1
-PACKAGEAPI=1
-
-ifdef PACKAGERTL
-ifneq ($(wildcard $(FPCDIR)/rtl),)
-ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
-PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
-else
-PACKAGEDIR_RTL=$(FPCDIR)/rtl
-endif
-ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_rtl
-package_rtl:
-	$(MAKE) -C $(PACKAGEDIR_RTL) all
-endif
-UNITDIR_RTL=$(PACKAGEDIR_RTL)
-else
-PACKAGEDIR_RTL=
-ifneq ($(wildcard $(UNITSDIR)/rtl),)
-ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
-UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
-else
-UNITDIR_RTL=$(UNITSDIR)/rtl
-endif
-else
-UNITDIR_RTL=
-endif
-endif
-ifdef UNITDIR_RTL
-override NEEDUNITDIR+=$(UNITDIR_RTL)
-endif
-endif
-ifdef PACKAGEAPI
-ifneq ($(wildcard $(FPCDIR)/api),)
-ifneq ($(wildcard $(FPCDIR)/api/$(OS_TARGET)),)
-PACKAGEDIR_API=$(FPCDIR)/api/$(OS_TARGET)
-else
-PACKAGEDIR_API=$(FPCDIR)/api
-endif
-ifeq ($(wildcard $(PACKAGEDIR_API)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_api
-package_api:
-	$(MAKE) -C $(PACKAGEDIR_API) all
-endif
-UNITDIR_API=$(PACKAGEDIR_API)
-else
-PACKAGEDIR_API=
-ifneq ($(wildcard $(UNITSDIR)/api),)
-ifneq ($(wildcard $(UNITSDIR)/api/$(OS_TARGET)),)
-UNITDIR_API=$(UNITSDIR)/api/$(OS_TARGET)
-else
-UNITDIR_API=$(UNITSDIR)/api
-endif
-else
-UNITDIR_API=
-endif
-endif
-ifdef UNITDIR_API
-override NEEDUNITDIR+=$(UNITDIR_API)
-endif
-endif
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-
-#####################################################################
-# Compiler Command Line
-#####################################################################
-
-# Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(CPU_TARGET)
-
-# Load commandline OPT and add target and unit dir to be sure
-ifneq ($(OS_TARGET),$(OS_SOURCE))
-override FPCOPT+=-T$(OS_TARGET)
-endif
-
-# User dirs should be first, so they are looked at first
-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
-
-# Smartlinking
-ifdef LINKSMART
-override FPCOPT+=-XX
-endif
-
-# Smartlinking creation
-ifdef CREATESMART
-override FPCOPT+=-CX
-endif
-
-# Debug
-ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
-endif
-
-# Release mode (strip, optimize and don't load ppc386.cfg)
-# 0.99.12b has a bug in the optimizer so don't use it by default
-ifdef RELEASE
-ifeq ($(FPC_VERSION),0.99.12)
-override FPCOPT+=-Xs -OGp3 -n
-else
-override FPCOPT+=-Xs -OG2p3 -n
-endif
-endif
-
-# Strip
-ifdef STRIP
-override FPCOPT+=-Xs
-endif
-
-# Optimizer
-ifdef OPTIMIZE
-override FPCOPT+=-OG2p3
-endif
-
-# Verbose settings (warning,note,info)
-ifdef VERBOSE
-override FPCOPT+=-vwni
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-# Target dirs and the prefix to use for clean/install
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
-endif
-
-# Add commandline options last so they can override
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-
-# Add defines from FPCOPTDEF to FPCOPT
-ifdef FPCOPTDEF
-override FPCOPT+=$(FPCOPTDEF)
-endif
-
-# Error file ?
-ifdef ERRORFILE
-override FPCOPT+=-Fr$(ERRORFILE)
-endif
-
-# Was a config file specified ?
-ifdef CFGFILE
-override FPCOPT+=@$(CFGFILE)
-endif
-
-# For win32 the options are passed using the environment FPCEXTCMD
-ifeq ($(OS_SOURCE),win32)
-override FPCEXTCMD:=$(FPCOPT)
-override FPCOPT:=!FPCEXTCMD
-export FPCEXTCMD
-endif
-
-# Compiler commandline
-override COMPILER:=$(FPC) $(FPCOPT)
-
-# also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
-ifeq (,$(findstring -s ,$(COMPILER)))
-EXECPPAS=
-else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
-EXECPPAS:=@$(PPAS)
-endif
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: fpc_all
-
-debug: fpc_debug
-
-smart: fpc_smart
-
-shared: fpc_shared
-
-showinstall: fpc_showinstall
-
-install: fpc_install
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: fpc_clean
-
-distclean: fpc_distclean
-
-cleanall: fpc_cleanall
-
-info: fpc_info
-
-.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
-
-#####################################################################
-# Exes
-#####################################################################
-
-.PHONY: fpc_exes
-
-ifdef EXEOBJECTS
-override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))
-override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS)))
-
-override ALLTARGET+=fpc_exes
-override INSTALLEXEFILES+=$(EXEFILES)
-override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
-
-endif
-
-fpc_exes: $(EXEFILES)
-
-#####################################################################
-# General compile rules
-#####################################################################
-
-.PHONY: fpc_packages fpc_all fpc_debug
-
-$(FPCMADE): $(ALLTARGET)
-	@$(ECHO) Compiled > $(FPCMADE)
-
-fpc_packages: $(COMPILEPACKAGES)
-
-fpc_all: fpc_packages $(FPCMADE)
-
-fpc_debug:
-	$(MAKE) all DEBUG=1
-
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
-# General compile rules, available for both possible PASEXT
-
-.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
-
-%$(PPUEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(PPUEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-#####################################################################
-# Library
-#####################################################################
-
-.PHONY: fpc_smart fpc_shared
-
-ifdef LIBVERSION
-LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
-else
-LIBFULLNAME=$(LIBNAME)
-endif
-
-# Default sharedlib units are all unit objects
-ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
-endif
-
-fpc_smart:
-	$(MAKE) all LINKSMART=1 CREATESMART=1
-
-fpc_shared: all
-ifdef HASSHAREDLIB
-ifndef LIBNAME
-	@$(ECHO) "LIBNAME not set"
-else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
-endif
-else
-	@$(ECHO) "Shared Libraries not supported"
-endif
-
-#####################################################################
-# Install rules
-#####################################################################
-
-.PHONY: fpc_showinstall fpc_install
-
-ifdef EXTRAINSTALLUNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
-endif
-
-ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-ifdef PPUFILES
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
-endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-
-fpc_showinstall: $(SHOWINSTALLTARGET)
-ifdef INSTALLEXEFILES
-	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
-endif
-ifdef INSTALLPPUFILES
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
-ifneq ($(INSTALLPPULINKFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
-endif
-
-fpc_install: $(INSTALLTARGET)
-# Create UnitInstallFiles
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(BININSTALLDIR)
-# Compress the exes if upx is defined
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(UNITINSTALLDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
-	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	$(MKDIR) $(DATAINSTALLDIR)
-	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
-endif
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Clean rules
-#####################################################################
-
-.PHONY: fpc_clean fpc_cleanall fpc_distclean
-
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
-ifdef EXTRACLEANUNITS
-override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
-endif
-
-ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
-ifdef PPUFILES
-CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
-else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
-endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
-endif
-
-fpc_clean: $(CLEANTARGET)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-ifdef CLEANPPUFILES
-	-$(DEL) $(CLEANPPUFILES)
-endif
-ifneq ($(CLEANPPULINKFILES),)
-	-$(DEL) $(CLEANPPULINKFILES)
-endif
-ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
-endif
-ifdef EXTRACLEANFILES
-	-$(DEL) $(EXTRACLEANFILES)
-endif
-ifdef LIBNAME
-	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
-endif
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-fpc_distclean: fpc_clean
-
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-	-$(DELTREE) *$(SMARTEXT)
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-#####################################################################
-# Info rules
-#####################################################################
-
-.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
-	fpc_dirinfo
-
-fpc_info: $(INFOTARGET)
-
-fpc_infocfg:
-	@$(ECHO)
-	@$(ECHO)  == Configuration info ==
-	@$(ECHO)
-	@$(ECHO)  FPC....... $(FPC)
-	@$(ECHO)  Version... $(FPC_VERSION)
-	@$(ECHO)  CPU....... $(CPU_TARGET)
-	@$(ECHO)  Source.... $(OS_SOURCE)
-	@$(ECHO)  Target.... $(OS_TARGET)
-	@$(ECHO)
-
-fpc_infoobjects:
-	@$(ECHO)
-	@$(ECHO)  == Object info ==
-	@$(ECHO)
-	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
-	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
-	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
-	@$(ECHO)
-	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
-	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
-	@$(ECHO)
-	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
-	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
-	@$(ECHO)
-
-fpc_infoinstall:
-	@$(ECHO)
-	@$(ECHO)  == Install info ==
-	@$(ECHO)
-ifdef DATE
-	@$(ECHO)  DateStr.............. $(DATESTR)
-endif
-ifdef PACKAGEPREFIX
-	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
-endif
-ifdef PACKAGENAME
-	@$(ECHO)  PackageName.......... $(PACKAGENAME)
-endif
-	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
-	@$(ECHO)
-	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
-	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
-	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
-	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
-	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
-	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
-	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
-	@$(ECHO)
-	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
-	@$(ECHO)  ZipName.............. $(ZIPNAME)
-	@$(ECHO)
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-

+ 0 - 13
api/test/Makefile.fpc

@@ -1,13 +0,0 @@
-#
-#   Makefile.fpc for API Examples/Tests
-#
-
-[targets]
-programs=testkbd testmous testmou2 testvid1 testvid2 testfsys testfctl testcall
-
-[require]
-packages=api
-
-[dirs]
-fpcdir=../..
-targetdir=.

+ 0 - 155
api/test/testcall.pas

@@ -1,155 +0,0 @@
-program testcall;
-uses CallSpec;
-
-{ Testing program for calls of special functions. }
-
-procedure TestLocal;
-var
-  I: Integer;
-
-        procedure VoidLocal; {$ifndef FPC}far;{$endif}
-        begin
-          Write(I)
-        end;
-
-        procedure PointerLocal(J: LongInt); {$ifndef FPC}far;{$endif}
-        begin
-          Write('(', I, ',', J, ')')
-        end;
-
-begin
-  I := 4711;
-  Write('VoidLocal test: ');
-  VoidLocal;
-  Write(' = ');
-  CallVoidLocal(@VoidLocal, CurrentFramePointer);
-  WriteLn;
-
-  Write('PointerLocal test: ');
-  PointerLocal(0815);
-  Write(' = ');
-  CallPointerLocal(@PointerLocal, CurrentFramePointer, pointer(0815));
-  WriteLn
-end;
-
-type
-  TTest = object
-    K: Integer;
-    procedure TestMethodLocal;
-  end;
-
-var
-  Test: TTest;
-
-procedure TTest.TestMethodLocal;
-var
-  I: Integer;
-
-        procedure VoidMethodLocal; {$ifndef FPC}far;{$endif}
-        var
-          t: Integer;
-        begin
-          t := K;
-          Write('(', K, ',', I, ',', t, ')')
-        end;
-
-        procedure PointerMethodLocal(J: LongInt); {$ifndef FPC}far;{$endif}
-        var
-          t: Integer;
-        begin
-          t := K;
-          Write('(', K, ',', I, ',', J, ',', t, ')')
-        end;
-
-begin
-  I := 123;
-  Write('VoidMethodLocal test: ');
-  VoidMethodLocal;
-  Write(' = ');
-  CallVoidMethodLocal(@VoidMethodLocal,
-    CurrentFramePointer, @Self);
-  WriteLn;
-
-  Write('PointerMethodLocal test: ');
-  PointerMethodLocal(987);
-  Write(' = ');
-  CallPointerMethodLocal(@PointerMethodLocal,
-    CurrentFramePointer, @Self, pointer(987));
-  WriteLn
-end;
-
-type
-  PA = ^TA;
-  TA = object
-    I: LongInt;
-    constructor VoidInit;
-    constructor PointerInit(P: Pointer);
-    destructor Done;
-    procedure VoidMethod;
-    procedure PointerMethod(P: Pointer);
-  end;
-
-constructor TA.VoidInit;
-begin
-  I := 2718
-end;
-
-constructor TA.PointerInit(P: Pointer);
-begin
-  I := LongInt(P)
-end;
-
-destructor TA.Done;
-begin
-end;
-
-procedure TestConstructor;
-var
-  P, Q: PA;
-begin
-  P := CallVoidConstructor(@TA.VoidInit, nil, TypeOf(TA));
-  WriteLn('CallVoidConstructor test:  2718 = ', P^.I);
-  Dispose(P,Done);
-  Q := CallPointerConstructor(@TA.PointerInit, nil, TypeOf(TA), pointer(14142));
-  WriteLn('CallPointerConstructor test:  14142 = ', Q^.I);
-  Dispose(Q,Done);
-end;
-
-procedure TA.VoidMethod;
-begin
-  I := 2718;
-end;
-
-procedure TA.PointerMethod(P: Pointer);
-begin
-  I := LongInt(P)
-end;
-
-procedure TestMethod;
-var
-  A: TA;
-begin
-  CallVoidMethod(@TA.VoidMethod, @A);
-  WriteLn('CallVoidMethod test:  2718 = ', A.I);
-  CallPointerMethod(@TA.PointerMethod, @A, pointer(14142));
-  WriteLn('CallPointerMethod test:  14142 = ', A.I);
-end;
-
-begin
-  WriteLn('If the CallSpec unit is implemented properly for your');
-  WriteLn('Pascal compiler, you will see 8 correct equations, and');
-  WriteLn('this program will terminate without error.');
-  WriteLn;
-
-  TestLocal;
-
-  Test.K := 3141;
-  Test.TestMethodLocal;
-
-  TestConstructor;
-
-  TestMethod;
-
-  WriteLn;
-  WriteLn('Finished.');
-end.

+ 0 - 22
api/test/testfctl.pas

@@ -1,22 +0,0 @@
-uses
-  FileCtrl;
-
-var
-  fd: TFileHandle;
-  Tmp: String;
-  I: Integer;
-
-begin
-  fd := CreateFile('Valami.txt');
-  for I := 1 to 255 do Tmp[I] := Chr(I);
-  Tmp[0] := #255;
-  WriteFile(fd, Tmp, 256);
-  SeekFile(fd, 0, skBeg);
-  WriteLn('Filesize = ', FileSize(fd));
-  ReadFile(fd, Tmp, 256);
-  WriteLn(Tmp);
-  WriteFile(fd, Tmp, 256);
-  SeekFile(fd, 256, skBeg);
-  WriteLn('FilePos = ', FilePos(fd));
-  CloseFile(fd);
-end.

+ 0 - 136
api/test/testfsys.pas

@@ -1,136 +0,0 @@
-{ test application for FileSys
-  make sure a file called testfile.txt (here in FName) exists;
-  it will be deleted ! }
-program TestFS;
-
-uses
-  ApiComm,
-  Filesys;
-
-const
-  Passes = 12;
-  FName  : string[30] = 'testfile.txt';
-  DName  : string[30] = 'test';
-  TestNames : array[0..Passes-1] of string[30] =
-    ('CreateDir',
-     'RenameDir',
-     'ExpandName',
-     'GetCurrentDir',
-     'DeleteDir',
-
-     'Check name',
-     'Set time',
-     'DateToString/TimeToString',
-     'Set attribute',
-     'FileAttrToString',
-     'FileIntToString',
-     'SplitName'
-    );
-
-var
-  i           : byte;
-  n, p, rn, e : TFileName;
-  dt          : TDateTime;
-  attr        : TFileAttr;
-  fi          : TFileInt;
-
-begin
-  WriteLn ('TestFS - tests capabilities of unit FileSys');
-  WriteLn ('---');
-  i := 0;
-  repeat
-    { show topic }
-    case i of
-      0 : WriteLn ('<DIRECTORY>');
-      5 : WriteLn ('<FILE>');
-    end;
-    { show name of action }
-    Write (TestNames[i], ' ');
-    { perform action }
-    case i of
-      0 :
-        begin
-          Write ('"', DName, '"');
-          FileSys.CreateDir (DName);
-        end;
-      1 :
-        begin
-          Write (DName, '=> test2');
-          RenameDir (DName, 'test2');
-          GetErrorCode;
-          RenameDir ('test2', DName);
-        end;
-      2 :
-        begin
-          Write ('"', ExpandName (DName),'"');
-        end;
-      3 :
-        begin
-          Write ('"', GetCurrentDir, '"');
-        end;
-      4 :
-        begin
-          Write ('"', DName, '"');
-          FileSys.DeleteDir (DName);
-        end;
-      { FILE }
-      5 :
-        begin
-          Write ('"', FName, '" : ');
-          if (FileSys.CheckName (FName) = cnUnknown)
-            then Write ('unknown')
-            else Write ('known');
-        end;
-      6 :
-        begin
-          Write (' 22 Jul 1997 12:34:56');
-          with dt do begin
-            Day :=    22;
-            Month :=  7;
-            Year :=   1997;
-            Hour :=   12;
-            Minute := 34;
-            Second := 56;
-            CheckDateTime (dt);
-          end;
-          SetFTime (FName, dt);
-        end;
-      7 :
-        begin
-          Write (DateToString (dt), ' ', TimeToString (dt));
-        end;
-      8 :
-        begin
-          attr := 128;
-          SetFAttr (FName, attr);
-        end;
-      9 :
-        begin
-          Write (FileAttrToString (attr));
-        end;
-     10 :
-        begin
-          fi := 12345678;
-          Write (FileIntToString (fi));
-        end;
-     11 :
-        begin
-          {$ifdef linux}
-          n := '/sub1/sub3.ext.ext/name.gz';
-          {$ELSE}
-          n := 'c:\sub1\sub3.ext.ext\name.gz';
-          {$endif}
-          SplitName (n, p, rn, e);
-          Write ('"', n, '" => ',
-                 'PATH = "', p, '", RAW NAME = "', rn,
-                 '", EXTENSION = "', e, '"');
-        end;
-
-    end;
-    if (ApiComm.GetErrorCode = errOK)
-      then WriteLn (' <NO ERROR>')
-      else WriteLn (' <ERROR>');
-    inc (i);
-  until (i = Passes);
-  WriteLn ('---');
-end.

+ 0 - 38
api/test/testkbd.pas

@@ -1,38 +0,0 @@
-uses
-  Keyboard;
-
-function hexstr(val : longint;cnt : byte) : string;
-const
-  HexTbl : array[0..15] of char='0123456789ABCDEF';
-var
-  i : longint;
-begin
-  hexstr[0]:=char(cnt);
-  for i:=cnt downto 1 do
-   begin
-     hexstr[i]:=hextbl[val and $f];
-     val:=val shr 4;
-   end;
-end;
-
-var
-  Key: TKeyEvent;
-  Chr: Char;
-
-begin
-  InitKeyboard;
-  Chr := #0;
-  while Chr <> #27 do begin
-    Key := GetKeyEvent;
-    writeln('KeyEvent: ',hexstr(key,8));
-    Key:=translatekeyevent(key);
-    if IsFunctionKey(Key) then begin
-      WriteLn('Function key was pressed, Code: ', GetKeyEventCode(Key));
-     end
-     else begin
-      Chr := GetKeyEventChar(Key);
-      WriteLn('Normal key was pressed, character: ', Chr, ' (', Ord(Chr), ')');
-    end;
-  end;
-  DoneKeyboard;
-end.

+ 0 - 48
api/test/testmou2.pas

@@ -1,48 +0,0 @@
-program MouseTest;
-
-uses
- Crt, Mouse;
-
-var
- Event: TMouseEvent;
-
-begin
- while KeyPressed do ReadKey;
- WriteLn ('Mouse will be shown after any key');
- ReadKey;
- while KeyPressed do ReadKey;
- WriteLn ('Now generate mouse events or press any key to continue');
- InitMouse;
- while not (KeyPressed) do
- begin
-  repeat until (KeyPressed) or PollMouseEvent (Event);
-  if not (KeyPressed) then
-  begin
-   GetMouseEvent (Event);
-   HideMouse;
-   Write ('Buttons: ', Event.Buttons, ', X: ', Event.X, ', Y: ', Event.Y,
-                                                                 ', action: ');
-   case Event.Action of
-    0: WriteLn ('nothing');
-    MouseActionDown: WriteLn ('down');
-    MouseActionUp: WriteLn ('up');
-    MouseActionMove: WriteLn ('move');
-   else
-    begin
-     WriteLn ('undefined!!!');
-     if ReadKey = #0 then ReadKey;
-    end;
-   end;
-   ShowMouse;
-  end;
- end;
- HideMouse;
- WriteLn ('Mouse will be hidden after any key');
- while KeyPressed do ReadKey;
- ShowMouse;
- if ReadKey = #0 then ReadKey;
- HideMouse;
- WriteLn ('Program ends after any key');
- if ReadKey = #0 then ReadKey;
- DoneMouse;
-end.

+ 0 - 16
api/test/testmous.pas

@@ -1,16 +0,0 @@
-program testmouse;
-uses mouse;
-
-var
-  quit : boolean;
-  event : TMouseEvent;
-begin
-  initmouse;
-  repeat
-    GetMouseEvent(event);
-    writeln('action : ',event.action,' (',event.x,',',event.y,') [',event.buttons,']');
-    if event.buttons and MouseRightButton<>0 then
-      quit:=true;
-  until quit;
-  donemouse;
-end.

+ 0 - 24
api/test/testterminfo.pas

@@ -1,24 +0,0 @@
-
-uses
-  Terminfo, Linux;
-
-var
-   Error, J : Longint;
-   I: Integer;
-
-begin
-   setupterm(nil, 1, Error);
-   if Error = 1 then begin
-     Write(cur_term^.TType.Strings[clear_screen]);
-     for I := 1 to 15 do begin
-       Write(cur_term^.TType.Strings[cursor_right]);
-       Write(cur_term^.TType.Strings[cursor_down]);
-       for J := 1 to 1000000 do ;
-     end;
-     for I := 1 to 15 do begin
-       Write(cur_term^.TType.Strings[cursor_up]);
-       Write(cur_term^.TType.Strings[cursor_right]);
-       for J := 1 to 1000000 do ;
-     end;
-   end;
-end.

+ 0 - 24
api/test/testterminfo5.pas

@@ -1,24 +0,0 @@
-
-uses
-  Terminfo, Linux;
-
-var
-   Error, J : Longint;
-   I: Integer;
-
-begin
-   setupterm(nil, 1, Error);
-   if Error = 1 then begin
-     Write(terminal_ptr5(cur_term)^.TType.Strings^[clear_screen]);
-     for I := 1 to 15 do begin
-       Write(terminal_ptr5(cur_term)^.TType.Strings^[cursor_right]);
-       Write(terminal_ptr5(cur_term)^.TType.Strings^[cursor_down]);
-       for J := 1 to 1000000 do ;
-     end;
-     for I := 1 to 15 do begin
-       Write(terminal_ptr5(cur_term)^.TType.Strings^[cursor_up]);
-       Write(terminal_ptr5(cur_term)^.TType.Strings^[cursor_right]);
-       for J := 1 to 1000000 do ;
-     end;
-   end;
-end.

+ 0 - 43
api/test/testvid1.pas

@@ -1,43 +0,0 @@
-uses
-  Video, Keyboard;
-
-procedure FillScreen(W: Word);
-var
-  I: Integer;
-  P: PVideoCell;
-  Mode: TVideoMode;
-begin
-  GetVideoMode(Mode);
-  P := PVideoCell(VideoBuf);
-  for I := 0 to Mode.Row * Mode.Col do begin
-    P^ := W;
-    Inc(P);
-  end;
-  UpdateScreen(True);
-end;
-
-var
-  Mode: TVideoMode;
-
-begin
-  { Video automatically determines the dimensions, so you may want to
-    add "magic" numbers here to identify a given video mode }
-  {$IFDEF FPC}
-    RegisterVideoMode($FF, $FF, True, @DefaultVideoModeSelector, $01094F02);
-  {$ELSE}
-    RegisterVideoMode($FF, $FF, True, DefaultVideoModeSelector, $01094F02);
-  {$ENDIF}
-  InitVideo;
-  FillScreen($1FB0);
-  readln;
-
-  Mode.Col := $FF; Mode.Row := $FF; Mode.Color := True;
-  SetVideoMode(Mode);
-  FillScreen($1FB0);
-  WriteLn('ScreenWidth = ', ScreenWidth);
-  WriteLn('ScreenHeight = ', ScreenHeight);
-  readln;
-  Mode.Row := 25;
-  SetVideoMode(Mode);
-  DoneVideo;
-end.

+ 0 - 50
api/test/testvid2.pas

@@ -1,50 +0,0 @@
-uses
-  ApiComm, Video;
-
-var
-  I, J: CPUInt;
-  Direction: CPUWord;
-
-begin
-  Randomize;
-  InitVideo;
-  I := 1; J := 1;
-  Direction := Random(8);
-  repeat
-    VideoBuf^[I+J*ScreenWidth] := $0720;
-    case Direction of
-      0: Dec(J);
-      1: Inc(I);
-      2: Inc(J);
-      3: Dec(I);
-      4:
-        begin
-          Inc(I);
-          Dec(J);
-        end;
-      5:
-        begin
-          Inc(I);
-          Inc(J);
-        end;
-      6:
-        begin
-          Dec(I);
-          Inc(J);
-        end;
-      7:
-        begin
-          Dec(I);
-          Dec(J);
-        end;
-    end;
-    if (I < 0) then I := 0;
-    if (J < 0) then J := 0;
-    if (I >= ScreenWidth) then I := ScreenWidth-1;
-    if (J >= ScreenHeight) then J := ScreenHeight-1;
-    VideoBuf^[I+J*ScreenWidth] := $1F2A;
-    if Random(100) < 30 then Direction := Random(8);
-    UpdateScreen(False);
-  until False; {KeyPressed;}
-  DoneVideo;
-end.

+ 0 - 232
api/tp/filectrl.inc

@@ -1,232 +0,0 @@
-{
-  System independent filecontrol interface for tp7
-
-  $Id$
-}
-
-{ no known 16 bit compilers support overriding }
-
-function OpenFileStr(FName: PChar; Flags: Longint): TFileHandle; assembler;
-asm
-@@Retry:
-        push    ds
-        lds     dx,FName
-        mov     al,byte ptr Flags
-        mov     ah,3dh
-        int     21h
-        pop     ds
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax      { ErrorCode: Longint }
-        les     dx,FName
-        push    es
-        push    dx      { FName as ErrorInfo }
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-        mov     ax,-1
-@@1:
-end;
-
-function CreateFileStr(FName: PChar): TFileHandle; assembler;
-asm
-@@Retry:
-        push    ds
-        lds     dx,FName
-        mov     cl,20h
-        xor     ch,ch
-        mov     ah,3Ch
-        int     21h
-        pop     ds
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        les     dx,FName
-        push    es
-        push    dx              { FName as errorinfo }
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-        mov     ax,-1
-@@1:
-end;
-
-procedure DeleteFileStr(FName: PChar); assembler;
-asm
-@@Retry:
-        push    ds
-        lds     dx,FName
-        mov     AH,41h
-        int     21h
-        pop     ds
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        les     dx,FName
-        push    es
-        push    dx
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-@@1:
-end;
-
-procedure CloseFile(Handle: TFileHandle); assembler;
-asm
-@@Retry:
-        mov     bx,Handle
-        mov     ah,3eh
-        int     21h
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        push    ax
-        push    ax
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-@@1:
-end;
-
-function SeekFile(Handle: TFileHandle; Pos: TFileInt; SeekType: Word): TFileInt; assembler;
-asm
-@@Retry:
-        mov     ah,42H
-        mov     bx,Handle
-        mov     dx,word ptr Pos[0]
-        mov     cx,word ptr Pos[2]
-        mov     al,byte ptr SeekType
-        int     21h
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        push    ax
-        push    ax
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-        mov     ax,-1
-        mov     dx,-1
-@@1:
-end;
-
-function ReadFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord; assembler;
-asm
-@@Retry:
-        push    ds
-        lds     dx,Buff
-        mov     cx,Count
-        mov     bx,Handle
-        mov     ah,3fh
-        int     21h
-        pop     ds
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        push    ax
-        push    ax
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-        xor     ax,ax
-@@1:
-end;
-
-function WriteFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord; assembler;
-asm
-@@Retry:
-        push    ds
-        lds     dx,Buff
-        mov     cx,Count
-        mov     bx,Handle
-        mov     ah,40h
-        int     21h
-        pop     ds
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        push    ax
-        push    ax
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-        xor     ax,ax
-@@1:
-end;
-
-procedure FlushFile(Handle: TFileHandle); assembler;
-asm
-@@Retry:
-        mov     bx,Handle
-        mov     ah,68H
-        int     21h
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        push    ax
-        push    ax
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-@@1:
-end;
-
-procedure TruncateFile(Handle: TFileHandle);
-begin
-  WriteFile(Handle, Handle, 0);
-end;
-
-function EndOfFile(Handle: TFileHandle): Boolean; assembler;
-asm
-@@Retry:
-        mov     ax,4400h
-        mov     bx,Handle
-        int     21h
-        jnc     @@1
-        push    ax
-        mov     ax,0
-        push    ax
-        push    ax
-        push    ax
-        call    [ErrorHandler]
-        cmp     ax,errRetry
-        je      @@Retry
-        jmp     @@3      { Set result to 1, though an error has happened }
-@@1:
-        test    ax,40h
-        jz      @@3
-        xor     al,al
-        jmp     @@2
-@@3:
-        mov     al,1
-@@2:
-end;
-
-function FilePos(Handle: TFileHandle): TFileInt;
-begin
-  FilePos := SeekFile(Handle, 0, skCur);
-end;
-
-function FileSize(Handle: TFileHandle): TFileInt;
-var
-  L: Longint;
-begin
-  L := FilePos(Handle);
-  FileSize := SeekFile(Handle, 0, skEnd);
-  SeekFile(Handle, L, skBeg);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:26  michael
-  + removed logs
- 
-}

+ 0 - 149
api/tp/keyboard.inc

@@ -1,149 +0,0 @@
-{
-  System independent keyboard interface for tp7
-
-  $Id$
-}
-
-procedure InitKeyboard;
-begin
-end;
-
-procedure DoneKeyboard;
-begin
-end;
-
-function GetKeyEvent: TKeyEvent; assembler;
-asm
-        mov     ax,[word ptr PendingKeyEvent+0]
-        or      ax,[word ptr PendingKeyEvent+2]
-        je      @@1
-        mov     ax,[word ptr PendingKeyEvent+0]
-        mov     dx,[word ptr PendingKeyEvent+2]
-        mov     [word ptr PendingKeyEvent+0],0
-        mov     [word ptr PendingKeyEvent+2],0
-        jmp     @@99
-@@1:
-        mov     ax,40h
-        mov     es,ax
-        mov     ah, 10h         { get extended key }
-        int     16h
-        mov     dh,3
-        mov     dl,[byte ptr es:17h] { shift state }
-        and     dl,0fh
-        cmp     al,0e0h
-        jne     @@2
-        or      ah,ah
-        jz      @@2
-        mov     al,0
-@@2:
-@@99:
-end;
-
-
-function PollKeyEvent: TKeyEvent; assembler;
-asm
-        mov     ax,[word ptr PendingKeyEvent+0]
-        or      ax,[word ptr PendingKeyEvent+2]
-        je      @@1
-        mov     ax,[word ptr PendingKeyEvent+0]
-        mov     dx,[word ptr PendingKeyEvent+2]
-        jmp     @@2
-@@1:
-        mov     ax,40h
-        mov     es,ax
-        mov     ah,11h
-        int     16h
-        jnz     @@2
-        xor     ax,ax
-        xor     dx,dx
-        jmp     @@99
-@@2:    mov     dh,3
-        mov     dl,[byte ptr es:17h] { shift state }
-        and     dl,0fh
-        cmp     al,0e0h
-        jne     @@3
-        or      ah,ah
-        jz      @@3
-        mov     al,0
-@@3:
-@@99:
-end;
-
-
-function PollShiftStateEvent: TKeyEvent;assembler;
-asm
-        mov     ax,40h
-        mov     es,ax
-        xor     dx,dx
-        xor     ax,ax
-        mov     dl,byte ptr es:[17h] { shift state}
-        and     dl,0fh
-end;
-
-
-{ Function key translation }
-type
-  TTranslationEntry = record
-    Min, Max: Byte;
-    Offset: Word;
-  end;
-
-const
-  TranslationTableEntries = 12;
-  TranslationTable: array [1..TranslationTableEntries] of TTranslationEntry =
-    ((Min: $3B; Max: $44; Offset: kbdF1),   { function keys F1-F10 }
-     (Min: $54; Max: $5D; Offset: kbdF1),   { Shift fn keys F1-F10 }
-     (Min: $5E; Max: $67; Offset: kbdF1),   { Ctrl fn keys F1-F10 }
-     (Min: $68; Max: $71; Offset: kbdF1),   { Alt fn keys F1-F10 }
-     (Min: $85; Max: $86; Offset: kbdF11),  { function keys F11-F12 }
-     (Min: $87; Max: $88; Offset: kbdF11),  { Shift+function keys F11-F12 }
-     (Min: $89; Max: $8A; Offset: kbdF11),  { Ctrl+function keys F11-F12 }
-     (Min: $8B; Max: $8C; Offset: kbdF11),  { Alt+function keys F11-F12 }
-     (Min:  71; Max:  73; Offset: kbdHome), { Keypad keys kbdHome-kbdPgUp }
-     (Min:  75; Max:  77; Offset: kbdLeft), { Keypad keys kbdLeft-kbdRight }
-     (Min:  79; Max:  81; Offset: kbdEnd),  { Keypad keys kbdEnd-kbdPgDn }
-     (Min: $52; Max: $53; Offset: kbdInsert));
-
-
-function TranslateKeyEvent(KeyEvent: TKeyEvent): TKeyEvent;
-var
-  I: Integer;
-  ScanCode: Byte;
-begin
-  if KeyEvent and $03000000 = $03000000 then
-   begin
-     if KeyEvent and $000000FF <> 0 then
-      begin
-        TranslateKeyEvent := KeyEvent and $00FFFFFF;
-        exit;
-      end
-     else
-      begin
-        { This is a function key }
-        ScanCode := (KeyEvent and $0000FF00) shr 8;
-        for I := 1 to TranslationTableEntries do
-         begin
-           if (TranslationTable[I].Min <= ScanCode) and (ScanCode <= TranslationTable[I].Max) then
-            begin
-              TranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) +
-                (ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
-              exit;
-            end;
-         end;
-      end;
-   end;
-  TranslateKeyEvent := KeyEvent;
-end;
-
-function TranslateKeyEventUniCode(KeyEvent: TKeyEvent): TKeyEvent;
-begin
-  TranslateKeyEventUniCode := KeyEvent;
-  ErrorHandler(errKbdNotImplemented, nil);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:26  michael
-  + removed logs
- 
-}

+ 0 - 195
api/tp/mouse.inc

@@ -1,195 +0,0 @@
-{
-  System independent mouse interface for tp7
-
-  $Id$
-}
-
-procedure MouseInt;far;assembler;
-asm
-        mov     si,seg @data
-        mov     ds,si
-        mov     si,cx
-        mov     MouseButtons,bl
-        mov     MouseWhereX,si
-        mov     MouseWhereY,dx
-        cmp     PendingMouseEvents,MouseEventBufSize
-        je      @@20
-        les     di,PendingMouseTail
-        cld
-        xchg    ax,bx
-        stosw
-        xchg    ax,cx
-        shr     ax,3
-        stosw
-        xchg    ax,dx
-        shr     ax,3
-        stosw
-        xor     ax,ax
-        stosw
-        mov     ax,offset PendingMouseEvent
-        add     ax,MouseEventBufSize*8
-        cmp     di,ax
-        jne     @@10
-        mov     di,offset PendingMouseEvent
-@@10:   mov     word ptr PendingMouseTail,di
-        inc     PendingMouseEvents
-@@20:
-end;
-
-
-procedure InitMouse;
-begin
-  PendingMouseHead:=@PendingMouseEvent;
-  PendingMouseTail:=@PendingMouseEvent;
-  PendingMouseEvents:=0;
-  FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
-  asm
-        mov     ax,0ch
-        mov     cx,0ffffh
-        mov     dx,offset MouseInt
-        push    cs
-        pop     es
-        push    bp
-        int     33h
-        pop     bp
-  end;
-  ShowMouse;
-end;
-
-
-procedure DoneMouse;
-begin
-  HideMouse;
-  asm
-        mov     ax,0ch
-        xor     cx,cx
-        xor     dx,dx
-        mov     es,cx
-        push    bp
-        int     33h
-        pop     bp
-  end;
-end;
-
-
-function DetectMouse:byte;assembler;
-asm
-        mov     ax,3533h
-        push    bp
-        int     21h
-        pop     bp
-        mov     ax,es
-        or      ax,bx
-        jz      @@99
-        xor     ax,ax
-        push    bp
-        int     33h
-        pop     bp
-        or      ax,ax
-        jz      @@99
-        mov     ax,bx
-@@99:
-end;
-
-
-procedure ShowMouse;assembler;
-asm
-        mov     ax,1
-        push    bp
-        int     33h
-        pop     bp
-end;
-
-
-procedure HideMouse;assembler;
-asm
-        mov     ax,2
-        push    bp
-        int     33h
-        pop     bp
-end;
-
-
-function GetMouseX:word;assembler;
-asm
-        mov     ax,3
-        push    bp
-        int     33h
-        pop     bp
-        mov     ax,cx
-        shr     ax,3
-        inc     ax
-end;
-
-
-function GetMouseY:word;assembler;
-asm
-        mov     ax,3
-        push    bp
-        int     33h
-        pop     bp
-        mov     ax,dx
-        shr     ax,3
-        inc     ax
-end;
-
-
-function GetMouseButtons:word;assembler;
-asm
-        mov     ax,3
-        push    bp
-        int     33h
-        pop     bp
-        mov     ax,bx
-end;
-
-
-procedure SetMouseXY(x,y:word);assembler;
-asm
-        mov     ax,4
-        mov     cx,x
-        mov     dx,y
-        push    bp
-        int     33h
-        pop     bp
-end;
-
-
-procedure GetMouseEvent(var MouseEvent: TMouseEvent);
-begin
-  repeat until PendingMouseEvents>0;
-  MouseEvent:=PendingMouseHead^;
-  inc(PendingMouseHead);
-  if longint(PendingMouseHead)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
-   PendingMouseHead:=@PendingMouseEvent;
-  dec(PendingMouseEvents);
-  if (LastMouseEvent.x<>MouseEvent.x) or (LastMouseEvent.y<>MouseEvent.y) then
-   MouseEvent.Action:=MouseActionMove;
-  if (LastMouseEvent.Buttons<>MouseEvent.Buttons) then
-   begin
-     if (LastMouseEvent.Buttons=0) then
-      MouseEvent.Action:=MouseActionDown
-     else
-      MouseEvent.Action:=MouseActionUp;
-   end;
-  LastMouseEvent:=MouseEvent;
-end;
-
-
-function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
-begin
-  if PendingMouseEvents>0 then
-   begin
-     MouseEvent:=PendingMouseHead^;
-     PollMouseEvent:=true;
-   end
-  else
-   PollMouseEvent:=false;
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:27  michael
-  + removed logs
- 
-}

+ 0 - 230
api/tp/video.inc

@@ -1,230 +0,0 @@
-{
-  System independent low-level video interface for tp7
-
-  $Id$
-}
-
-{ use a buffer, just like linux,go32v2 }
-{$define use_buf}
-
-
-procedure TargetEntry;
-begin
-end;
-
-procedure TargetExit;
-begin
-end;
-
-var
-  VideoSeg    : word;
-  OldVideoBuf : PVideoBuf;
-
-{ internal function, which is by default available under FPC }
-procedure fillword(var buf;len,w:word);assembler;
-asm
-        les     di,buf
-        mov     cx,len
-        mov     ax,w
-        rep     stosw
-end;
-
-
-procedure InitVideo;
-begin
-  asm
-        mov     ah,0fh
-        int     10h
-        mov     [ScreenColor],1
-        test    al,1            { even modes are colored }
-        jne     @ColorOn
-        mov     [ScreenColor],0
-@ColorOn:
-        cmp     al,7            { 7 mono mode }
-        mov     dx,SegB800
-        jne     @@1
-        mov     [ScreenColor],0
-        mov     dx,SegB000
-@@1:
-{$ifdef use_buf}
-        mov     videoseg,dx
-{$else}
-        mov     [word ptr VideoBuf+0], 0
-        mov     [word ptr VideoBuf+2], dx
-{$endif}
-        xchg    al,ah
-        xor     ah,ah
-        mov     [ScreenWidth],ax
-        mov     bx,40h
-        mov     cx,ax                   { cx:=ax, pipeline ok }
-        mov     es,bx
-        shl     cx,1
-        mov     ax,[word ptr es:04ch] { Size of videobuf }
-        xor     dx,dx
-        div     cx
-        mov     [ScreenHeight],ax
-        mov     ah,03h
-        xor     bh,bh
-        int     10h
-        mov     [CursorLines], cl
-        xor     ax,ax
-        mov     al,dl
-        mov     [CursorX],ax
-        mov     al,dh
-        mov     [CursorY],ax
-  end;
-{$ifdef use_buf}
-  VideoBufSize:=ScreenWidth*ScreenHeight*2;
-  GetMem(VideoBuf,VideoBufSize);
-  GetMem(OldVideoBuf,VideoBufSize);
-{$endif}
-  ClearScreen;
-end;
-
-
-procedure DoneVideo;
-begin
-  ClearScreen;
-  SetCursorType(crUnderLine);
-  SetCursorPos(0,0);
-{$ifdef use_buf}
-  FreeMem(VideoBuf,VideoBufSize);
-  FreeMem(OldVideoBuf,VideoBufSize);
-  VideoBufSize:=0;
-{$endif}
-end;
-
-
-function GetCapabilities: Word;
-begin
-  GetCapabilities := $3F;
-end;
-
-
-procedure SetCursorPos(NewCursorX, NewCursorY: Word); assembler;
-asm
-        mov     ah,02h
-        xor     bh,bh
-        mov     dh,[byte ptr NewCursorY]
-        mov     dl,[byte ptr NewCursorX]
-        int     10h
-        mov     [byte ptr CursorY],dh
-        mov     [byte ptr CursorX],dl
-end;
-
-
-function GetCursorType: Word; assembler;
-asm
-        mov     ah,03h
-        xor     bh,bh
-        int     10h
-        mov     ax,crHidden
-        cmp     cx,2000h
-        je      @@1
-        mov     ax,crBlock
-        cmp     ch,00h
-        je      @@1
-        mov     ax,crHalfBlock
-        mov     bl,[CursorLines]
-        shr     bl,1
-        cmp     ch,bl
-        jbe     @@1
-        mov     ax,crUnderline
-@@1:
-end;
-
-
-procedure SetCursorType(NewType: Word); assembler;
-asm
-        mov     ah,01h
-        mov     bx,[NewType]
-        mov     cx,2000h
-        cmp     bx,crHidden
-        je      @@1
-        mov     ch,[CursorLines]
-        mov     cl,ch
-        shr     ch,1
-        cmp     bx,crHalfBlock
-        je      @@1
-        mov     ch,0
-        cmp     bx,crBlock
-        je      @@1
-        mov     cl,[CursorLines]
-        mov     ch,cl
-        dec     ch
-@@1:
-        int     10h
-end;
-
-
-procedure ClearScreen;
-begin
-  FillWord(VideoBuf^,VideoBufSize shr 1,$0720);
-{$ifdef use_buf}
-  UpdateScreen(true);
-{$endif}
-end;
-
-
-procedure UpdateScreen(Force: Boolean);
-{$ifdef use_buf}
-var
-  SwapPtr : PVideoBuf;
-{$endif}
-begin
-  if LockUpdateScreen<>0 then
-   exit;
-{$ifdef use_buf}
-  if not force then
-   begin
-     asm
-        mov     cx,word ptr VideoBufSize
-        shr     cx,1
-        les     di,OldVideoBuf
-        push    ds
-        lds     si,VideoBuf
-        repe    cmpsw
-        pop     ds
-        or      cx,cx
-        jz      @@10
-        mov     force,1
-@@10:
-     end;
-   end;
-  if force then
-   begin
-     move(videobuf^,ptr(videoseg,0)^,VideoBufSize);
-     move(videobuf^,oldvideobuf^,VideoBufSize);
-   end;
-{$endif}
-end;
-
-
-function DefaultVideoModeSelector(const VideoMode: TVideoMode; Params: Longint): Boolean; assembler;
-asm
-        mov     ax,[word ptr Params+0]
-        mov     bx,[word ptr Params+2]
-        push    bp
-        int     10h
-        pop     bp
-        mov     al,1
-end;
-
-
-procedure RegisterVideoModes;
-begin
-  RegisterVideoMode(40, 25, False, DefaultVideoModeSelector, $00000000);
-  RegisterVideoMode(40, 25, True, DefaultVideoModeSelector, $00000001);
-  RegisterVideoMode(80, 25, False, DefaultVideoModeSelector, $00000002);
-  RegisterVideoMode(80, 25, True, DefaultVideoModeSelector, $00000003);
-end;
-
-{
-  $Log$
-  Revision 1.3  2000-10-04 11:53:32  pierre
-   Add TargetEntry and TargetExit (merged)
-
-  Revision 1.2  2000/07/13 11:32:27  michael
-  + removed logs
-
-}

+ 0 - 39
api/tpapi.pas

@@ -1,39 +0,0 @@
-{
-   $Id$
-   Helper for building all the units.
-
-   Copyright (c) 1999-2000 by FPC Developer Team
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-}
-
-program BuildAPI;
-uses
-  ApiComm, FileSys, FileCtrl, Video, Keyboard, Mouse, CallSpec;
-
-begin
-end.
-
-{
-  $Log$
-  Revision 1.1  2000-07-13 06:29:38  michael
-  + Initial import
-
-  Revision 1.2  2000/06/22 16:32:30  hajny
-    * ApiComm instead of Common
-
-
-}

+ 0 - 182
api/unix/filectrl.inc

@@ -1,182 +0,0 @@
-{
-  System independent filecontrol interface for linux
-
-  $Id$
-}
-uses
-  Linux;
-
-function OpenFileStr(FName: PChar; Flags: Longint): TFileHandle; [ alias: 'OpenFile' ];
-var
-  RC : longint;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    OpenFileStr:=fdOpen(FName, Flags, FilePerms);
-    RC:=LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, FName);
-  until (RC <= 0) or (Todo <> errRetry);
-end;
-
-function CreateFileStr(FName: PChar): TFileHandle; [ alias: 'CreateFile' ];
-const
-  O_RDONLY = 0;
-  O_WRONLY = 1;
-  O_RDWR   = 2;
-  O_CREATE = 64;
-  O_EXCL   = 128;
-  O_NOCTTY = 256;
-  O_TRUNC  = 512;
-  O_APPEND = 1024;
-begin
-  CreateFileStr := OpenFileStr(FName, O_RDWR+O_CREATE+O_TRUNC);
-end;
-
-procedure CloseFile(Handle: TFileHandle);
-var
-  RC: Longint;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    fdClose(Handle);
-    RC := LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-end;
-
-function SeekFile(Handle: TFileHandle; Pos: TFileInt; SeekType: Word): TFileInt;
-var
-  RC: Longint;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    RC := -fdSeek(Handle, Pos, SeekType);
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-  SeekFile := -RC;
-end;
-
-procedure DeleteFileStr(FName: PChar); [ alias: 'DeleteFile' ];
-var
-  RC: Longint;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    UnLink(FName);
-    RC:=LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-end;
-
-function ReadFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  RC: Longint;
-  BytesRead: LongInt;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    BytesRead := fdRead(Handle, Buff, Count);
-    RC:=LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-  if (RC > 0) then
-    ReadFile := 0
-   else
-    ReadFile := BytesRead;
-end;
-
-
-function WriteFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  RC: Longint;
-  BytesWritten: LongInt;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    BytesWritten := fdWrite(Handle, Buff, Count);
-    RC:=LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-  if (RC > 0) then
-    WriteFile := 0
-   else
-    WriteFile := BytesWritten;
-end;
-
-{ The following two routines should go to syscalls... }
-
-procedure FlushFile(Handle: TFileHandle);
-var
-  RC: Longint;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    fdFlush(Handle);
-    RC:=LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-end;
-
-procedure TruncateFile(Handle: TFileHandle);
-var
-  RC: Longint;
-  Todo: TErrorHandlerReturnValue;
-begin
-  repeat
-    fdTruncate(Handle,0);
-    RC:=LinuxError;
-    if (RC > 0) then
-      Todo := ErrorHandler(RC, nil);
-  until (RC <= 0) or (Todo <> errRetry);
-end;
-
-function EndOfFile(Handle: TFileHandle): Boolean;
-begin
-  EndOfFile := FilePos(Handle) >= FileSize(Handle);
-end;
-
-function FilePos(Handle: TFileHandle): TFileInt;
-begin
-  FilePos := SeekFile(Handle, 0, skCur);
-end;
-
-function FileSize(Handle: TFileHandle): TFileInt;
-var
-  L: Longint;
-begin
-  L := FilePos(Handle);
-  FileSize := SeekFile(Handle, 0, skEnd);
-  SeekFile(Handle, L, skBeg);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-10-26 23:08:48  peter
-    * merged freebsd from fixes
-
-  Revision 1.1.2.1  2000/10/25 12:23:20  marco
-   * Linux dir split up
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.1  1998/12/04 12:48:30  peter
-    * moved some dirs
-
-  Revision 1.1  1998/10/26 11:31:47  peter
-    + inital include files
-
-}

+ 0 - 142
api/unix/gpm114.pas

@@ -1,142 +0,0 @@
-{
-  $Id$
-
-  Low level unit for GPM v1.14, the mouse server for Linux
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Library General Public License as published
-  by the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *************************************************************************}
-unit gpm114;
-interface
-
-uses
-  linux;
-
-{$LINKLIB c}
-{$LINKLIB gpm}
-
-const
-  { Buttons }
-  GPM_B_LEFT         = 4;
-  GPM_B_MIDDLE       = 2;
-  GPM_B_RIGHT        = 1;
-
-  { Event types }
-  GPM_MOVE           = 1;
-  GPM_DRAG           = 2;
-  GPM_DOWN           = 4;
-  GPM_UP             = 8;
-
-  GPM_SINGLE         = 16;            { at most one in three is set }
-  GPM_DOUBLE         = 32;
-  GPM_TRIPLE         = 64;
-
-  GPM_MFLAG          = 128;
-  GPM_HARD           = 256;
-
-  GPM_ENTER          = 512;
-  GPM_LEAVE          = 1024;
-
-  GPM_BARE_EVENTS    = $60F;
-
-  { Margins }
-  GPM_TOP            = 1;
-  GPM_BOT            = 2;
-  GPM_LFT            = 4;
-  GPM_RGT            = 8;
-
-type
-{$PACKRECORDS 4}
-  TGPMConnect = record
-    EventMask, DefaultMask: Word;
-    MinMod, MaxMod: Word;
-    Pid: Longint;
-    vc: Longint;
-  end;
-
-  TGPMEvent = record
-    Buttons, Modifiers: Byte;
-    vc: Word;
-    Dx, Dy, X, Y: Integer;
-    EventType: Word;
-    Clicks: Longint;
-    GPMMargin: Word;
-  end;
-
-  TGPMHandler = function (const GPMEvent: TGPMEvent; ClientData: Pointer): Longint;cdecl;
-
-{ Global variables }
-var
-  gpm_flag           : Longint;cvar;external;
-  gpm_consolefd      : Longint;cvar;external name 'gpm_fd';
-  gpm_tried          : Longbool;cvar;external;
-  gpm_hflag          : Longbool;cvar;external;
-  gpm_morekeys       : Longbool;cvar;external;
-  gpm_zerobased      : Longbool;cvar;external;
-  gpm_visiblepointer : Longbool;cvar;external;
-  gpm_mx             : Longint;cvar;external;
-  gpm_my             : Longint;cvar;external;
-  gpm_timeout        : timeval;cvar;external;
-  gpm_handler        : TGPMHandler;cvar;external;
-  gpm_data           : Pointer;cvar;external;
-  gpm_console_fd     : Longint;cvar;external;
-
-function Gpm_Open(var Connect: TGPMConnect; Flag: Longint): Longint;cdecl;
-function Gpm_Close:Longint;cdecl;
-function Gpm_GetEvent(var Event: TGpmEvent): Longint;cdecl;
-
-function Gpm_GetLibVersion(var where: Longint): PChar;cdecl;
-function Gpm_GetServerVersion(var where: Longint): PChar;cdecl;
-function Gpm_GetSnapshot(var Event: TGPMEvent): Longint;cdecl;
-
-implementation
-
-function Gpm_Open(var Connect: TGPMConnect; Flag: Longint): Longint; cdecl;external;
-function Gpm_Close: Longint; cdecl;external;
-function Gpm_GetEvent(var Event: TGpmEvent): Longint; cdecl;external;
-
-function Gpm_GetLibVersion(var where: Longint): PChar; cdecl;external;
-function Gpm_GetServerVersion(var where: Longint): PChar; cdecl;external;
-function Gpm_GetSnapshot(var Event: TGPMEvent): Longint; cdecl;external;
-
-
-end.
-{
-  $Log$
-  Revision 1.2  2000-10-26 23:08:48  peter
-    * merged freebsd from fixes
-
-  Revision 1.1.2.1  2000/10/25 12:23:20  marco
-   * Linux dir split up
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.1  1999/07/01 19:41:26  peter
-    * define OLDGPM to compile with old gpm (for v1.14) else the new
-      gpm unit from rtl will be used (v1.17)
-
-  Revision 1.1  1998/12/04 12:48:30  peter
-    * moved some dirs
-
-  Revision 1.1  1998/10/29 11:02:51  peter
-    + mouse for linux
-
-}

+ 0 - 858
api/unix/keyboard.inc

@@ -1,858 +0,0 @@
-{
-  System independent keyboard interface for linux
-
-  $Id$
-}
-
-uses
-  Linux;
-
-
-var
-  OldIO : TermIos;
-{$ifdef logging}
-  f : text;
-{$endif logging}
-
-Procedure SetRawMode(b:boolean);
-Var
-  Tio : Termios;
-Begin
-  TCGetAttr(1,Tio);
-  if b then
-   begin
-     OldIO:=Tio;
-     Tio.c_iflag:=Tio.c_iflag and (not (IGNBRK or BRKINT or PARMRK or ISTRIP or
-                                INLCR or IGNCR or ICRNL or IXON));
-     Tio.c_lflag:=Tio.c_lflag and (not (ECHO or ECHONL or ICANON or ISIG or IEXTEN));
-   end
-  else
-    Tio := OldIO;
-  TCSetAttr(1,TCSANOW,Tio);
-End;
-
-type
-  chgentry=packed record
-    tab,
-    idx,
-    oldtab,
-    oldidx : byte;
-    oldval,
-    newval : word;
-  end;
-  kbentry=packed record
-    kb_table,
-    kb_index : byte;
-    kb_value : word;
-  end;
-
-const
-  kbdchanges=10;
-  kbdchange:array[1..kbdchanges] of chgentry=(
-    (tab:8; idx:$3b; oldtab:0; oldidx:$3b; oldval:0; newval:0),
-    (tab:8; idx:$3c; oldtab:0; oldidx:$3c; oldval:0; newval:0),
-    (tab:8; idx:$3d; oldtab:0; oldidx:$3d; oldval:0; newval:0),
-    (tab:8; idx:$3e; oldtab:0; oldidx:$3e; oldval:0; newval:0),
-    (tab:8; idx:$3f; oldtab:0; oldidx:$3f; oldval:0; newval:0),
-    (tab:8; idx:$40; oldtab:0; oldidx:$40; oldval:0; newval:0),
-    (tab:8; idx:$41; oldtab:0; oldidx:$41; oldval:0; newval:0),
-    (tab:8; idx:$42; oldtab:0; oldidx:$42; oldval:0; newval:0),
-    (tab:8; idx:$43; oldtab:0; oldidx:$43; oldval:0; newval:0),
-    (tab:8; idx:$44; oldtab:0; oldidx:$44; oldval:0; newval:0)
-  );
- KDGKBENT=$4B46;
- KDSKBENT=$4B47;
-
-procedure PatchKeyboard;
-var
-  e : ^chgentry;
-  entry : kbentry;
-  i : longint;
-begin
-  for i:=1to kbdchanges do
-   begin
-     e:=@kbdchange[i];
-     entry.kb_table:=e^.tab;
-     entry.kb_index:=e^.idx;
-     Ioctl(stdinputhandle,KDGKBENT,@entry);
-     e^.oldval:=entry.kb_value;
-     entry.kb_table:=e^.oldtab;
-     entry.kb_index:=e^.oldidx;
-     ioctl(stdinputhandle,KDGKBENT,@entry);
-     e^.newval:=entry.kb_value;
-   end;
-  for i:=1to kbdchanges do
-   begin
-     e:=@kbdchange[i];
-     entry.kb_table:=e^.tab;
-     entry.kb_index:=e^.idx;
-     entry.kb_value:=e^.newval;
-     Ioctl(stdinputhandle,KDSKBENT,@entry);
-   end;
-end;
-
-
-procedure UnpatchKeyboard;
-var
-  e : ^chgentry;
-  entry : kbentry;
-  i : longint;
-begin
-  for i:=1to kbdchanges do
-   begin
-     e:=@kbdchange[i];
-     entry.kb_table:=e^.tab;
-     entry.kb_index:=e^.idx;
-     entry.kb_value:=e^.oldval;
-     Ioctl(stdinputhandle,KDSKBENT,@entry);
-   end;
-end;
-
-
-
-{ Buffered Input routines }
-const
-  InSize=256;
-var
-  InBuf  : array[0..InSize-1] of char;
-  InCnt,
-  InHead,
-  InTail : longint;
-
-function ttyRecvChar:char;
-var
-  Readed,i : longint;
-begin
-{Buffer Empty? Yes, Input from StdIn}
-  if (InHead=InTail) then
-   begin
-   {Calc Amount of Chars to Read}
-     i:=InSize-InHead;
-     if InTail>InHead then
-      i:=InTail-InHead;
-   {Read}
-     Readed:=fdRead(StdInputHandle,InBuf[InHead],i);
-   {Increase Counters}
-     inc(InCnt,Readed);
-     inc(InHead,Readed);
-   {Wrap if End has Reached}
-     if InHead>=InSize then
-      InHead:=0;
-   end;
-{Check Buffer}
-  if (InCnt=0) then
-   ttyRecvChar:=#0
-  else
-   begin
-     ttyRecvChar:=InBuf[InTail];
-     dec(InCnt);
-     inc(InTail);
-     if InTail>=InSize then
-      InTail:=0;
-   end;
-end;
-
-
-Const
-  KeyBufferSize = 20;
-var
-  KeyBuffer : Array[0..KeyBufferSize-1] of Char;
-  KeyPut,
-  KeySend   : longint;
-
-Procedure PushKey(Ch:char);
-Var
-  Tmp : Longint;
-Begin
-  Tmp:=KeyPut;
-  Inc(KeyPut);
-  If KeyPut>=KeyBufferSize Then
-   KeyPut:=0;
-  If KeyPut<>KeySend Then
-   KeyBuffer[Tmp]:=Ch
-  Else
-   KeyPut:=Tmp;
-End;
-
-
-Function PopKey:char;
-Begin
-  If KeyPut<>KeySend Then
-   Begin
-     PopKey:=KeyBuffer[KeySend];
-     Inc(KeySend);
-     If KeySend>=KeyBufferSize Then
-      KeySend:=0;
-   End
-  Else
-   PopKey:=#0;
-End;
-
-
-Procedure PushExt(b:byte);
-begin
-  PushKey(#0);
-  PushKey(chr(b));
-end;
-
-
-const
-  AltKeyStr  : string[38]='qwertyuiopasdfghjklzxcvbnm1234567890-=';
-  AltCodeStr : string[38]=#016#017#018#019#020#021#022#023#024#025#030#031#032#033#034#035#036#037#038+
-                          #044#045#046#047#048#049#050#120#121#122#123#124#125#126#127#128#129#130#131;
-Function FAltKey(ch:char):byte;
-var
-  Idx : longint;
-Begin
-  Idx:=Pos(ch,AltKeyStr);
-  if Idx>0 then
-   FAltKey:=byte(AltCodeStr[Idx])
-  else
-   FAltKey:=0;
-End;
-
-
-{ This one doesn't care about keypresses already processed by readkey  }
-{ and waiting in the KeyBuffer, only about waiting keypresses at the   }
-{ TTYLevel (including ones that are waiting in the TTYRecvChar buffer) }
-function sysKeyPressed: boolean;
-var
-  fdsin : fdSet;
-begin
-  if (InCnt>0) then
-   sysKeyPressed:=true
-  else
-   begin
-     FD_Zero(fdsin);
-     fd_Set(StdInputHandle,fdsin);
-     sysKeypressed:=(Select(StdInputHandle+1,@fdsin,nil,nil,0)>0);
-   end;
-end;
-
-Function KeyPressed:Boolean;
-Begin
-  Keypressed := (KeySend<>KeyPut) or sysKeyPressed;
-End;
-
-
-{$ifdef DEBUG}
-Function RawReadKey:char;
-Var
-  ch       : char;
-  OldState,
-  State    : longint;
-  is_delay : boolean;
-  fdsin    : fdSet;
-Begin
-{Check Buffer first}
-  if KeySend<>KeyPut then
-   begin
-     RawReadKey:=PopKey;
-     exit;
-   end;
-{Wait for Key}
-  if not sysKeyPressed then
-   begin
-     FD_Zero (fdsin);
-     FD_Set (StdInputHandle,fdsin);
-     Select (StdInputHandle+1,@fdsin,nil,nil,nil);
-   end;
-  RawReadKey:=ttyRecvChar;
-end;
-{$endif DEBUG}
-
-
-Function ReadKey:char;
-Var
-  ch       : char;
-  OldState,
-  State    : longint;
-  is_delay : boolean;
-  fdsin    : fdSet;
-Begin
-{Check Buffer first}
-  if KeySend<>KeyPut then
-   begin
-     ReadKey:=PopKey;
-     exit;
-   end;
-{Wait for Key}
-  if not sysKeyPressed then
-   begin
-     FD_Zero (fdsin);
-     FD_Set (StdInputHandle,fdsin);
-     Select (StdInputHandle+1,@fdsin,nil,nil,nil);
-   end;
-  ch:=ttyRecvChar;
-{Esc Found ?}
-  If (ch=#27) then
-   begin
-     FD_Zero(fdsin);
-     fd_Set(StdInputHandle,fdsin);
-     State:=1;
-{$ifdef logging}
-     write(f,'Esc');
-{$endif logging}
-     if InCnt=0 then
-      Select(StdInputHandle+1,@fdsin,nil,nil,10);
-     while (State<>0) and (sysKeyPressed) do
-      begin
-        ch:=ttyRecvChar;
-{$ifdef logging}
-        if ord(ch)>31 then
-          write(f,ch)
-        else
-          write(f,'#',ord(ch):2);
-{$endif logging}
-        OldState:=State;
-        State:=0;
-        case OldState of
-        1 : begin {Esc}
-              case ch of
-          'a'..'z',
-          '0'..'9',
-           '-','=' : PushExt(FAltKey(ch));
-               #10 : PushKey(#10);
-               #13 : PushKey(#10);
-              #127 : PushKey(#8);
-               '[' : State:=2;
-               'O' : State:=6;
-               else
-                begin
-                  PushKey(#27);
-                  PushKey(ch);
-                end;
-               end;
-            end;
-        2 : begin {Esc[}
-              case ch of
-               '[' : State:=3;
-               'A' : PushExt(72);
-               'B' : PushExt(80);
-               'C' : PushExt(77);
-               'D' : PushExt(75);
-               'G' : PushKey('5');
-               'H' : PushExt(71);
-               'K' : PushExt(79);
-               '1' : State:=4;
-               '2' : State:=5;
-               '3' : State:=12;{PushExt(83)}
-               '4' : PushExt(79);
-               '5' : PushExt(73);
-               '6' : PushExt(81);
-               '?' : State:=7;
-              else
-               begin
-                 PushKey(#27);
-                 PushKey('[');
-                 PushKey(ch);
-               end;
-              end;
-              if ch in ['3'..'6'] then
-               State:=255;
-            end;
-        3 : begin {Esc[[}
-              case ch of
-               'A' : PushExt(59);
-               'B' : PushExt(60);
-               'C' : PushExt(61);
-               'D' : PushExt(62);
-               'E' : PushExt(63);
-              else
-               begin
-                 PushKey(#27);
-                 PushKey('[');
-                 PushKey('[');
-                 PushKey(ch);
-               end;
-              end;
-            end;
-        4 : begin {Esc[1}
-              case ch of
-               '~' : PushExt(71);
-               '7' : PushExt(64);
-               '8' : PushExt(65);
-               '9' : PushExt(66);
-              else
-               begin
-                 PushKey(#27);
-                 PushKey('[');
-                 PushKey('1');
-                 PushKey(ch);
-               end;
-              end;
-              if (Ch<>'~') then
-               State:=255;
-            end;
-        5 : begin {Esc[2}
-              case ch of
-               '~' : PushExt(82);
-               '0' : pushExt(67);
-               '1' : PushExt(68);
-               '3' : PushExt($85){F11, but ShiftF1 also !!};
-               '4' : PushExt($86){F12, but Shift F2 also !!};
-               '5' : PushExt($56){ShiftF3};
-               '6' : PushExt($57){ShiftF4};
-               '8' : PushExt($58){ShiftF5};
-               '9' : PushExt($59){ShiftF6};
-              else
-               begin
-                 PushKey(#27);
-                 PushKey('[');
-                 PushKey('2');
-                 PushKey(ch);
-               end;
-              end;
-              if (Ch<>'~') then
-               State:=255;
-            end;
-        12 : begin {Esc[3}
-              case ch of
-               '~' : PushExt(83);
-               '1' : PushExt($5A){ShiftF7};
-               '2' : PushExt($5B){ShiftF8};
-               '3' : PushExt($5C){ShiftF9};
-               '4' : PushExt($5D){ShiftF10};
-              else
-               begin
-                 PushKey(#27);
-                 PushKey('[');
-                 PushKey('3');
-                 PushKey(ch);
-               end;
-              end;
-              if (Ch<>'~') then
-               State:=255;
-            end;
-        6 : begin {EscO Function keys in vt100 mode PM }
-              case ch of
-               'P' : {F1}PushExt(59);
-               'Q' : {F2}PushExt(60);
-               'R' : {F3}PushExt(61);
-               'S' : {F4}PushExt(62);
-               't' : {F5}PushExt(63);
-               'u' : {F6}PushExt(64);
-               'v' : {F7}PushExt(65);
-               'l' : {F8}PushExt(66);
-               'w' : {F9}PushExt(67);
-               'x' : {F10}PushExt(68);
-               'D' : {keyLeft}PushExt($4B);
-               'C' : {keyRight}PushExt($4D);
-               'A' : {keyUp}PushExt($48);
-               'B' : {keyDown}PushExt($50);
-              else
-               begin
-                 PushKey(#27);
-                 PushKey('O');
-                 PushKey(ch);
-               end;
-              end;
-            end;
-        7 : begin {Esc[? keys in vt100 mode PM }
-              case ch of
-               '0' : State:=11;
-               '1' : State:=8;
-               '7' : State:=9;
-              else
-                begin
-                  PushKey(#27);
-                  PushKey('[');
-                  PushKey('?');
-                  PushKey(ch);
-                end;
-              end;
-            end;
-        8 : begin {Esc[?1 keys in vt100 mode PM }
-              case ch of
-               'l' : {local mode};
-               'h' : {transmit mode};
-               ';' : { 'Esc[1;0c seems to be sent by M$ telnet app
-                       for no hangup purposes }
-                     state:=10;
-              else
-                begin
-                  PushKey(#27);
-                  PushKey('[');
-                  PushKey('?');
-                  PushKey('1');
-                  PushKey(ch);
-                end;
-              end;
-            end;
-        9 : begin {Esc[?7 keys in vt100 mode PM }
-              case ch of
-               'l' : {exit_am_mode};
-               'h' : {enter_am_mode};
-              else
-                begin
-                  PushKey(#27);
-                  PushKey('[');
-                  PushKey('?');
-                  PushKey('7');
-                  PushKey(ch);
-                end;
-              end;
-            end;
-        10 : begin {Esc[?1; keys in vt100 mode PM }
-              case ch of
-               '0' : state:=11;
-              else
-                begin
-                  PushKey(#27);
-                  PushKey('[');
-                  PushKey('?');
-                  PushKey('1');
-                  PushKey(';');
-                  PushKey(ch);
-                end;
-              end;
-             end;
-        11 : begin {Esc[?1;0 keys in vt100 mode PM }
-              case ch of
-               'c' : ;
-              else
-                begin
-                  PushKey(#27);
-                  PushKey('[');
-                  PushKey('?');
-                  PushKey('1');
-                  PushKey(';');
-                  PushKey('0');
-                  PushKey(ch);
-                end;
-              end;
-             end;
-      255 : { just forget this trailing char };
-        end;
-        if (State<>0) and (InCnt=0) then
-         Select(StdInputHandle+1,@fdsin,nil,nil,10);
-      end;
-     if State=1 then
-      PushKey(ch);
-     if ch='$' then
-       begin { '$<XX>' means a delay of XX millisecs }
-         is_delay :=false;
-         Select(StdInputHandle+1,@fdsin,nil,nil,10);
-         if (sysKeyPressed) then
-           begin
-             ch:=ttyRecvChar;
-             is_delay:=(ch='<');
-             if not is_delay then
-               begin
-                 PushKey('$');
-                 PushKey(ch);
-               end
-             else
-               begin
-{$ifdef logging}
-                 write(f,'$<');
-{$endif logging}
-                 Select(StdInputHandle+1,@fdsin,nil,nil,10);
-                 while (sysKeyPressed) and (ch<>'>') do
-                   begin
-                     { Should we really repect this delay ?? }
-                     ch:=ttyRecvChar;
-{$ifdef logging}
-                     write(f,ch);
-{$endif logging}
-                     Select(StdInputHandle+1,@fdsin,nil,nil,10);
-                   end;
-               end;
-           end
-         else
-           PushKey('$');
-       end;
-{$ifdef logging}
-       writeln(f);
-{$endif logging}
-   end
-  else
-   Begin
-     case ch of
-     #127 : PushKey(#8);
-     else
-      PushKey(ch);
-     end;
-   End;
-  ReadKey:=PopKey;
-End;
-
-
-function ShiftState:byte;
-var
-  arg,shift : longint;
-begin
-  arg:=6;
-  shift:=0;
-  {$Ifndef BSD}
-  if IOCtl(StdInputHandle,TIOCLINUX,@arg) then
-   begin
-     if (arg and (2 or 8))<>0 then
-      inc(shift,8);
-     if (arg and 4)<>0 then
-      inc(shift,4);
-     if (arg and 1)<>0 then
-      inc(shift,3);
-   end;
- {$endif}
-  ShiftState:=shift;
-end;
-
-
-{ Exported functions }
-
-procedure InitKeyboard;
-begin
-  SetRawMode(true);
-  patchkeyboard;
-{$ifdef logging}
-     assign(f,'keyboard.log');
-     rewrite(f);
-{$endif logging}
-end;
-
-
-procedure DoneKeyboard;
-begin
-  unpatchkeyboard;
-  SetRawMode(false);
-{$ifdef logging}
-  close(f);
-{$endif logging}
-end;
-
-
-function GetKeyEvent: TKeyEvent;
-
-  function EvalScan(b:byte):byte;
-  const
-    DScan:array[0..31] of byte = (
-      $39, $02, $28, $04, $05, $06, $08, $28,
-      $0A, $0B, $09, $0D, $33, $0C, $34, $35,
-      $0B, $02, $03, $04, $05, $06, $07, $08,
-      $09, $0A, $27, $27, $33, $0D, $34, $35);
-   LScan:array[0..31] of byte = (
-      $29, $1E, $30, $2E, $20, $12, $21, $22,
-      $23, $17, $24, $25, $26, $32, $31, $18,
-      $19, $10, $13, $1F, $14, $16, $2F, $11,
-      $2D, $15, $2C, $1A, $2B, $1B, $29, $0C);
-  begin
-    if (b and $E0)=$20  { digits / leters } then
-     EvalScan:=DScan[b and $1F]
-    else
-     case b of
-      $08:EvalScan:=$0E; { backspace }
-      $09:EvalScan:=$0F; { TAB }
-      $0D:EvalScan:=$1C; { CR }
-      $1B:EvalScan:=$01; { esc }
-      $40:EvalScan:=$03; { @ }
-      $5E:EvalScan:=$07; { ^ }
-      $60:EvalScan:=$29; { ` }
-     else
-      EvalScan:=LScan[b and $1F];
-     end;
-  end;
-
-  function EvalScanZ(b:byte):byte;
-  begin
-    EvalScanZ:=b;
-    if b in [$3B..$44] { F1..F10 -> Alt-F1..Alt-F10} then
-     EvalScanZ:=b+$2D;
-  end;
-const
-  CtrlArrow : array [71..81] of byte =
-   ($77,$8d,$84,$8e,$73,$8f,$74,$90,$75,$91,$76);
-var
-  MyScan,
-  SState : byte;
-  MyChar : char;
-begin {main}
-  if PendingKeyEvent<>0 then
-   begin
-     GetKeyEvent:=PendingKeyEvent;
-     PendingKeyEvent:=0;
-     exit;
-   end;
-
-  MyChar:=Readkey;
-  MyScan:=ord(MyChar);
-  SState:=ShiftState;
-
-  case MyChar of
-   #26 : begin { ^Z - replace Alt for Linux OS }
-           MyChar:=ReadKey;
-           MyScan:=ord(MyChar);
-           if MyScan=0 then
-            MyScan:=EvalScanZ(ord(ReadKey))
-           else
-            begin
-              MyScan:=EvalScan(ord(MyChar));
-              if MyScan in [$02..$0D] then
-               inc(MyScan,$76);
-              MyChar:=chr(0);
-            end;
-         end;
-    #0 : begin
-           MyScan:=ord(ReadKey);
-           { Handle Ctrl-<x> }
-           if (SState and 4)<>0 then
-            begin
-              case MyScan of
-                71..81 : { cArrow }
-                  MyScan:=CtrlArrow[MyScan];
-                $3b..$44 : { cF1-cF10 }
-                  MyScan:=MyScan+$23;
-              end;
-            end;
-           { Handle Alt-<x> }
-           if (SState and 8)<>0 then
-            begin
-              case MyScan of
-                $3b..$44 : { aF1-aF10 }
-                  MyScan:=MyScan+$2d;
-              end;
-            end;
-         end;
-    else begin
-           MyScan:=EvalScan(ord(MyChar));
-         end;
-  end;
-  GetKeyEvent:=$3000000 or ord(MyChar) or (MyScan shl 8) or (SState shl 16);
-end;
-
-
-function PollKeyEvent: TKeyEvent;
-begin
-  if PendingKeyEvent<>0 then
-   exit(PendingKeyEvent);
-  if keypressed then
-   begin
-     { just get the key and place it in the pendingkeyevent }
-     PendingKeyEvent:=GetKeyEvent;
-     PollKeyEvent:=PendingKeyEvent;
-   end
-  else
-   PollKeyEvent:=0;
-end;
-
-
-function PollShiftStateEvent: TKeyEvent;
-begin
-  PollShiftStateEvent:=ShiftState shl 16;
-end;
-
-
-{ Function key translation }
-type
-  TTranslationEntry = packed record
-    Min, Max: Byte;
-    Offset: Word;
-  end;
-const
-  TranslationTableEntries = 12;
-  TranslationTable: array [1..TranslationTableEntries] of TTranslationEntry =
-    ((Min: $3B; Max: $44; Offset: kbdF1),   { function keys F1-F10 }
-     (Min: $54; Max: $5D; Offset: kbdF1),   { Shift fn keys F1-F10 }
-     (Min: $5E; Max: $67; Offset: kbdF1),   { Ctrl fn keys F1-F10 }
-     (Min: $68; Max: $71; Offset: kbdF1),   { Alt fn keys F1-F10 }
-     (Min: $85; Max: $86; Offset: kbdF11),  { function keys F11-F12 }
-     (Min: $87; Max: $88; Offset: kbdF11),  { Shift+function keys F11-F12 }
-     (Min: $89; Max: $8A; Offset: kbdF11),  { Ctrl+function keys F11-F12 }
-     (Min: $8B; Max: $8C; Offset: kbdF11),  { Alt+function keys F11-F12 }
-     (Min:  71; Max:  73; Offset: kbdHome), { Keypad keys kbdHome-kbdPgUp }
-     (Min:  75; Max:  77; Offset: kbdLeft), { Keypad keys kbdLeft-kbdRight }
-     (Min:  79; Max:  81; Offset: kbdEnd),  { Keypad keys kbdEnd-kbdPgDn }
-     (Min: $52; Max: $53; Offset: kbdInsert));
-
-function TranslateKeyEvent(KeyEvent: TKeyEvent): TKeyEvent;
-var
-  I: Integer;
-  ScanCode: Byte;
-begin
-  if KeyEvent and $03000000 = $03000000 then
-   begin
-     if KeyEvent and $000000FF <> 0 then
-      begin
-        TranslateKeyEvent := KeyEvent and $00FFFFFF;
-        exit;
-      end
-     else
-      begin
-        { This is a function key }
-        ScanCode := (KeyEvent and $0000FF00) shr 8;
-        for I := 1 to TranslationTableEntries do
-         begin
-           if (TranslationTable[I].Min <= ScanCode) and (ScanCode <= TranslationTable[I].Max) then
-            begin
-              TranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) +
-                (ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
-              exit;
-            end;
-         end;
-      end;
-   end;
-  TranslateKeyEvent := KeyEvent;
-end;
-
-
-function TranslateKeyEventUniCode(KeyEvent: TKeyEvent): TKeyEvent;
-begin
-  TranslateKeyEventUniCode := KeyEvent;
-  ErrorHandler(errKbdNotImplemented, nil);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-10-26 23:08:48  peter
-    * merged freebsd from fixes
-
-  Revision 1.1.2.1  2000/10/25 12:23:20  marco
-   * Linux dir split up
-
-  Revision 1.1.2.4  2000/10/19 07:41:35  pierre
-   + added testkeyb for linux for get Escape sequences easily
-
-  Revision 1.1.2.3  2000/10/19 07:29:01  pierre
-   * enhance special keys support both in linux and vt100 mode
-
-  Revision 1.1.2.2  2000/10/11 16:19:44  pierre
-   * add support of function keys for vt100
-
-  Revision 1.1.2.1  2000/09/25 13:18:37  jonas
-    * added missing restoring of part of the termios info (even though those
-      fields weren't changed, leaving them uninitialized when restoring
-      won't do much good :)
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-  Revision 1.2  2000/06/30 09:00:33  jonas
-    * compiles again with -dnomouse
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.5  1999/02/16 10:44:53  peter
-    * alt-f<x> support
-
-  Revision 1.4  1998/12/15 10:30:34  peter
-    + ctrl arrows support
-    * better backspace
-
-  Revision 1.3  1998/12/12 19:13:02  peter
-    * keyboard updates
-    * make test target, make all only makes units
-
-  Revision 1.1  1998/12/04 12:48:30  peter
-    * moved some dirs
-
-  Revision 1.3  1998/10/29 12:49:48  peter
-    * more fixes
-
-  Revision 1.1  1998/10/26 11:31:47  peter
-    + inital include files
-
-}

+ 0 - 348
api/unix/mouse.inc

@@ -1,348 +0,0 @@
-{
-  System independent mouse interface for linux
-
-  $Id$
-}
-
-uses
-  Linux,Video
-{$ifndef NOMOUSE}
-{$ifdef OLDGPM}
-  ,gpm114
-{$else}
-  ,gpm
-{$endif}
-{$endif ndef NOMOUSE}
-  ;
-
-const
-  mousecur    : boolean = false;
-  mousecurofs : longint = -1;
-
-var
-  mousecurcell : TVideoCell;
-
-
-const
-  gpm_fs : longint = -1;
-
-procedure PlaceMouseCur(ofs:longint);
-{$ifndef NOMOUSE}
-var
-  upd : boolean;
-{$endif ndef NOMOUSE}
-begin
-{$ifndef NOMOUSE}
-  if VideoBuf=nil then
-   exit;
-  upd:=false;
-  if (MouseCurOfs<>-1) and (VideoBuf^[MouseCurOfs]=MouseCurCell) then
-   begin
-     VideoBuf^[MouseCurOfs]:=MouseCurCell xor $7f00;
-     upd:=true;
-   end;
-  MouseCurOfs:=ofs;
-  if (MouseCurOfs<>-1) then
-   begin
-     MouseCurCell:=VideoBuf^[MouseCurOfs] xor $7f00;
-     VideoBuf^[MouseCurOfs]:=MouseCurCell;
-     upd:=true;
-   end;
-  if upd then
-   Updatescreen(false);
-{$endif ndef NOMOUSE}
-end;
-
-
-procedure InitMouse;
-{$ifndef NOMOUSE}
-var
-  connect : TGPMConnect;
-{$endif ndef NOMOUSE}
-begin
-{$ifndef NOMOUSE}
-  PendingMouseHead:=@PendingMouseEvent;
-  PendingMouseTail:=@PendingMouseEvent;
-  PendingMouseEvents:=0;
-  FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
-  if gpm_fs=-1 then
-    begin
-    { open gpm }
-      connect.EventMask:=GPM_MOVE or GPM_DRAG or GPM_DOWN or GPM_UP;
-      connect.DefaultMask:=0;
-      connect.MinMod:=0;
-      connect.MaxMod:=0;
-      gpm_fs:=Gpm_Open(connect,0);
-      if (gpm_fs=-2) and (getenv('TERM')<>'xterm') then
-        begin
-          gpm_fs:=-1;
-          Gpm_Close;
-        end;
-    end;
-  { show mousepointer }
-  if gpm_fs<>-1 then
-    ShowMouse;
-{$endif ndef NOMOUSE}
-end;
-
-
-procedure DoneMouse;
-begin
-{$ifndef NOMOUSE}
-  If gpm_fs<>-1 then
-    begin
-      HideMouse;
-      Gpm_Close;
-      gpm_fs:=-1;
-    end;
-{$endif ndef NOMOUSE}
-end;
-
-
-function DetectMouse:byte;
-{$ifndef NOMOUSE}
-var
-  x : longint;
-  e : TGPMEvent;
-  connect : TGPMConnect;
-{$endif ndef NOMOUSE}
-begin
-{$ifdef NOMOUSE}
-  DetectMouse:=0;
-{$else ndef NOMOUSE}
-  if gpm_fs=-1 then
-    begin
-      connect.EventMask:=GPM_MOVE or GPM_DRAG or GPM_DOWN or GPM_UP;
-      connect.DefaultMask:=0;
-      connect.MinMod:=0;
-      connect.MaxMod:=0;
-      gpm_fs:=Gpm_Open(connect,0);
-      if (gpm_fs=-2) and (getenv('TERM')<>'xterm') then
-        begin
-          Gpm_Close;
-          gpm_fs:=-1;
-        end;
-    end;
-{ always a mouse deamon present }
-  if gpm_fs<>-1 then
-    begin
-      x:=Gpm_GetSnapshot(e);
-      if x<>-1 then
-        DetectMouse:=x
-      else
-        DetectMouse:=2;
-    end
-  else
-    DetectMouse:=0;
-{$endif ndef NOMOUSE}
-end;
-
-
-procedure ShowMouse;
-begin
-  PlaceMouseCur(MouseCurOfs);
-  mousecur:=true;
-end;
-
-
-procedure HideMouse;
-begin
-  PlaceMouseCur(-1);
-  mousecur:=false;
-end;
-
-
-function GetMouseX:word;
-{$ifndef NOMOUSE}
-var
-  e : TGPMEvent;
-{$endif ndef NOMOUSE}
-begin
-{$ifdef NOMOUSE}
-  GetMouseX:=0;
-{$else ndef NOMOUSE}
-  if gpm_fd<0 then
-   exit(0);
-  Gpm_GetSnapshot(e);
-  GetMouseX:=e.x-1;
-{$endif ndef NOMOUSE}
-end;
-
-
-function GetMouseY:word;
-{$ifndef NOMOUSE}
-var
-  e : TGPMEvent;
-{$endif ndef NOMOUSE}
-begin
-{$ifdef NOMOUSE}
-  GetMouseY:=0;
-{$else ndef NOMOUSE}
-  if gpm_fd<0 then
-   exit(0);
-  Gpm_GetSnapshot(e);
-  GetMouseY:=e.y-1;
-{$endif ndef NOMOUSE}
-end;
-
-
-function GetMouseButtons:word;
-{$ifndef NOMOUSE}
-var
-  e : TGPMEvent;
-{$endif ndef NOMOUSE}
-begin
-{$ifdef NOMOUSE}
-  GetMouseButtons:=0;
-{$else ndef NOMOUSE}
-  if gpm_fd<0 then
-   exit(0);
-  Gpm_GetSnapshot(e);
-  GetMouseButtons:=e.buttons;
-{$endif ndef NOMOUSE}
-end;
-
-
-procedure SetMouseXY(x,y:word);
-begin
-end;
-
-
-procedure GetMouseEvent(var MouseEvent: TMouseEvent);
-{$ifndef NOMOUSE}
-var
-  e : TGPMEvent;
-{$endif ndef NOMOUSE}
-begin
-{$ifdef NOMOUSE}
-  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
-{$else ndef NOMOUSE}
-  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
-  if gpm_fd<0 then
-   exit;
-  Gpm_GetEvent(e);
-  MouseEvent.x:=e.x-1;
-  MouseEvent.y:=e.y-1;
-  MouseEvent.buttons:=0;
-  if e.buttons and Gpm_b_left<>0 then
-   inc(MouseEvent.buttons,1);
-  if e.buttons and Gpm_b_right<>0 then
-   inc(MouseEvent.buttons,2);
-  if e.buttons and Gpm_b_middle<>0 then
-   inc(MouseEvent.buttons,4);
-  case (e.EventType and $f) of
-    GPM_MOVE,
-    GPM_DRAG : MouseEvent.Action:=MouseActionMove;
-    GPM_DOWN : MouseEvent.Action:=MouseActionDown;
-    GPM_UP   : MouseEvent.Action:=MouseActionUp;
-  else
-   MouseEvent.Action:=0;
-  end;
-  LastMouseEvent:=MouseEvent;
-{ update mouse cursor }
-  if mousecur then
-   PlaceMouseCur(MouseEvent.y*ScreenWidth+MouseEvent.x);
-{$endif ndef NOMOUSE}
-end;
-
-
-function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
-
-{$ifndef NOMOUSE}
-var
-  e : TGPMEvent;
-  fds : FDSet;
-{$endif ndef NOMOUSE}
-begin
-{$ifdef NOMOUSE}
-  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
-  exit(false);
-{$else ndef NOMOUSE}
-  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
-  if gpm_fd<0 then
-   exit(false);
-  if gpm_fd>0 then
-    begin
-      FD_Zero(fds);
-      FD_Set(gpm_fd,fds);
-    end;
-  if (gpm_fd=-2) or (Select(gpm_fd+1,@fds,nil,nil,1)>0) then
-   begin
-     Gpm_GetSnapshot(e);
-     MouseEvent.x:=e.x-1;
-     MouseEvent.y:=e.y-1;
-     MouseEvent.buttons:=0;
-     if e.buttons and Gpm_b_left<>0 then
-      inc(MouseEvent.buttons,1);
-     if e.buttons and Gpm_b_right<>0 then
-      inc(MouseEvent.buttons,2);
-     if e.buttons and Gpm_b_middle<>0 then
-      inc(MouseEvent.buttons,4);
-     case (e.EventType and $f) of
-      GPM_MOVE,
-      GPM_DRAG : MouseEvent.Action:=MouseActionMove;
-      GPM_DOWN : MouseEvent.Action:=MouseActionDown;
-      GPM_UP   : MouseEvent.Action:=MouseActionUp;
-     else
-      MouseEvent.Action:=0;
-     end;
-     if (gpm_fd<>-2) or (MouseEvent.Action<>0) then
-       PollMouseEvent:=true
-     else
-       PollMouseEvent:=false;
-   end
-  else
-   PollMouseEvent:=false;
-{$endif ndef NOMOUSE}
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-10-26 23:08:48  peter
-    * merged freebsd from fixes
-
-  Revision 1.1.2.1  2000/10/25 12:23:20  marco
-   * Linux dir split up
-
-  Revision 1.1.2.1  2000/10/24 07:58:49  pierre
-   * get mouse to not crash on xterm, its now completely disabled
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-  Revision 1.3  2000/06/30 09:00:33  jonas
-    * compiles again with -dnomouse
-
-  Revision 1.2  2000/04/17 08:51:38  pierre
-   + set conditional NOMOUSE to get dummy mouse unit
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.5  1999/07/01 19:41:26  peter
-    * define OLDGPM to compile with old gpm (for v1.14) else the new
-      gpm unit from rtl will be used (v1.17)
-
-  Revision 1.4  1999/06/23 00:01:30  peter
-    * check for videobuf=nil
-
-  Revision 1.3  1999/03/31 20:20:18  michael
-  + Fixed probmem preventing IDE to run in x-term.
-
-  Revision 1.2  1998/12/11 00:13:20  peter
-    + SetMouseXY
-    * use far for exitproc procedure
-
-  Revision 1.1  1998/12/04 12:48:30  peter
-    * moved some dirs
-
-  Revision 1.3  1998/12/01 15:08:16  peter
-    * fixes for linux
-
-  Revision 1.2  1998/10/29 12:49:49  peter
-    * more fixes
-
-}

+ 0 - 794
api/unix/terminfo.pas

@@ -1,794 +0,0 @@
-{
-   $Id$
-
-   An interface unit for the terminfo database
-
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-
-unit TermInfo;
-
-interface
-
-{$linklib ncurses}
-{$linklib c}
-{$packrecords c}
-
-const
-  { boolean values }
-  auto_left_margin              = 0;
-  auto_right_margin             = 1;
-  no_esc_ctlc                   = 2;
-  ceol_standout_glitch          = 3;
-  eat_newline_glitch            = 4;
-  erase_overstrike              = 5;
-  generic_type                  = 6;
-  hard_copy                     = 7;
-  has_meta_key                  = 8;
-  has_status_line               = 9;
-  insert_null_glitch            = 10;
-  memory_above                  = 11;
-  memory_below                  = 12;
-  move_insert_mode              = 13;
-  move_standout_mode            = 14;
-  over_strike                   = 15;
-  status_line_esc_ok            = 16;
-  dest_tabs_magic_smso          = 17;
-  tilde_glitch                  = 18;
-  transparent_underline         = 19;
-  xon_xoff                      = 20;
-  needs_xon_xoff                = 21;
-  prtr_silent                   = 22;
-  hard_cursor                   = 23;
-  non_rev_rmcup                 = 24;
-  no_pad_char                   = 25;
-  non_dest_scroll_region        = 26;
-  can_change                    = 27;
-  back_color_erase              = 28;
-  hue_lightness_saturation      = 29;
-  col_addr_glitch               = 30;
-  cr_cancels_micro_mode         = 31;
-  has_print_wheel               = 32;
-  row_addr_glitch               = 33;
-  semi_auto_right_margin        = 34;
-  cpi_changes_res               = 35;
-  lpi_changes_res               = 36;
-
-  { numbers ... }
-  columns                       = 0;
-  init_tabs                     = 1;
-  lines                         = 2;
-  lines_of_memory               = 3;
-  magic_cookie_glitch           = 4;
-  padding_baud_rate             = 5;
-  virtual_terminal              = 6;
-  width_status_line             = 7;
-  num_labels                    = 8;
-  label_height                  = 9;
-  label_width                   = 10;
-  max_attributes                = 11;
-  maximum_windows               = 12;
-  max_colors                    = 13;
-  max_pairs                     = 14;
-  no_color_video                = 15;
-  buffer_capacity               = 16;
-  dot_vert_spacing              = 17;
-  dot_horz_spacing              = 18;
-  max_micro_address             = 19;
-  max_micro_jump                = 20;
-  micro_char_size               = 21;
-  micro_line_size               = 22;
-  number_of_pins                = 23;
-  output_res_char               = 24;
-  output_res_line               = 25;
-  output_res_horz_inch          = 26;
-  output_res_vert_inch          = 27;
-  print_rate                    = 28;
-  wide_char_size                = 29;
-  buttons                       = 30;
-  bit_image_entwining           = 31;
-  bit_image_type                = 32;
-
-  { strings }
-  back_tab                      = 0;
-  bell                          = 1;
-  carriage_return               = 2;
-  change_scroll_region          = 3;
-  clear_all_tabs                = 4;
-  clear_screen                  = 5;
-  clr_eol                       = 6;
-  clr_eos                       = 7;
-  column_address                = 8;
-  command_character             = 9;
-  cursor_address                = 10;
-  cursor_down                   = 11;
-  cursor_home                   = 12;
-  cursor_invisible              = 13;
-  cursor_left                   = 14;
-  cursor_mem_address            = 15;
-  cursor_normal                 = 16;
-  cursor_right                  = 17;
-  cursor_to_ll                  = 18;
-  cursor_up                     = 19;
-  cursor_visible                = 20;
-  delete_character              = 21;
-  delete_line                   = 22;
-  dis_status_line               = 23;
-  down_half_line                = 24;
-  enter_alt_charset_mode        = 25;
-  enter_blink_mode              = 26;
-  enter_bold_mode               = 27;
-  enter_ca_mode                 = 28;
-  enter_delete_mode             = 29;
-  enter_dim_mode                = 30;
-  enter_insert_mode             = 31;
-  enter_secure_mode             = 32;
-  enter_protected_mode          = 33;
-  enter_reverse_mode            = 34;
-  enter_standout_mode           = 35;
-  enter_underline_mode          = 36;
-  erase_chars                   = 37;
-  exit_alt_charset_mode         = 38;
-  exit_attribute_mode           = 39;
-  exit_ca_mode                  = 40;
-  exit_delete_mode              = 41;
-  exit_insert_mode              = 42;
-  exit_standout_mode            = 43;
-  exit_underline_mode           = 44;
-  flash_screen                  = 45;
-  form_feed                     = 46;
-  from_status_line              = 47;
-  init_1string                  = 48;
-  init_2string                  = 49;
-  init_3string                  = 50;
-  init_file                     = 51;
-  insert_character              = 52;
-  insert_line                   = 53;
-  insert_padding                = 54;
-  key_backspace                 = 55;
-  key_catab                     = 56;
-  key_clear                     = 57;
-  key_ctab                      = 58;
-  key_dc                        = 59;
-  key_dl                        = 60;
-  key_down                      = 61;
-  key_eic                       = 62;
-  key_eol                       = 63;
-  key_eos                       = 64;
-  key_f0                        = 65;
-  key_f1                        = 66;
-  key_f10                       = 67;
-  key_f2                        = 68;
-  key_f3                        = 69;
-  key_f4                        = 70;
-  key_f5                        = 71;
-  key_f6                        = 72;
-  key_f7                        = 73;
-  key_f8                        = 74;
-  key_f9                        = 75;
-  key_home                      = 76;
-  key_ic                        = 77;
-  key_il                        = 78;
-  key_left                      = 79;
-  key_ll                        = 80;
-  key_npage                     = 81;
-  key_ppage                     = 82;
-  key_right                     = 83;
-  key_sf                        = 84;
-  key_sr                        = 85;
-  key_stab                      = 86;
-  key_up                        = 87;
-  keypad_local                  = 88;
-  keypad_xmit                   = 89;
-  lab_f0                        = 90;
-  lab_f1                        = 91;
-  lab_f10                       = 92;
-  lab_f2                        = 93;
-  lab_f3                        = 94;
-  lab_f4                        = 95;
-  lab_f5                        = 96;
-  lab_f6                        = 97;
-  lab_f7                        = 98;
-  lab_f8                        = 99;
-  lab_f9                        = 100;
-  meta_off                      = 101;
-  meta_on                       = 102;
-  newline                       = 103;
-  pad_char                      = 104;
-  parm_dch                      = 105;
-  parm_delete_line              = 106;
-  parm_down_cursor              = 107;
-  parm_ich                      = 108;
-  parm_index                    = 109;
-  parm_insert_line              = 110;
-  parm_left_cursor              = 111;
-  parm_right_cursor             = 112;
-  parm_rindex                   = 113;
-  parm_up_cursor                = 114;
-  pkey_key                      = 115;
-  pkey_local                    = 116;
-  pkey_xmit                     = 117;
-  print_screen                  = 118;
-  prtr_off                      = 119;
-  prtr_on                       = 120;
-  repeat_char                   = 121;
-  reset_1string                 = 122;
-  reset_2string                 = 123;
-  reset_3string                 = 124;
-  reset_file                    = 125;
-  restore_cursor                = 126;
-  row_address                   = 127;
-  save_cursor                   = 128;
-  scroll_forward                = 129;
-  scroll_reverse                = 130;
-  set_attributes                = 131;
-  set_tab                       = 132;
-  set_window                    = 133;
-  tab                           = 134;
-  to_status_line                = 135;
-  underline_char                = 136;
-  up_half_line                  = 137;
-  init_prog                     = 138;
-  key_a1                        = 139;
-  key_a3                        = 140;
-  key_b2                        = 141;
-  key_c1                        = 142;
-  key_c3                        = 143;
-  prtr_non                      = 144;
-  char_padding                  = 145;
-  acs_chars                     = 146;
-  plab_norm                     = 147;
-  key_btab                      = 148;
-  enter_xon_mode                = 149;
-  exit_xon_mode                 = 150;
-  enter_am_mode                 = 151;
-  exit_am_mode                  = 152;
-  xon_character                 = 153;
-  xoff_character                = 154;
-  ena_acs                       = 155;
-  label_on                      = 156;
-  label_off                     = 157;
-  key_beg                       = 158;
-  key_cancel                    = 159;
-  key_close                     = 160;
-  key_command                   = 161;
-  key_copy                      = 162;
-  key_create                    = 163;
-  key_end                       = 164;
-  key_enter                     = 165;
-  key_exit                      = 166;
-  key_find                      = 167;
-  key_help                      = 168;
-  key_mark                      = 169;
-  key_message                   = 170;
-  key_move                      = 171;
-  key_next                      = 172;
-  key_open                      = 173;
-  key_options                   = 174;
-  key_previous                  = 175;
-  key_print                     = 176;
-  key_redo                      = 177;
-  key_reference                 = 178;
-  key_refresh                   = 179;
-  key_replace                   = 180;
-  key_restart                   = 181;
-  key_resume                    = 182;
-  key_save                      = 183;
-  key_suspend                   = 184;
-  key_undo                      = 185;
-  key_sbeg                      = 186;
-  key_scancel                   = 187;
-  key_scommand                  = 188;
-  key_scopy                     = 189;
-  key_screate                   = 190;
-  key_sdc                       = 191;
-  key_sdl                       = 192;
-  key_select                    = 193;
-  key_send                      = 194;
-  key_seol                      = 195;
-  key_sexit                     = 196;
-  key_sfind                     = 197;
-  key_shelp                     = 198;
-  key_shome                     = 199;
-  key_sic                       = 200;
-  key_sleft                     = 201;
-  key_smessage                  = 202;
-  key_smove                     = 203;
-  key_snext                     = 204;
-  key_soptions                  = 205;
-  key_sprevious                 = 206;
-  key_sprint                    = 207;
-  key_sredo                     = 208;
-  key_sreplace                  = 209;
-  key_sright                    = 210;
-  key_srsume                    = 211;
-  key_ssave                     = 212;
-  key_ssuspend                  = 213;
-  key_sundo                     = 214;
-  req_for_input                 = 215;
-  key_f11                       = 216;
-  key_f12                       = 217;
-  key_f13                       = 218;
-  key_f14                       = 219;
-  key_f15                       = 220;
-  key_f16                       = 221;
-  key_f17                       = 222;
-  key_f18                       = 223;
-  key_f19                       = 224;
-  key_f20                       = 225;
-  key_f21                       = 226;
-  key_f22                       = 227;
-  key_f23                       = 228;
-  key_f24                       = 229;
-  key_f25                       = 230;
-  key_f26                       = 231;
-  key_f27                       = 232;
-  key_f28                       = 233;
-  key_f29                       = 234;
-  key_f30                       = 235;
-  key_f31                       = 236;
-  key_f32                       = 237;
-  key_f33                       = 238;
-  key_f34                       = 239;
-  key_f35                       = 240;
-  key_f36                       = 241;
-  key_f37                       = 242;
-  key_f38                       = 243;
-  key_f39                       = 244;
-  key_f40                       = 245;
-  key_f41                       = 246;
-  key_f42                       = 247;
-  key_f43                       = 248;
-  key_f44                       = 249;
-  key_f45                       = 250;
-  key_f46                       = 251;
-  key_f47                       = 252;
-  key_f48                       = 253;
-  key_f49                       = 254;
-  key_f50                       = 255;
-  key_f51                       = 256;
-  key_f52                       = 257;
-  key_f53                       = 258;
-  key_f54                       = 259;
-  key_f55                       = 260;
-  key_f56                       = 261;
-  key_f57                       = 262;
-  key_f58                       = 263;
-  key_f59                       = 264;
-  key_f60                       = 265;
-  key_f61                       = 266;
-  key_f62                       = 267;
-  key_f63                       = 268;
-  clr_bol                       = 269;
-  clear_margins                 = 270;
-  set_left_margin               = 271;
-  set_right_margin              = 272;
-  label_format                  = 273;
-  set_clock                     = 274;
-  display_clock                 = 275;
-  remove_clock                  = 276;
-  create_window                 = 277;
-  goto_window                   = 278;
-  hangup                        = 279;
-  dial_phone                    = 280;
-  quick_dial                    = 281;
-  tone                          = 282;
-  pulse                         = 283;
-  flash_hook                    = 284;
-  fixed_pause                   = 285;
-  wait_tone                     = 286;
-  user0                         = 287;
-  user1                         = 288;
-  user2                         = 289;
-  user3                         = 290;
-  user4                         = 291;
-  user5                         = 292;
-  user6                         = 293;
-  user7                         = 294;
-  user8                         = 295;
-  user9                         = 296;
-  orig_pair                     = 297;
-  orig_colors                   = 298;
-  initialize_color              = 299;
-  initialize_pair               = 300;
-  set_color_pair                = 301;
-  set_foreground                = 302;
-  set_background                = 303;
-  change_char_pitch             = 304;
-  change_line_pitch             = 305;
-  change_res_horz               = 306;
-  change_res_vert               = 307;
-  define_char                   = 308;
-  enter_doublewide_mode         = 309;
-  enter_draft_quality           = 310;
-  enter_italics_mode            = 311;
-  enter_leftward_mode           = 312;
-  enter_micro_mode              = 313;
-  enter_near_letter_quality     = 314;
-  enter_normal_quality          = 315;
-  enter_shadow_mode             = 316;
-  enter_subscript_mode          = 317;
-  enter_superscript_mode        = 318;
-  enter_upward_mode             = 319;
-  exit_doublewide_mode          = 320;
-  exit_italics_mode             = 321;
-  exit_leftward_mode            = 322;
-  exit_micro_mode               = 323;
-  exit_shadow_mode              = 324;
-  exit_subscript_mode           = 325;
-  exit_superscript_mode         = 326;
-  exit_upward_mode              = 327;
-  micro_column_address          = 328;
-  micro_down                    = 329;
-  micro_left                    = 330;
-  micro_right                   = 331;
-  micro_row_address             = 332;
-  micro_up                      = 333;
-  order_of_pins                 = 334;
-  parm_down_micro               = 335;
-  parm_left_micro               = 336;
-  parm_right_micro              = 337;
-  parm_up_micro                 = 338;
-  select_char_set               = 339;
-  set_bottom_margin             = 340;
-  set_bottom_margin_parm        = 341;
-  set_left_margin_parm          = 342;
-  set_right_margin_parm         = 343;
-  set_top_margin                = 344;
-  set_top_margin_parm           = 345;
-  start_bit_image               = 346;
-  start_char_set_def            = 347;
-  stop_bit_image                = 348;
-  stop_char_set_def             = 349;
-  subscript_characters          = 350;
-  superscript_characters        = 351;
-  these_cause_cr                = 352;
-  zero_motion                   = 353;
-  char_set_names                = 354;
-  key_mouse                     = 355;
-  mouse_info                    = 356;
-  req_mouse_pos                 = 357;
-  get_mouse                     = 358;
-  set_a_foreground              = 359;
-  set_a_background              = 360;
-  pkey_plab                     = 361;
-  device_type                   = 362;
-  code_set_init                 = 363;
-  set0_des_seq                  = 364;
-  set1_des_seq                  = 365;
-  set2_des_seq                  = 366;
-  set3_des_seq                  = 367;
-  set_lr_margin                 = 368;
-  set_tb_margin                 = 369;
-  bit_image_repeat              = 370;
-  bit_image_newline             = 371;
-  bit_image_carriage_return     = 372;
-  color_names                   = 373;
-  define_bit_image_region       = 374;
-  end_bit_image_region          = 375;
-  set_color_band                = 376;
-  set_page_length               = 377;
-  display_pc_char               = 378;
-  enter_pc_charset_mode         = 379;
-  exit_pc_charset_mode          = 380;
-  enter_scancode_mode           = 381;
-  exit_scancode_mode            = 382;
-  pc_term_options               = 383;
-  scancode_escape               = 384;
-  alt_scancode_esc              = 385;
-  enter_horizontal_hl_mode      = 386;
-  enter_left_hl_mode            = 387;
-  enter_low_hl_mode             = 388;
-  enter_right_hl_mode           = 389;
-  enter_top_hl_mode             = 390;
-  enter_vertical_hl_mode        = 391;
-
-  { older synonyms for some booleans }
-  beehive_glitch                = no_esc_ctlc;
-  teleray_glitch                = dest_tabs_magic_smso;
-  micro_col_size                = micro_char_size;
-  { internal }
-  termcap_init2               = 392;
-  termcap_reset               = 393;
-  magic_cookie_glitch_ul      = 33;
-  backspaces_with_bs          = 37;
-  crt_no_scrolling            = 38;
-  no_correctly_working_cr     = 39;
-  carriage_return_delay       = 34;
-  new_line_delay              = 35;
-  linefeed_if_not_lf          = 394;
-  backspace_if_not_bs         = 395;
-  gnu_has_meta_key            = 40;
-  linefeed_is_newline         = 41;
-  backspace_delay             = 36;
-  horizontal_tab_delay        = 37;
-  number_of_function_keys     = 38;
-  other_non_function_keys     = 396;
-  arrow_key_map               = 397;
-  has_hardware_tabs           = 42;
-  return_does_clr_eol         = 43;
-  acs_ulcorner                = 398;
-  acs_llcorner                = 399;
-  acs_urcorner                = 400;
-  acs_lrcorner                = 401;
-  acs_ltee                    = 402;
-  acs_rtee                    = 403;
-  acs_btee                    = 404;
-  acs_ttee                    = 405;
-  acs_hline                   = 406;
-  acs_vline                   = 407;
-  acs_plus                    = 408;
-  memory_lock                 = 409;
-  memory_unlock               = 410;
-  box_chars_1                 = 411;
-
-
-const
-  NCCS = 32;
-  BoolCount = 44;
-  NumCount = 39;
-  StrCount = 412;
-
-type
-  TCFlag_t = Longint;
-  Speed_t = Longint;
-  TermIOS = record
-    c_iflag, c_oflag, c_cflag, c_lflag: TCFlag_t;
-    c_line: Byte;
-    c_cc: array [0..NCCS-1] of Char;
-    c_ispeed, c_ospeed: Speed_t;
-    Pad: word;
-  end;
-
-  TT_BoolArray = array [0..BoolCount - 1] of Boolean;
-  TT_WordArray = array [0..NumCount - 1] of Word;
-  TT_PCharArray = array [0..StrCount - 1] of PChar;
-
-  TermType4 = record
-    Term_Names: PChar;
-    Str_Table: PChar;
-    Booleans: TT_BoolArray;
-    Numbers: TT_WordArray;
-    Strings: TT_PCharArray;
-  end;
-
-  Terminal_ptr4 = ^Terminal4;
-  Terminal4 = record
-    TType: TermType4;
-    FileDes: Word;
-    Ottyb, Nttyb: Termios;
-    Pad: longint;
-  end;
-
-  TermType5 = record
-    Term_Names: PChar;
-    Str_Table: PChar;
-    Booleans: ^TT_BoolArray;
-    Numbers: ^TT_WordArray;
-    Strings: ^TT_PCharArray;
-  end;
-
-  Terminal_ptr5 = ^Terminal5;
-  Terminal5 = record
-    TType: TermType5;
-    FileDes: Word;
-    Ottyb, Nttyb: Termios;
-    Pad: longint;
-  end;
-
-  TerminalCommon_ptr1 = ^TerminalCommon1;
-  TerminalCommon1 = record
-    Term_Names: PChar;
-    Str_Table: PChar;
-  end;
-
-  TerminalCommon_ptr2 = ^TerminalCommon2;
-  TerminalCommon2 = record
-    FileDes: Word;
-    Ottyb, Nttyb: Termios;
-    Pad: longint;
-  end;
-
-  WriterFunc = function (P: PChar): Longint;
-
-var
-  cur_term : TerminalCommon_ptr1; external name 'cur_term';
-  cur_term_booleans: ^TT_BoolArray;
-  cur_term_numbers: ^TT_WordArray;
-  cur_term_strings: ^TT_PCharArray;
-  cur_term_common: TerminalCommon_ptr2;
-
-const
-  cur_term_valid : boolean = false;
-
-{ Note: the following two procedures expect a pointer to a full terminfo }
-{ structure, not just to the common parts. However, since this structure }
-{ differs for different versions of ncurses,it's impossible to give a    }
-{ general declaration here which is correct (JM)                         }
-function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1;cdecl;
-function del_curterm(term: TerminalCommon_ptr1): Longint;
-
-{ sets whether to use environment variables for LINES and COLUMNS }
-procedure use_env(B: Longint);cdecl;
-
-function putp(Ndx: Longint): Longint;
-
-{ this function must be called before any terminal properties are accessed }
-function setupterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;
-
-{ reinitialize lib }
-function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;cdecl;
-
-{function tgetent(P1, P2: PChar): Longint;
-function tgetflag(P: PChar): Longint;
-function tgetnum(P: PChar): Longint;
-function tgoto(P: PChar; L1, L2: Longint): PChar;
-function tgetstr(P: PChar; var R: PChar): PChar;
-function tigetflag(P: PChar): Longint;
-function tigetnum(P: PChar): Longint;
-function tigetstr(P: PChar): PChar;
-function tparm(P: PChar, ...): PChar;
-function tparam(const char *, char *, int, ...): PChar;}
-function tputs(Ndx: Word; L1: Longint; F: WriterFunc): Longint;
-
-implementation
-
-uses
-  Linux;
-
-function putp(Ndx: Longint): Longint;
-var
-  P: PChar;
-begin
-  if not assigned(cur_term) then
-    RunError(219);
-  P := cur_term_strings^[Ndx];
-  putp := fdWrite(cur_term_common^.filedes, P^, StrLen(P));
-end;
-
-function tputs(Ndx: Word; L1: Longint; F: WriterFunc): Longint;
-var
-  P: PChar;
-begin
-  if not assigned(cur_term) then
-    RunError(219);
-  { L1 := L1; why was this here ?? PM }
-  P := cur_term_strings^[Ndx];
-  tputs := F(P);
-end;
-
-function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1; cdecl; external;
-
-procedure use_env(B: Longint); cdecl; external;
-
-function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external;
-
-function setuptermC(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external name 'setupterm';
-
-function setupterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;
-var
-  versioncheck: longint;
-begin
-  setupterm := setuptermC(term,fd,errcode);
-  if not assigned(cur_term) then
-    exit;
-  cur_term_valid := true;
-  versioncheck := 0;
-  repeat
-    if (Terminal_ptr4(cur_term)^.ttype.Booleans[versioncheck] in [false,true]) then
-      inc(versioncheck)
-    else versioncheck := -1;
-  until (versioncheck = BoolCount) or
-        (versioncheck = -1);
-  if versioncheck = BoolCount then
-    { version 4.x }
-    begin
-      cur_term_booleans := @Terminal_ptr4(cur_term)^.ttype.Booleans;
-      cur_term_numbers := @Terminal_ptr4(cur_term)^.ttype.Numbers;
-      cur_term_strings := @Terminal_ptr4(cur_term)^.ttype.Strings;
-      cur_term_common := pointer(@Terminal_ptr4(cur_term)^.FileDes);
-    end
-  else
-    { assume 5.x or higher }
-    begin
-      cur_term_booleans := Terminal_ptr5(cur_term)^.ttype.Booleans;
-      cur_term_numbers := Terminal_ptr5(cur_term)^.ttype.Numbers;
-      cur_term_strings := Terminal_ptr5(cur_term)^.ttype.Strings;
-      cur_term_common := pointer(@Terminal_ptr5(cur_term)^.FileDes);
-    end;
-end;
-
-function del_curtermC(term: TerminalCommon_ptr1): Longint; cdecl; external name 'del_curterm';
-
-function del_curterm(term: TerminalCommon_ptr1): Longint;
-var
-  reset_cur_term : boolean;
-begin
-  if term=cur_term then
-    begin
-      cur_term_booleans := nil;
-      cur_term_numbers := nil;
-      cur_term_strings := nil;
-      cur_term_common := nil;
-      reset_cur_term := true;
-    end
-  else
-    reset_cur_term := false;
-  del_curterm := del_curtermC(term);
-  if reset_cur_term then
-    cur_term_valid := false;
-end;
-{function tgetent(P1, P2: PChar): Longint; cdecl; external;
-function tgetflag(P: PChar): Longint; cdecl; external;
-function tgetnum(P: PChar): Longint; cdecl; external;
-function tgoto(P: PChar; L1, L2: Longint): PChar; cdecl; external;
-function tgetstr(P: PChar; var R: PChar): PChar; cdecl; external;
-function tigetflag(P: PChar): Longint; cdecl; external;
-function tigetnum(P: PChar): Longint; cdecl; external;
-function tigetstr(P: PChar): PChar; cdecl; external;
-function tparm(P: PChar; ...): PChar; cdecl; external;
-function tparam(const char *, char *, int, ...): PChar; cdecl; external;}
-
-end.
-{
-  $Log$
-  Revision 1.2  2000-10-26 23:08:48  peter
-    * merged freebsd from fixes
-
-  Revision 1.1.2.1  2000/10/25 12:23:20  marco
-   * Linux dir split up
-
-  Revision 1.1.2.3  2000/10/09 16:29:14  pierre
-   * more linux terminal fixes
-
-  Revision 1.1.2.2  2000/08/02 12:30:36  jonas
-    * improved version check *slightly*
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-  Revision 1.2  2000/06/30 12:28:57  jonas
-    * fixed termtype structure
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.3  1999/04/22 14:48:27  peter
-    * remove asm
-
-  Revision 1.2  1998/12/07 12:25:51  peter
-    * link with ncurses which is more available the curses
-
-  Revision 1.1  1998/12/04 12:48:30  peter
-    * moved some dirs
-
-  Revision 1.1  1998/10/26 11:31:47  peter
-    + inital include files
-
-  Revision 1.3  1998/10/26 09:36:26  peter
-    * fixed cdecl
-
-  Revision 1.2  1998/07/29 20:17:47  bazsi
-  some updates to Video, it now uses terminfo. Some modifications for FreeVision.
-
-  Revision 1.1  1998/06/13 12:38:54  bazsi
-}

+ 0 - 31
api/unix/testkeyb.pas

@@ -1,31 +0,0 @@
-program raw_read;
-
-uses
-  keyboard;
-
-var
-  c : char;
-  col : byte;
-begin
-  InitKeyboard;
-  c:=' ';
-  col:=1;
-  while c<>'x' do
-    begin
-      c:=RawReadKey;
-      if ord(c)<32 then
-        begin
-          write('"#',ord(c),'"');
-          inc(col,4);
-        end
-      else
-        write(c);
-      inc(col);
-      if col>=80 then
-        begin
-          writeln;
-          col:=0;
-        end;
-    end;
-  DoneKeyboard;
-end.

+ 0 - 870
api/unix/video.inc

@@ -1,870 +0,0 @@
-{
-  System independent low-level video interface for linux
-
-  $Id$
-}
-uses
-  Linux, Strings, FileCtrl, TermInfo;
-
-var
-  LastCursorType : byte;
-  TtyFd: Longint;
-  Console: Boolean;
-  OldVideoBuf: PVideoBuf;
-{$ifdef logging}
-  f: file;
-
-const
-  logstart: string = '';
-  nl: char = #10;
-  logend: string = #10#10;
-{$endif logging}
-{$ASMMODE ATT}
-const
-  can_delete_term : boolean = false;
-  ACSIn : string = '';
-  ACSOut : string = '';
-
-function IsACS(var ch,ACSchar : char): boolean;
-begin
-  IsACS:=false;
-  case ch of
-    #24, #30: {}
-      ch:='^';
-    #25, #31: {}
-      ch:='v';
-    #26, #16: {Never introduce a ctrl-Z ... }
-      ch:='>';
-    {#27,needed in Escape sequences} #17: {}
-      ch:='<';
-    #176, #177, #178: {°±²}
-      begin
-        IsACS:=true;
-        ACSChar:='a';
-      end;
-    #180, #181, #182, #185: {´µ¶¹}
-      begin
-        IsACS:=true;
-        ACSChar:='u';
-      end;
-    #183, #184, #187, #191: {·¸»¿}
-      begin
-        IsACS:=true;
-        ACSChar:='k';
-      end;
-    #188, #189, #190, #217: {¼½¾Ù}
-      begin
-        IsACS:=true;
-        ACSChar:='j';
-      end;
-    #192, #200, #211, #212: {ÀÈÓÔ}
-      begin
-        IsACS:=true;
-        ACSChar:='m';
-      end;
-    #193, #202, #207, #208: {ÁÊÏÐ}
-      begin
-        IsACS:=true;
-        ACSChar:='v';
-      end;
-    #194, #203, #209, #210: {ÂËÑÒ}
-      begin
-        IsACS:=true;
-        ACSChar:='w';
-      end;
-    #195, #198, #199, #204: {ÃÆÇÌ}
-      begin
-        IsACS:=true;
-        ACSChar:='t';
-      end;
-    #196, #205: {ÄÍ}
-      begin
-        IsACS:=true;
-        ACSChar:='q';
-      end;
-    #179, #186: {³º}
-      begin
-        IsACS:=true;
-        ACSChar:='x';
-      end;
-    #197, #206, #215, #216: {ÅÎר}
-      begin
-        IsACS:=true;
-        ACSChar:='n';
-      end;
-    #201, #213, #214, #218: {ÉÕÖÚ}
-      begin
-        IsACS:=true;
-        ACSChar:='l';
-      end;
-  end;
-end;
-
-
-procedure SendEscapeSeqNdx(Ndx: Word);
-var
-  P,pdelay: PChar;
-begin
-  if not assigned(cur_term_Strings) then
-    RunError(219);
-  P:=cur_term_Strings^[Ndx];
-  if assigned(p) then
-   begin { Do not transmit the delays }
-     pdelay:=strpos(p,'$<');
-     if assigned(pdelay) then
-       pdelay^:=#0;
-     fdWrite(TTYFd, P^, StrLen(P));
-     if assigned(pdelay) then
-       pdelay^:='$';
-   end;
-end;
-
-
-procedure SendEscapeSeq(const S: String);
-begin
-  fdWrite(TTYFd, S[1], Length(S));
-end;
-
-
-Function IntStr(l:longint):string;
-var
-  s : string;
-begin
-  Str(l,s);
-  IntStr:=s;
-end;
-
-
-Function XY2Ansi(x,y,ox,oy:longint):String;
-{
-  Returns a string with the escape sequences to go to X,Y on the screen
-}
-Begin
-  if y=oy then
-   begin
-     if x=ox then
-      begin
-        XY2Ansi:='';
-        exit;
-      end;
-     if x=1 then
-      begin
-        XY2Ansi:=#13;
-        exit;
-      end;
-     if x>ox then
-      begin
-        XY2Ansi:=#27'['+IntStr(x-ox)+'C';
-        exit;
-      end
-     else
-      begin
-        XY2Ansi:=#27'['+IntStr(ox-x)+'D';
-        exit;
-      end;
-   end;
-  if x=ox then
-   begin
-     if y>oy then
-      begin
-        XY2Ansi:=#27'['+IntStr(y-oy)+'B';
-        exit;
-      end
-     else
-      begin
-        XY2Ansi:=#27'['+IntStr(oy-y)+'A';
-        exit;
-      end;
-   end;
-  if (x=1) and (oy+1=y) then
-   XY2Ansi:=#13#10
-  else
-   XY2Ansi:=#27'['+IntStr(y)+';'+IntStr(x)+'H';
-End;
-
-
-
-const
-  AnsiTbl : string[8]='04261537';
-Function Attr2Ansi(Attr,OAttr:longint):string;
-{
-  Convert Attr to an Ansi String, the Optimal code is calculate
-  with use of the old OAttr
-}
-var
-  hstr : string[16];
-  OFg,OBg,Fg,Bg : longint;
-
-  procedure AddSep(ch:char);
-  begin
-    if length(hstr)>0 then
-     hstr:=hstr+';';
-    hstr:=hstr+ch;
-  end;
-
-begin
-  if Attr=OAttr then
-   begin
-     Attr2Ansi:='';
-     exit;
-   end;
-  Hstr:='';
-  Fg:=Attr and $f;
-  Bg:=Attr shr 4;
-  OFg:=OAttr and $f;
-  OBg:=OAttr shr 4;
-  if (OFg<>7) or (Fg=7) or ((OFg>7) and (Fg<8)) or ((OBg>7) and (Bg<8)) then
-   begin
-     hstr:='0';
-     OFg:=7;
-     OBg:=0;
-   end;
-  if (Fg>7) and (OFg<8) then
-   begin
-     AddSep('1');
-     OFg:=OFg or 8;
-   end;
-  if (Bg and 8)<>(OBg and 8) then
-   begin
-     AddSep('5');
-     OBg:=OBg or 8;
-   end;
-  if (Fg<>OFg) then
-   begin
-     AddSep('3');
-     hstr:=hstr+AnsiTbl[(Fg and 7)+1];
-   end;
-  if (Bg<>OBg) then
-   begin
-     AddSep('4');
-     hstr:=hstr+AnsiTbl[(Bg and 7)+1];
-   end;
-  if hstr='0' then
-   hstr:='';
-  Attr2Ansi:=#27'['+hstr+'m';
-end;
-
-procedure TransformUsingACS(var st : string);
-var
-  is_acs : boolean;
-  res : string;
-  i : longint;
-  ch,ACSch : char;
-begin
-  is_acs:=false;
-  res:='';
-  for i:=1 to length(st) do
-    begin
-      ch:=st[i];
-      if IsACS(ch,ACSch) then
-        begin
-          if not is_acs then
-            begin
-              res:=res+ACSIn;
-              is_acs:=true;
-            end;
-          res:=res+ACSch;
-        end
-      else
-        begin
-          if is_acs then
-            begin
-              res:=res+ACSOut;
-              is_acs:=false;
-            end;
-          res:=res+ch;
-        end;
-    end;
-  if is_acs then
-    res:=res+ACSout;
-  st:=res;
-end;
-
-
-procedure UpdateTTY(Force:boolean);
-type
-  tchattr=packed record
-    ch : char;
-    attr : byte;
-  end;
-var
-  outbuf   : array[0..1023+255] of char;
-  chattr   : tchattr;
-  skipped  : boolean;
-  outptr,
-  spaces,
-  eol,
-  LastX,LastY,
-  x,y,
-  SpaceAttr,
-  LastAttr : longint;
-  p,pold   : pvideocell;
-
-  procedure outdata(hstr:string);
-  begin
-    while (eol>0) do
-     begin
-       hstr:=#13#10+hstr;
-       dec(eol);
-     end;
-    if NoExtendedFrame and (ACSIn<>'') and (ACSOut<>'') then
-      TransformUsingACS(Hstr);
-    move(hstr[1],outbuf[outptr],length(hstr));
-    inc(outptr,length(hstr));
-    if outptr>=1024 then
-     begin
-{$ifdef logging}
-       blockwrite(f,logstart[1],length(logstart));
-       blockwrite(f,nl,1);
-       blockwrite(f,outptr,sizeof(outptr));
-       blockwrite(f,nl,1);
-       blockwrite(f,outbuf,outptr);
-       blockwrite(f,nl,1);
-{$endif logging}
-       fdWrite(TTYFd,outbuf,outptr);
-       outptr:=0;
-     end;
-  end;
-
-  procedure OutClr(c:byte);
-  begin
-    if c=LastAttr then
-     exit;
-    OutData(Attr2Ansi(c,LastAttr));
-    LastAttr:=c;
-  end;
-
-  procedure OutSpaces;
-  begin
-    if (Spaces=0) then
-     exit;
-    OutClr(SpaceAttr);
-    OutData(Space(Spaces));
-    LastX:=x;
-    LastY:=y;
-    Spaces:=0;
-  end;
-
-begin
-  OutPtr:=0;
-  Eol:=0;
-  skipped:=true;
-  p:=PVideoCell(VideoBuf);
-  pold:=PVideoCell(OldVideoBuf);
-{ init Attr and X,Y }
-  SendEscapeSeq(#27'[m'#27'[H');
-  LastAttr:=7;
-  LastX:=1;
-  LastY:=1;
-  for y:=1 to ScreenHeight do
-   begin
-     SpaceAttr:=0;
-     Spaces:=0;
-     for x:=1 to ScreenWidth do
-      begin
-        if (not force) and (p^=pold^) then
-         begin
-           if (Spaces>0) then
-            OutSpaces;
-           skipped:=true;
-         end
-        else
-         begin
-           if skipped then
-            begin
-              OutData(XY2Ansi(x,y,LastX,LastY));
-              LastX:=x;
-              LastY:=y;
-              skipped:=false;
-            end;
-           chattr:=tchattr(p^);
-           if chattr.ch in [#0,#255] then
-            chattr.ch:=' ';
-           if chattr.ch=' ' then
-            begin
-              if Spaces=0 then
-               SpaceAttr:=chattr.Attr;
-              if (chattr.attr and $f0)=(spaceattr and $f0) then
-               chattr.Attr:=SpaceAttr
-              else
-               begin
-                 OutSpaces;
-                 SpaceAttr:=chattr.Attr;
-               end;
-              inc(Spaces);
-            end
-           else
-            begin
-              if (Spaces>0) then
-               OutSpaces;
-              if ord(chattr.ch)<32 then
-                begin
-                  Chattr.Attr:= $ff xor Chattr.Attr;
-                  ChAttr.ch:= chr(ord(chattr.ch)+$30);
-                end;
-              if LastAttr<>chattr.Attr then
-               OutClr(chattr.Attr);
-              OutData(chattr.ch);
-              LastX:=x+1;
-              LastY:=y;
-            end;
-           p^:=tvideocell(chattr);
-         end;
-        inc(p);
-        inc(pold);
-      end;
-     if (Spaces>0) then
-      OutSpaces;
-     if force then
-      inc(eol);
-   end;
-  eol:=0;
-  OutData(XY2Ansi(CursorX,CursorY,LastX,LastY));
-{$ifdef logging}
-  blockwrite(f,logstart[1],length(logstart));
-  blockwrite(f,nl,1);
-  blockwrite(f,outptr,sizeof(outptr));
-  blockwrite(f,nl,1);
-  blockwrite(f,outbuf,outptr);
-  blockwrite(f,nl,1);
-{$endif logging}
-  fdWrite(TTYFd,outbuf,outptr);
-end;
-
-var
-  InitialVideoTio, preInitVideoTio, postInitVideoTio: linux.termios;
-  inputRaw, outputRaw: boolean;
-
-procedure saveRawSettings(const tio: linux.termios);
-Begin
-  with tio do
-   begin
-     inputRaw :=
-       ((c_iflag and (IGNBRK or BRKINT or PARMRK or ISTRIP or
-                                INLCR or IGNCR or ICRNL or IXON)) = 0) and
-       ((c_lflag and (ECHO or ECHONL or ICANON or ISIG or IEXTEN)) = 0);
-     outPutRaw :=
-       ((c_oflag and OPOST) = 0) and
-       ((c_cflag and (CSIZE or PARENB)) = 0) and
-       ((c_cflag and CS8) <> 0);
-   end;
-end;
-
-procedure restoreRawSettings(tio: linux.termios);
-begin
-  with tio do
-    begin
-      if inputRaw then
-        begin
-          c_iflag := c_iflag and (not (IGNBRK or BRKINT or PARMRK or ISTRIP or
-            INLCR or IGNCR or ICRNL or IXON));
-          c_lflag := c_lflag and
-            (not (ECHO or ECHONL or ICANON or ISIG or IEXTEN));
-       end;
-     if outPutRaw then
-       begin
-         c_oflag := c_oflag and not(OPOST);
-         c_cflag := c_cflag and not(CSIZE or PARENB) or CS8;
-       end;
-   end;
-  TCSetAttr(1,TCSANOW,tio);
-end;
-
-procedure TargetEntry;
-begin
-  TCGetAttr(1,InitialVideoTio);
-end;
-
-procedure TargetExit;
-begin
-  TCSetAttr(1,TCSANOW,InitialVideoTio);
-end;
-
-procedure prepareInitVideo;
-begin
-  TCGetAttr(1,preInitVideoTio);
-  saveRawSettings(preInitVideoTio);
-end;
-
-procedure videoInitDone;
-begin
-  TCGetAttr(1,postInitVideoTio);
-  restoreRawSettings(postInitVideoTio);
-end;
-
-procedure prepareDoneVideo;
-var
-  tio: linux.termios;
-begin
-  TCGetAttr(1,tio);
-  saveRawSettings(tio);
-  TCSetAttr(1,TCSANOW,postInitVideoTio);
-end;
-
-procedure doneVideoDone;
-begin
-  restoreRawSettings(preInitVideoTio);
-end;
-
-procedure InitVideo;
-const
-  fontstr : string[3]=#27'(K';
-var
-  ThisTTY: String[30];
-  FName: String;
-  WS: packed record
-    ws_row, ws_col, ws_xpixel, ws_ypixel: Word;
-  end;
-  Err: Longint;
-  prev_term : TerminalCommon_ptr1;
-begin
-{$ifndef CPUI386}
-  LowAscii:=false;
-{$endif CPUI386}
-  if VideoBufSize<>0 then
-   begin
-     clearscreen;
-     if Console then
-      SetCursorPos(1,1)
-     else
-      begin
-        SendEscapeSeqNdx(cursor_home);
-        SendEscapeSeq(#27'[H');
-      end;
-     exit;
-   end;
-  { check for tty }
-  ThisTTY:=TTYName(stdin);
-  if IsATTY(stdin) then
-   begin
-     { save current terminal characteristics and remove rawness }
-     prepareInitVideo;
-     { write code to set a correct font }
-     fdWrite(stdout,fontstr[1],length(fontstr));
-     { running on a tty, find out whether locally or remotely }
-     if (Copy(ThisTTY, 1, 8) = '/dev/tty') and
-        (ThisTTY[9] >= '0') and (ThisTTY[9] <= '9') then
-      begin
-        { running on the console }
-        FName:='/dev/vcsa' + ThisTTY[9];
-        TTYFd:=OpenFile(FName, filReadWrite); { open console }
-      end
-     else
-      TTYFd:=-1;
-     if TTYFd<>-1 then
-      Console:=true
-     else
-      begin
-        { running on a remote terminal, no error with /dev/vcsa }
-        Console:=False;
-        LowAscii:=false;
-        TTYFd:=stdout;
-      end;
-     ioctl(stdin, TIOCGWINSZ, @WS);
-     if WS.ws_Col=0 then
-      WS.ws_Col:=80;
-     if WS.ws_Row=0 then
-      WS.ws_Row:=25;
-     ScreenWidth:=WS.ws_Col;
-     { TDrawBuffer only has FVMaxWidth elements
-       larger values lead to crashes }
-     if ScreenWidth> FVMaxWidth then
-       ScreenWidth:=FVMaxWidth;
-     ScreenHeight:=WS.ws_Row;
-     CursorX:=1;
-     CursorY:=1;
-     ScreenColor:=True;
-     { allocate pmode memory buffer }
-     VideoBufSize:=ScreenWidth*ScreenHeight*2;
-     GetMem(VideoBuf,VideoBufSize);
-     GetMem(OldVideoBuf,VideoBufSize);
-     { Start with a clear screen }
-     if not Console then
-      begin
-        prev_term:=cur_term;
-        setupterm(nil, stdout, err);
-        can_delete_term:=assigned(prev_term) and (prev_term<>cur_term);
-        SendEscapeSeqNdx(cursor_home);
-        SendEscapeSeqNdx(cursor_normal);
-        SendEscapeSeqNdx(cursor_visible);
-        SendEscapeSeqNdx(enter_ca_mode);
-        SetCursorType(crUnderLine);
-      end
-     else if not assigned(cur_term) then
-       begin
-         setupterm(nil, stdout, err);
-         can_delete_term:=false;
-       end;
-     if assigned(cur_term_Strings) then
-       begin
-         ACSIn:=StrPas(cur_term_Strings^[enter_alt_charset_mode]);
-         ACSOut:=StrPas(cur_term_Strings^[exit_alt_charset_mode]);
-       end
-     else
-       begin
-         ACSIn:='';
-         ACSOut:='';
-       end;
-     ClearScreen;
-{$ifdef logging}
-     assign(f,'video.log');
-     rewrite(f,1);
-{$endif logging}
-     { save new terminal characteristics and possible restore rawness }
-     videoInitDone;
-   end
-  else
-   ErrorCode:=errVioInit; { not a TTY }
-end;
-
-procedure DoneVideo;
-begin
-  if VideoBufSize=0 then
-   exit;
-  prepareDoneVideo;
-  ClearScreen;
-  if Console then
-   SetCursorPos(1,1)
-  else
-   begin
-     SendEscapeSeqNdx(exit_ca_mode);
-     SendEscapeSeqNdx(cursor_home);
-     SendEscapeSeqNdx(cursor_normal);
-     SendEscapeSeqNdx(cursor_visible);
-     SetCursorType(crUnderLine);
-     SendEscapeSeq(#27'[H');
-   end;
-  FreeMem(VideoBuf,VideoBufSize);
-  FreeMem(OldVideoBuf,VideoBufSize);
-  VideoBufSize:=0;
-  ACSIn:='';
-  ACSOut:='';
-  doneVideoDone;
-  if can_delete_term then
-    begin
-      del_curterm(cur_term);
-      can_delete_term:=false;
-    end;
-{$ifdef logging}
-  close(f);
-{$endif logging}
-end;
-
-
-procedure ClearScreen;
-begin
-  FillWord(VideoBuf^,VideoBufSize shr 1,$0720);
-  if Console then
-   UpdateScreen(true)
-  else
-   begin
-     SendEscapeSeq(#27'[0m');
-     SendEscapeSeqNdx(clear_screen);
-   end;
-end;
-
-
-procedure UpdateScreen(Force: Boolean);
-var
-  DoUpdate : boolean;
-begin
-  if LockUpdateScreen<>0 then
-   exit;
-  if not force then
-   begin
-{$ifdef i386}
-     asm
-          movl    VideoBuf,%esi
-          movl    OldVideoBuf,%edi
-          movl    VideoBufSize,%ecx
-          shrl    $2,%ecx
-          repe
-          cmpsl
-          orl     %ecx,%ecx
-          setne   DoUpdate
-     end;
-{$endif i386}
-   end
-  else
-   DoUpdate:=true;
-  if not DoUpdate then
-   exit;
-  if Console then
-   begin
-     fdSeek(TTYFd, 4, skBeg);
-     fdWrite(TTYFd, VideoBuf^,VideoBufSize);
-   end
-  else
-   begin
-     UpdateTTY(force);
-   end;
-  Move(VideoBuf^, OldVideoBuf^, VideoBufSize);
-end;
-
-
-function GetCapabilities: Word;
-begin
-{ about cpColor... we should check the terminfo database... }
-  GetCapabilities:=cpUnderLine + cpBlink + cpColor;
-end;
-
-
-procedure SetCursorPos(NewCursorX, NewCursorY: Word);
-var
-  Pos : array [1..2] of Byte;
-begin
-  if Console then
-   begin
-     fdSeek(TTYFd, 2, skBeg);
-     Pos[1]:=NewCursorX;
-     Pos[2]:=NewCursorY;
-     fdWrite(TTYFd, Pos, 2);
-   end
-  else
-   begin
-     { newcursorx,y is 0 based ! }
-     SendEscapeSeq(XY2Ansi(NewCursorX+1,NewCursorY+1,0,0));
-   end;
-  CursorX:=NewCursorX+1;
-  CursorY:=NewCursorY+1;
-end;
-
-
-function GetCursorType: Word;
-begin
-  GetCursorType:=LastCursorType;
-end;
-
-
-procedure SetCursorType(NewType: Word);
-begin
-  LastCursorType:=NewType;
-  case NewType of
-   crBlock :
-     SendEscapeSeq(#27'[?17;0;64c');
-   crHidden :
-     SendEscapeSeq(#27'[?1c');
-  else
-    SendEscapeSeq(#27'[?2c');
-  end;
-end;
-
-
-function DefaultVideoModeSelector(const VideoMode: TVideoMode; Params: Longint): Boolean;
-begin
-  DefaultVideoModeSelector:=false;
-end;
-
-
-procedure RegisterVideoModes;
-begin
-end;
-
-{
-  $Log$
-  Revision 1.3  2000-11-13 17:22:22  pierre
-   merge NoExtendedFrame
-
-<<<<<<< video.inc
-  Revision 1.2  2000/10/26 23:08:48  peter
-    * merged freebsd from fixes
-
-=======
-  Revision 1.1.2.2  2000/11/09 08:50:36  pierre
-   + support for terms with only one graphic set
-
->>>>>>> 1.1.2.2
-  Revision 1.1.2.1  2000/10/25 12:23:20  marco
-   * Linux dir split up
-
-  Revision 1.1.2.11  2000/10/19 07:28:18  pierre
-   * do not transmit the delay part in terminfo strings
-
-  Revision 1.1.2.10  2000/10/13 15:09:40  pierre
-   * Handle zero size for term correctly
-
-  Revision 1.1.2.9  2000/10/10 16:39:44  pierre
-   + transform low ascii chars by changing their colors and adding 48
-
-  Revision 1.1.2.8  2000/10/10 15:34:58  pierre
-   * fixe a bug in Attr2Ansi
-
-  Revision 1.1.2.7  2000/10/10 10:52:56  pierre
-   + FVMaxWidth to avoid too wide screens
-
-  Revision 1.1.2.6  2000/10/09 21:57:42  pierre
-   * Set LowAscii to false only if not on a local tty
-
-  Revision 1.1.2.5  2000/10/09 16:29:15  pierre
-   * more linux terminal fixes
-
-  Revision 1.1.2.4  2000/10/04 11:44:33  pierre
-   add TargetEntry and TargetExit procedures (needed for linux)
-
-  Revision 1.1.2.3  2000/10/03 22:31:29  pierre
-   * avoid invalid cur_term var
-
-  Revision 1.1.2.2  2000/09/25 13:21:19  jonas
-    + added preserving of rawness of terminal when going though
-      init/donevideo
-    * del_term() is now called in donevideo
-    * if initvideo is called while the video is already iniialized, the
-      screen is cleared and the cursor is set home, instead of going
-      through the whole donevideo and then initvideo
-
-  Revision 1.1.2.1  2000/08/02 12:29:06  jonas
-    * fixed crashes under ncurses 4 by adding auto-detection for ncurses 4/5
-    * cur_term is not directly usable anymore for the largest part because
-      of a different record layout in ncurses 4/5, therefore the pointers
-      cur_term_booleans, cur_term_numbers, cur_term_strings and
-      cur_term_common are now available
-    * adapted video.inc to use the new naming convention
-
-  Revision 1.1  2000/07/13 06:29:39  michael
-  + Initial import
-
-  Revision 1.3  2000/06/30 12:28:57  jonas
-    * fixed termtype structure
-
-  Revision 1.2  2000/03/12 15:02:10  peter
-    * removed unused var
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.5  1999/07/05 21:38:19  peter
-    * works now also on not /dev/tty* units
-    * if col,row is 0,0 then take 80x25 by default
-
-  Revision 1.4  1999/02/22 12:46:16  peter
-    + lowascii boolean if ascii < #32 is handled correctly
-
-  Revision 1.3  1999/02/08 10:34:26  peter
-    * cursortype futher implemented
-
-  Revision 1.2  1998/12/12 19:13:03  peter
-    * keyboard updates
-    * make test target, make all only makes units
-
-  Revision 1.1  1998/12/04 12:48:30  peter
-    * moved some dirs
-
-  Revision 1.6  1998/12/03 10:18:07  peter
-    * tty fixed
-
-  Revision 1.5  1998/12/01 15:08:17  peter
-    * fixes for linux
-
-  Revision 1.4  1998/11/01 20:29:12  peter
-    + lockupdatescreen counter to not let updatescreen() update
-
-  Revision 1.3  1998/10/29 12:49:50  peter
-    * more fixes
-
-  Revision 1.1  1998/10/26 11:31:47  peter
-    + inital include files
-
-}

+ 0 - 1278
api/win32/Makefile

@@ -1,1278 +0,0 @@
-#
-# Makefile generated by fpcmake v1.00 [2000/12/19]
-#
-
-defaultrule: all
-
-#####################################################################
-# Autodetect OS (Linux or Dos or Windows NT or OS/2)
-# define inUnix when running under Unix (Linux,FreeBSD)
-# define inWinNT when running under WinNT
-# define inOS2 when running under OS/2
-#####################################################################
-
-# We need only / in the path
-override PATH:=$(subst \,/,$(PATH))
-
-# Search for PWD and determine also if we are under linux
-PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
-ifeq ($(PWD),)
-PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
-ifeq ($(PWD),)
-nopwd:
-	@echo You need the GNU utils package to use this Makefile!
-	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
-	@exit
-else
-inUnix=1
-PWD:=$(firstword $(PWD))
-endif
-else
-PWD:=$(firstword $(PWD))
-endif
-
-# Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
-ifeq ($(OS),Windows_NT)
-inWinNT=1
-else
-ifdef OS2_SHELL
-inOS2=1
-endif
-endif
-endif
-
-# The extension of executables
-ifdef inUnix
-SRCEXEEXT=
-else
-SRCEXEEXT=.exe
-endif
-
-# The path which is searched separated by spaces
-ifdef inUnix
-SEARCHPATH=$(subst :, ,$(PATH))
-else
-SEARCHPATH=$(subst ;, ,$(PATH))
-endif
-
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
-#####################################################################
-# Default target
-#####################################################################
-
-override OS_TARGET:=win32
-
-#####################################################################
-# FPC version/target Detection
-#####################################################################
-
-# What compiler to use ?
-ifndef FPC
-# Compatibility with old makefiles
-ifdef PP
-FPC=$(PP)
-else
-FPC=ppc386
-endif
-endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
-
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
-# Target CPU
-ifndef CPU_TARGET
-CPU_TARGET:=$(shell $(FPC) -iTP)
-endif
-
-# Source CPU
-ifndef CPU_SOURCE
-CPU_SOURCE:=$(shell $(FPC) -iSP)
-endif
-
-# FPC version
-ifndef FPC_VERSION
-FPC_VERSION:=$(shell $(FPC) -iV)
-endif
-
-export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
-
-#####################################################################
-# Pre Settings
-#####################################################################
-
-INC=../inc
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-#####################################################################
-# FPCDIR Setting
-#####################################################################
-
-# Test FPCDIR to look if the RTL dir exists
-ifdef FPCDIR
-override FPCDIR:=$(subst \,/,$(FPCDIR))
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-else
-override FPCDIR=wrong
-endif
-
-# Default FPCDIR
-ifeq ($(FPCDIR),wrong)
-override FPCDIR=../..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=wrong
-endif
-endif
-endif
-
-# Detect FPCDIR
-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 $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR:=$(FPCDIR)/..
-ifeq ($(wildcard $(FPCDIR)/rtl),)
-ifeq ($(wildcard $(FPCDIR)/units),)
-override FPCDIR=c:/pp
-endif
-endif
-endif
-endif
-endif
-endif
-
-ifndef PACKAGESDIR
-PACKAGESDIR=$(FPCDIR)/packages
-endif
-ifndef TOOLKITSDIR
-TOOLKITSDIR=
-endif
-ifndef COMPONENTSDIR
-COMPONENTSDIR=
-endif
-
-# Create units dir
-ifneq ($(FPCDIR),.)
-UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
-endif
-
-#####################################################################
-# User Settings
-#####################################################################
-
-
-# Targets
-
-override UNITOBJECTS+=event $(APIOBJECTS)
-
-# Clean
-
-
-# Install
-
-UNITSUBDIR=api
-PACKAGENAME=api
-ZIPTARGET=install
-
-# Defaults
-
-
-# Directories
-
-vpath %$(PASEXT) $(INC)
-override NEEDINCDIR=$(INC)
-ifndef TARGETDIR
-TARGETDIR=.
-endif
-
-# Packages
-
-override PACKAGES+=rtl
-
-# Libraries
-
-LIBNAME=fpapi
-
-# Info
-
-INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
-
-#####################################################################
-# Shell tools
-#####################################################################
-
-# echo
-ifndef ECHO
-ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ECHO),)
-ECHO:=echo
-ECHOE:=echo
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-else
-ECHO:=$(firstword $(ECHO))
-ECHOE=$(ECHO) -E
-endif
-endif
-
-# To copy pograms
-ifndef COPY
-COPY:=cp -fp
-endif
-
-# Copy a whole tree
-ifndef COPYTREE
-COPYTREE:=cp -rfp
-endif
-
-# To move pograms
-ifndef MOVE
-MOVE:=mv -f
-endif
-
-# Check delete program
-ifndef DEL
-DEL:=rm -f
-endif
-
-# Check deltree program
-ifndef DELTREE
-DELTREE:=rm -rf
-endif
-
-# To install files
-ifndef INSTALL
-ifdef inUnix
-INSTALL:=install -c -m 644
-else
-INSTALL:=$(COPY)
-endif
-endif
-
-# To install programs
-ifndef INSTALLEXE
-ifdef inUnix
-INSTALLEXE:=install -c -m 755
-else
-INSTALLEXE:=$(COPY)
-endif
-endif
-
-# To make a directory.
-ifndef MKDIR
-ifdef inUnix
-MKDIR:=install -m 755 -d
-else
-MKDIR:=ginstall -m 755 -d
-endif
-endif
-
-export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
-
-#####################################################################
-# Default Tools
-#####################################################################
-
-# assembler, redefine it if cross compiling
-ifndef AS
-AS=as
-endif
-
-# linker, but probably not used
-ifndef LD
-LD=ld
-endif
-
-# ppas.bat / ppas.sh
-ifdef inUnix
-PPAS=ppas.sh
-else
-ifdef inOS2
-PPAS=ppas.cmd
-else
-PPAS=ppas.bat
-endif
-endif
-
-# ldconfig to rebuild .so cache
-ifdef inUnix
-LDCONFIG=ldconfig
-else
-LDCONFIG=
-endif
-
-# ppumove
-ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUMOVE),)
-PPUMOVE=
-else
-PPUMOVE:=$(firstword $(PPUMOVE))
-endif
-endif
-export PPUMOVE
-
-# ppufiles
-ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(PPUFILES),)
-PPUFILES=
-else
-PPUFILES:=$(firstword $(PPUFILES))
-endif
-endif
-export PPUFILES
-
-# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
-# upx uses that one itself (PFV)
-ifndef UPXPROG
-ifeq ($(OS_TARGET),go32v2)
-UPXPROG:=1
-endif
-ifeq ($(OS_TARGET),win32)
-UPXPROG:=1
-endif
-ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(UPXPROG),)
-UPXPROG=
-else
-UPXPROG:=$(firstword $(UPXPROG))
-endif
-else
-UPXPROG=
-endif
-endif
-export UPXPROG
-
-# ZipProg, you can't use Zip as the var name (PFV)
-ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(ZIPPROG),)
-ZIPPROG=
-else
-ZIPPROG:=$(firstword $(ZIPPROG))
-endif
-endif
-export ZIPPROG
-
-ZIPOPT=-9
-ZIPEXT=.zip
-
-# Tar
-ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
-ifeq ($(TARPROG),)
-TARPROG=
-else
-TARPROG:=$(firstword $(TARPROG))
-endif
-endif
-export TARPROG
-
-ifeq ($(USETAR),bz2)
-TAROPT=vI
-TAREXT=.tar.bz2
-else
-TAROPT=vz
-TAREXT=.tar.gz
-endif
-
-#####################################################################
-# Default extensions
-#####################################################################
-
-# Default needed extensions (Go32v2,Linux)
-LOADEREXT=.as
-EXEEXT=.exe
-PPLEXT=.ppl
-PPUEXT=.ppu
-OEXT=.o
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.so
-RSTEXT=.rst
-FPCMADE=fpcmade
-
-# Go32v1
-ifeq ($(OS_TARGET),go32v1)
-PPUEXT=.pp1
-OEXT=.o1
-ASMEXT=.s1
-SMARTEXT=.sl1
-STATICLIBEXT=.a1
-SHAREDLIBEXT=.so1
-FPCMADE=fpcmade.v1
-endif
-
-# Go32v2
-ifeq ($(OS_TARGET),go32v2)
-FPCMADE=fpcmade.dos
-endif
-
-# Linux
-ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.lnx
-endif
-
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
-# Win32
-ifeq ($(OS_TARGET),win32)
-PPUEXT=.ppw
-OEXT=.ow
-ASMEXT=.sw
-SMARTEXT=.slw
-STATICLIBEXT=.aw
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.w32
-endif
-
-# OS/2
-ifeq ($(OS_TARGET),os2)
-PPUEXT=.ppo
-ASMEXT=.so2
-OEXT=.oo2
-SMARTEXT=.so
-STATICLIBEXT=.ao2
-SHAREDLIBEXT=.dll
-FPCMADE=fpcmade.os2
-endif
-
-# library prefix
-LIBPREFIX=lib
-ifeq ($(OS_TARGET),go32v2)
-LIBPREFIX=
-endif
-ifeq ($(OS_TARGET),go32v1)
-LIBPREFIX=
-endif
-
-# determine which .pas extension is used
-ifndef PASEXT
-ifdef EXEOBJECTS
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
-else
-override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
-endif
-ifeq ($(TESTPAS),)
-PASEXT=.pp
-else
-PASEXT=.pas
-endif
-endif
-
-
-# Check if the dirs really exists, else turn it off
-ifeq ($(wildcard $(UNITSDIR)),)
-UNITSDIR=
-endif
-ifeq ($(wildcard $(TOOLKITSDIR)),)
-TOOLKITSDIR=
-endif
-ifeq ($(wildcard $(PACKAGESDIR)),)
-PACKAGESDIR=
-endif
-ifeq ($(wildcard $(COMPONENTSDIR)),)
-COMPONENTSDIR=
-endif
-
-
-# PACKAGESDIR packages
-
-PACKAGERTL=1
-
-ifdef PACKAGERTL
-ifneq ($(wildcard $(FPCDIR)/rtl),)
-ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
-PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
-else
-PACKAGEDIR_RTL=$(FPCDIR)/rtl
-endif
-ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
-override COMPILEPACKAGES+=package_rtl
-package_rtl:
-	$(MAKE) -C $(PACKAGEDIR_RTL) all
-endif
-UNITDIR_RTL=$(PACKAGEDIR_RTL)
-else
-PACKAGEDIR_RTL=
-ifneq ($(wildcard $(UNITSDIR)/rtl),)
-ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
-UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
-else
-UNITDIR_RTL=$(UNITSDIR)/rtl
-endif
-else
-UNITDIR_RTL=
-endif
-endif
-ifdef UNITDIR_RTL
-override NEEDUNITDIR+=$(UNITDIR_RTL)
-endif
-endif
-
-
-#####################################################################
-# Default Directories
-#####################################################################
-
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
-# set the prefix directory where to install everything
-ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
-PREFIXINSTALLDIR=/usr
-else
-PREFIXINSTALLDIR=/pp
-endif
-endif
-export PREFIXINSTALLDIR
-
-# Where to place the resulting zip files
-ifndef DESTZIPDIR
-DESTZIPDIR:=$(BASEDIR)
-endif
-export DESTZIPDIR
-
-#####################################################################
-# Install Directories
-#####################################################################
-
-# set the base directory where to install everything
-ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
-else
-BASEINSTALLDIR=$(PREFIXINSTALLDIR)
-endif
-endif
-
-# set the directory where to install the binaries
-ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
-BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
-else
-BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
-endif
-endif
-
-# set the directory where to install the units.
-ifndef UNITINSTALLDIR
-UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
-ifdef UNITSUBDIR
-UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
-endif
-endif
-
-# Where to install shared libraries
-ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
-LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
-else
-LIBINSTALLDIR=$(UNITINSTALLDIR)
-endif
-endif
-
-# Where the source files will be stored
-ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
-SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
-else
-SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
-endif
-ifdef SOURCESUBDIR
-SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
-endif
-endif
-
-# Where the doc files will be stored
-ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
-DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
-else
-DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
-endif
-endif
-
-# Where to install the examples, under linux we use the doc dir
-# because the copytree command will create a subdir itself
-ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
-EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
-else
-EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
-endif
-ifdef EXAMPLESUBDIR
-EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
-endif
-endif
-
-# Where the some extra (data)files will be stored
-ifndef DATAINSTALLDIR
-DATAINSTALLDIR=$(BASEINSTALLDIR)
-endif
-
-#####################################################################
-# Redirection
-#####################################################################
-
-ifndef REDIRFILE
-REDIRFILE=log
-endif
-
-ifdef REDIR
-ifndef inUnix
-override FPC=redir -eo $(FPC)
-endif
-# set the verbosity to max
-override FPCOPT+=-va
-override REDIR:= >> $(REDIRFILE)
-endif
-
-
-#####################################################################
-# Compiler Command Line
-#####################################################################
-
-# Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(CPU_TARGET)
-
-# Load commandline OPT and add target and unit dir to be sure
-ifneq ($(OS_TARGET),$(OS_SOURCE))
-override FPCOPT+=-T$(OS_TARGET)
-endif
-
-# User dirs should be first, so they are looked at first
-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
-
-# Smartlinking
-ifdef LINKSMART
-override FPCOPT+=-XX
-endif
-
-# Smartlinking creation
-ifdef CREATESMART
-override FPCOPT+=-CX
-endif
-
-# Debug
-ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
-endif
-
-# Release mode (strip, optimize and don't load ppc386.cfg)
-# 0.99.12b has a bug in the optimizer so don't use it by default
-ifdef RELEASE
-ifeq ($(FPC_VERSION),0.99.12)
-override FPCOPT+=-Xs -OGp3 -n
-else
-override FPCOPT+=-Xs -OG2p3 -n
-endif
-endif
-
-# Strip
-ifdef STRIP
-override FPCOPT+=-Xs
-endif
-
-# Optimizer
-ifdef OPTIMIZE
-override FPCOPT+=-OG2p3
-endif
-
-# Verbose settings (warning,note,info)
-ifdef VERBOSE
-override FPCOPT+=-vwni
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
-endif
-
-
-# Target dirs and the prefix to use for clean/install
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
-endif
-
-# Add commandline options last so they can override
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-
-# Add defines from FPCOPTDEF to FPCOPT
-ifdef FPCOPTDEF
-override FPCOPT+=$(FPCOPTDEF)
-endif
-
-# Error file ?
-ifdef ERRORFILE
-override FPCOPT+=-Fr$(ERRORFILE)
-endif
-
-# Was a config file specified ?
-ifdef CFGFILE
-override FPCOPT+=@$(CFGFILE)
-endif
-
-# For win32 the options are passed using the environment FPCEXTCMD
-ifeq ($(OS_SOURCE),win32)
-override FPCEXTCMD:=$(FPCOPT)
-override FPCOPT:=!FPCEXTCMD
-export FPCEXTCMD
-endif
-
-# Compiler commandline
-override COMPILER:=$(FPC) $(FPCOPT)
-
-# also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
-ifeq (,$(findstring -s ,$(COMPILER)))
-EXECPPAS=
-else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
-EXECPPAS:=@$(PPAS)
-endif
-endif
-
-#####################################################################
-# Standard rules
-#####################################################################
-
-all: fpc_all
-
-debug: fpc_debug
-
-smart: fpc_smart
-
-shared: fpc_shared
-
-showinstall: fpc_showinstall
-
-install: fpc_install
-
-sourceinstall: fpc_sourceinstall
-
-exampleinstall: fpc_exampleinstall
-
-zipinstall: fpc_zipinstall
-
-zipsourceinstall: fpc_zipsourceinstall
-
-zipexampleinstall: fpc_zipexampleinstall
-
-clean: fpc_clean
-
-distclean: fpc_distclean
-
-cleanall: fpc_cleanall
-
-info: fpc_info
-
-.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
-
-#####################################################################
-# Units
-#####################################################################
-
-.PHONY: fpc_units
-
-override ALLTARGET+=fpc_units
-
-override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
-override INSTALLPPUFILES+=$(UNITPPUFILES)
-override CLEANPPUFILES+=$(UNITPPUFILES)
-
-fpc_units: $(UNITPPUFILES)
-
-#####################################################################
-# General compile rules
-#####################################################################
-
-.PHONY: fpc_packages fpc_all fpc_debug
-
-$(FPCMADE): $(ALLTARGET)
-	@$(ECHO) Compiled > $(FPCMADE)
-
-fpc_packages: $(COMPILEPACKAGES)
-
-fpc_all: fpc_packages $(FPCMADE)
-
-fpc_debug:
-	$(MAKE) all DEBUG=1
-
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
-# General compile rules, available for both possible PASEXT
-
-.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
-
-%$(PPUEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(PPUEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pp
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-%$(EXEEXT): %.pas
-	$(COMPILER) $< $(REDIR)
-	$(EXECPPAS)
-
-#####################################################################
-# Library
-#####################################################################
-
-.PHONY: fpc_smart fpc_shared
-
-ifdef LIBVERSION
-LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
-else
-LIBFULLNAME=$(LIBNAME)
-endif
-
-# Default sharedlib units are all unit objects
-ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
-endif
-
-fpc_smart:
-	$(MAKE) all LINKSMART=1 CREATESMART=1
-
-fpc_shared: all
-ifdef HASSHAREDLIB
-ifndef LIBNAME
-	@$(ECHO) "LIBNAME not set"
-else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
-endif
-else
-	@$(ECHO) "Shared Libraries not supported"
-endif
-
-#####################################################################
-# Install rules
-#####################################################################
-
-.PHONY: fpc_showinstall fpc_install
-
-ifdef EXTRAINSTALLUNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
-endif
-
-ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-ifdef PPUFILES
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
-endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-
-fpc_showinstall: $(SHOWINSTALLTARGET)
-ifdef INSTALLEXEFILES
-	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
-endif
-ifdef INSTALLPPUFILES
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
-ifneq ($(INSTALLPPULINKFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
-	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
-endif
-
-fpc_install: $(INSTALLTARGET)
-# Create UnitInstallFiles
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(BININSTALLDIR)
-# Compress the exes if upx is defined
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(UNITINSTALLDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
-endif
-ifneq ($(wildcard $(LIBFULLNAME)),)
-	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
-	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
-endif
-endif
-endif
-ifdef EXTRAINSTALLFILES
-	$(MKDIR) $(DATAINSTALLDIR)
-	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
-endif
-
-#####################################################################
-# SourceInstall rules
-#####################################################################
-
-.PHONY: fpc_sourceinstall
-
-ifndef SOURCETOPDIR
-SOURCETOPDIR=$(BASEDIR)
-endif
-
-fpc_sourceinstall: clean
-	$(MKDIR) $(SOURCEINSTALLDIR)
-	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
-
-#####################################################################
-# exampleinstall rules
-#####################################################################
-
-.PHONY: fpc_exampleinstall
-
-fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
-ifdef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
-endif
-ifdef EXAMPLEDIROBJECTS
-ifndef EXAMPLESOURCEFILES
-	$(MKDIR) $(EXAMPLEINSTALLDIR)
-endif
-	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
-endif
-
-#####################################################################
-# Zip
-#####################################################################
-
-.PHONY: fpc_zipinstall
-
-# Create suffix to add
-ifndef PACKAGESUFFIX
-PACKAGESUFFIX=$(OS_TARGET)
-ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
-endif
-ifeq ($(OS_TARGET),win32)
-PACKAGESUFFIX=w32
-endif
-ifeq ($(OS_TARGET),os2)
-PACKAGESUFFIX=emx
-endif
-endif
-
-# Temporary path to pack a file
-ifndef PACKDIR
-ifndef inUnix
-PACKDIR=$(BASEDIR)/pack_tmp
-else
-PACKDIR=/tmp/fpc-pack
-endif
-endif
-
-# Maybe create default zipname from packagename
-ifndef ZIPNAME
-ifdef PACKAGENAME
-ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
-endif
-endif
-
-# Use tar by default under linux
-ifndef USEZIP
-ifdef inUnix
-USETAR=1
-endif
-endif
-
-fpc_zipinstall:
-ifndef ZIPNAME
-	@$(ECHO) "Please specify ZIPNAME!"
-	@exit 1
-else
-	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
-ifdef USETAR
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
-else
-	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
-	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
-endif
-	$(DELTREE) $(PACKDIR)
-endif
-
-.PHONY:  fpc_zipsourceinstall
-
-fpc_zipsourceinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
-
-.PHONY:  fpc_zipexampleinstall
-
-fpc_zipexampleinstall:
-	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
-
-#####################################################################
-# Clean rules
-#####################################################################
-
-.PHONY: fpc_clean fpc_cleanall fpc_distclean
-
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
-ifdef EXTRACLEANUNITS
-override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
-endif
-
-ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
-ifdef PPUFILES
-CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
-else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
-endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
-endif
-
-fpc_clean: $(CLEANTARGET)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-ifdef CLEANPPUFILES
-	-$(DEL) $(CLEANPPUFILES)
-endif
-ifneq ($(CLEANPPULINKFILES),)
-	-$(DEL) $(CLEANPPULINKFILES)
-endif
-ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
-endif
-ifdef EXTRACLEANFILES
-	-$(DEL) $(EXTRACLEANFILES)
-endif
-ifdef LIBNAME
-	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
-endif
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-fpc_distclean: fpc_clean
-
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
-ifdef CLEANEXEFILES
-	-$(DEL) $(CLEANEXEFILES)
-endif
-	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-	-$(DELTREE) *$(SMARTEXT)
-	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
-
-#####################################################################
-# Info rules
-#####################################################################
-
-.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
-	fpc_dirinfo
-
-fpc_info: $(INFOTARGET)
-
-fpc_infocfg:
-	@$(ECHO)
-	@$(ECHO)  == Configuration info ==
-	@$(ECHO)
-	@$(ECHO)  FPC....... $(FPC)
-	@$(ECHO)  Version... $(FPC_VERSION)
-	@$(ECHO)  CPU....... $(CPU_TARGET)
-	@$(ECHO)  Source.... $(OS_SOURCE)
-	@$(ECHO)  Target.... $(OS_TARGET)
-	@$(ECHO)
-
-fpc_infoobjects:
-	@$(ECHO)
-	@$(ECHO)  == Object info ==
-	@$(ECHO)
-	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
-	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
-	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
-	@$(ECHO)
-	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
-	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
-	@$(ECHO)
-	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
-	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
-	@$(ECHO)
-
-fpc_infoinstall:
-	@$(ECHO)
-	@$(ECHO)  == Install info ==
-	@$(ECHO)
-ifdef DATE
-	@$(ECHO)  DateStr.............. $(DATESTR)
-endif
-ifdef PACKAGEPREFIX
-	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
-endif
-ifdef PACKAGENAME
-	@$(ECHO)  PackageName.......... $(PACKAGENAME)
-endif
-	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
-	@$(ECHO)
-	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
-	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
-	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
-	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
-	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
-	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
-	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
-	@$(ECHO)
-	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
-	@$(ECHO)  ZipName.............. $(ZIPNAME)
-	@$(ECHO)
-
-#####################################################################
-# Local Makefile
-#####################################################################
-
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
-endif
-
-#####################################################################
-# Users rules
-#####################################################################
-
-video$(PPUEXT): $(INC)/video.pas video.inc event$(PPUEXT)
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc event$(PPUEXT)
-
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc event$(PPUEXT)
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc
-
-event$(PPUEXT): event.pas

+ 0 - 42
api/win32/Makefile.fpc

@@ -1,42 +0,0 @@
-#
-#   Makefile.fpc for Free Pascal API (used by Free Vision) for win32
-#
-
-[defaults]
-defaulttarget=win32
-
-[targets]
-units=event $(APIOBJECTS)
-
-[install]
-unitsubdir=api
-packagename=api
-
-[libs]
-libname=fpapi
-
-[dirs]
-fpcdir=../..
-targetdir=.
-sourcesdir=$(INC)
-incdir=$(INC)
-
-[presettings]
-INC=../inc
-
-# Override defaults
-override PASEXT=.pas
-
-include $(INC)/Makefile.api
-
-
-[rules]
-video$(PPUEXT): $(INC)/video.pas video.inc event$(PPUEXT)
-
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc event$(PPUEXT)
-
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc event$(PPUEXT)
-
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc
-
-event$(PPUEXT): event.pas

+ 0 - 354
api/win32/event.pas

@@ -1,354 +0,0 @@
-{
-   $Id$
-   Event handling for the Win32 version of the FPC API
-
-   Copyright (c) 1999 by Florian Klaempfl
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-}
-
-unit Event;
-{
-   We need this unit to implement keyboard and mouse,
-   because win32 uses only one message queue for mouse and key events
-}
-  interface
-
-    type
-       TEventProcedure = Procedure;
-
-    { these procedures must be used to set the event handlers }
-    { these doesn't do something, they signal only the        }
-    { the upper layer that an event occured, this event       }
-    { must be handled with Win32-API function by the upper    }
-    { layer                                                   }
-    Procedure SetMouseEventHandler(p : TEventProcedure);
-    Procedure SetKeyboardEventHandler(p : TEventProcedure);
-    Procedure SetFocusEventHandler(p : TEventProcedure);
-    Procedure SetMenuEventHandler(p : TEventProcedure);
-    Procedure SetResizeEventHandler(p : TEventProcedure);
-    Procedure SetUnknownEventHandler(p : TEventProcedure);
-
-    { these procedures must be used to get the event handlers }
-    Function GetMouseEventHandler : TEventProcedure;
-    Function GetKeyboardEventHandler : TEventProcedure;
-    Function GetFocusEventHandler : TEventProcedure;
-    Function GetMenuEventHandler : TEventProcedure;
-    Function GetResizeEventHandler : TEventProcedure;
-    Function GetUnknownEventHandler : TEventProcedure;
-
-  implementation
-
-    uses
-       windows, dos;
-
-    const
-       { these procedures are called if an event occurs }
-       MouseEventHandler : procedure = nil;
-       KeyboardEventHandler : procedure = nil;
-       FocusEventHandler : procedure = nil;
-       MenuEventHandler : procedure = nil;
-       ResizeEventHandler : procedure = nil;
-       UnknownEventHandler  : procedure = nil;
-
-       { if this counter is zero, the event handler thread is killed }
-       InstalledHandlers : Byte = 0;
-
-    var
-       HandlerChanging : TCriticalSection;
-       OldExitProc : Pointer;
-       EventThreadHandle : Handle;
-       EventThreadID : DWord;
-
-       { true, if the event handler should be stoped }
-       ExitEventHandleThread : boolean;
-
-    Function GetMouseEventHandler : TEventProcedure;
-      begin
-         GetMouseEventHandler:=MouseEventHandler;
-      end;
-
-
-    Function GetKeyboardEventHandler : TEventProcedure;
-      begin
-         GetKeyboardEventHandler:=KeyboardEventHandler;
-      end;
-
-
-    Function GetFocusEventHandler : TEventProcedure;
-      begin
-         GetFocusEventHandler:=FocusEventHandler;
-      end;
-
-
-    Function GetMenuEventHandler : TEventProcedure;
-      begin
-         GetMenuEventHandler:=MenuEventHandler;
-      end;
-
-
-    Function GetResizeEventHandler : TEventProcedure;
-      begin
-         GetResizeEventHandler:=ResizeEventHandler;
-      end;
-
-
-    Function GetUnknownEventHandler : TEventProcedure;
-      begin
-         GetUnknownEventHandler:=UnknownEventHandler;
-      end;
-
-    { removes an event from the event queue }
-    { necessary, if no handler is installed }
-    Procedure DestroyOneEvent;
-      var
-         ir : TInputRecord;
-         dwRead : DWord;
-      begin
-         ReadConsoleInput(TextRec(Input).Handle,ir,1,dwRead);
-      end;
-
-    Function EventHandleThread(p : pointer) : DWord;StdCall;
-      var
-         ir : TInputRecord;
-         dwRead : DWord;
-      begin
-         while not(ExitEventHandleThread) do
-           begin
-              { wait for an event }
-              WaitForSingleObject(TextRec(Input).Handle,INFINITE);
-              { guard this code, else it is doomed to crash, if the
-                thread is switched between the assigned test and
-                the call and the handler is removed
-              }
-              if not(ExitEventHandleThread) then
-                begin
-                   EnterCriticalSection(HandlerChanging);
-                   { read, but don't remove the event }
-                   if (PeekConsoleInput(TextRec(Input).Handle,ir,1,dwRead)) and
-                     (dwRead>0) then
-                     { call the handler }
-                     case ir.EventType of
-                        KEY_EVENT:
-                          begin
-                             if assigned(KeyboardEventHandler) then
-                               KeyboardEventHandler
-                             else
-                               DestroyOneEvent;
-                          end;
-
-                        _MOUSE_EVENT:
-                          begin
-                             if assigned(MouseEventHandler) then
-                               MouseEventHandler
-                             else
-                               DestroyOneEvent;
-                          end;
-
-                        WINDOW_BUFFER_SIZE_EVENT:
-                          begin
-                             if assigned(ResizeEventHandler) then
-                               ResizeEventHandler
-                             else
-                               DestroyOneEvent;
-                          end;
-
-                        MENU_EVENT:
-                          begin
-                             if assigned(MenuEventHandler) then
-                               MenuEventHandler
-                             else
-                               DestroyOneEvent;
-                          end;
-
-                        FOCUS_EVENT:
-                          begin
-                             if assigned(FocusEventHandler) then
-                               FocusEventHandler
-                             else
-                               DestroyOneEvent;
-                          end;
-
-                        else
-                          begin
-                             if assigned(UnknownEventHandler) then
-                               UnknownEventHandler
-                             else
-                               DestroyOneEvent;
-                          end;
-                     end;
-                   LeaveCriticalSection(HandlerChanging);
-                end;
-           end;
-      end;
-
-    Procedure NewEventHandlerInstalled(p,oldp : TEventProcedure);
-      var
-         oldcount : Byte;
-         ir : TInputRecord;
-         written : DWord;
-      begin
-         oldcount:=InstalledHandlers;
-         if Pointer(oldp)<>nil then
-           dec(InstalledHandlers);
-         if Pointer(p)<>nil then
-           inc(InstalledHandlers);
-         { start event handler thread }
-         if (oldcount=0) and (InstalledHandlers=1) then
-           begin
-              ExitEventHandleThread:=false;
-              EventThreadHandle:=CreateThread(nil,0,@EventHandleThread,
-                nil,0,EventThreadID);
-           end
-         { stop and destroy event handler thread }
-         else if (oldcount=1) and (InstalledHandlers=0) then
-           begin
-              ExitEventHandleThread:=true;
-              { create a dummy event and sent it to the thread, so
-                we can leave WatiForSingleObject }
-              ir.EventType:=KEY_EVENT;
-              { mouse event can be disabled by mouse.inc code
-                in DoneMouse
-                so use a key event instead PM }
-              WriteConsoleInput(TextRec(Input).Handle,ir,1,written);
-              { wait, til the thread is ready }
-              WaitForSingleObject(EventThreadHandle,INFINITE);
-              CloseHandle(EventThreadHandle);
-           end;
-      end;
-
-
-    Procedure SetMouseEventHandler(p : TEventProcedure);
-      var
-         oldp : TEventProcedure;
-      begin
-         EnterCriticalSection(HandlerChanging);
-         oldp:=MouseEventHandler;
-         MouseEventHandler:=p;
-         NewEventHandlerInstalled(MouseEventHandler,oldp);
-         LeaveCriticalSection(HandlerChanging);
-      end;
-
-
-    Procedure SetKeyboardEventHandler(p : TEventProcedure);
-      var
-         oldp : TEventProcedure;
-      begin
-         EnterCriticalSection(HandlerChanging);
-         oldp:=KeyboardEventHandler;
-         KeyboardEventHandler:=p;
-         NewEventHandlerInstalled(KeyboardEventHandler,oldp);
-         LeaveCriticalSection(HandlerChanging);
-      end;
-
-
-    Procedure SetFocusEventHandler(p : TEventProcedure);
-      var
-         oldp : TEventProcedure;
-      begin
-         EnterCriticalSection(HandlerChanging);
-         oldp:=FocusEventHandler;
-         FocusEventHandler:=p;
-         NewEventHandlerInstalled(FocusEventHandler,oldp);
-         LeaveCriticalSection(HandlerChanging);
-      end;
-
-
-    Procedure SetMenuEventHandler(p : TEventProcedure);
-      var
-         oldp : TEventProcedure;
-      begin
-         EnterCriticalSection(HandlerChanging);
-         oldp:=MenuEventHandler;
-         MenuEventHandler:=p;
-         NewEventHandlerInstalled(MenuEventHandler,oldp);
-         LeaveCriticalSection(HandlerChanging);
-      end;
-
-
-    Procedure SetResizeEventHandler(p : TEventProcedure);
-      var
-         oldp : TEventProcedure;
-      begin
-         EnterCriticalSection(HandlerChanging);
-         oldp:=ResizeEventHandler;
-         ResizeEventHandler:=p;
-         NewEventHandlerInstalled(ResizeEventHandler,oldp);
-         LeaveCriticalSection(HandlerChanging);
-      end;
-
-
-    Procedure SetUnknownEventHandler(p : TEventProcedure);
-      var
-         oldp : TEventProcedure;
-      begin
-         EnterCriticalSection(HandlerChanging);
-         oldp:=UnknownEventHandler;
-         UnknownEventHandler:=p;
-         NewEventHandlerInstalled(UnknownEventHandler,oldp);
-         LeaveCriticalSection(HandlerChanging);
-      end;
-
-
-    Procedure DoExit;
-      begin
-         { Uninstall all handlers                   }
-         { this stops also the event handler thread }
-         SetMouseEventHandler(nil);
-         SetKeyboardEventHandler(nil);
-         SetFocusEventHandler(nil);
-         SetMenuEventHandler(nil);
-         SetResizeEventHandler(nil);
-         SetUnknownEventHandler(nil);
-         { delete the critical section object }
-         DeleteCriticalSection(HandlerChanging);
-         ExitProc:=OldExitProc;
-      end;
-
-begin
-   InitializeCriticalSection(HandlerChanging);
-   OldExitProc:=ExitProc;
-   ExitProc:=@DoExit;
-end.
-
-{
-  $Log$
-  Revision 1.1  2000-07-13 06:29:41  michael
-  + Initial import
-
-  Revision 1.1  2000/01/06 01:20:31  peter
-    * moved out of packages/ back to topdir
-
-  Revision 1.1  1999/11/24 23:36:38  peter
-    * moved to packages dir
-
-  Revision 1.5  1999/09/22 12:55:18  pierre
-   * use KEY_EVENT for Closing Handle Thread
-
-  Revision 1.4  1999/07/17 17:21:35  florian
-    * fixed the win32 keyboard event handling
-
-  Revision 1.3  1999/07/14 08:45:15  florian
-    * commited a new keyboard by Armin Diehl
-    * fixed event handling, mainly the prototype of eventhandlethread was wrong
-
-  Revision 1.2  1999/06/21 16:43:51  peter
-    * win32 updates from Maarten Bekkers
-
-  Revision 1.1  1999/01/08 14:37:03  florian
-    + initial version, not working yet
-
-}

+ 0 - 171
api/win32/filectrl.inc

@@ -1,171 +0,0 @@
-{
-   $Id$
-   System independent low-level file interface for Win32
-
-   Copyright (c) 1999 by Florian Klaempfl
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-}
-
-uses
-  Windows;
-
-function OpenFileStr(FName: PChar; Flags: Longint): TFileHandle;
-begin
-  SetLastError(0);
-
-  OpenFileStr :=
-    Windows.CreateFile(FName,
-               GENERIC_READ OR GENERIC_WRITE,
-               FILE_SHARE_READ OR FILE_SHARE_WRITE,
-               nil,
-               OPEN_EXISTING,
-               FILE_ATTRIBUTE_NORMAL,
-               0);
-
-  ErrorCode := GetLastError;
-end; { func. OpenFileStr }
-
-
-function CreateFileStr(FName: PChar): TFileHandle;
-begin
-  SetLastError(0);
-
-  CreateFileStr :=
-    Windows.CreateFile(FName,
-               GENERIC_READ OR GENERIC_WRITE,
-               FILE_SHARE_READ OR FILE_SHARE_WRITE,
-               nil,
-               CREATE_ALWAYS,
-               FILE_ATTRIBUTE_NORMAL,
-               0);
-
-  ErrorCode := GetLastError;
-end;
-
-
-procedure DeleteFileStr(FName: PChar);
-begin
-   ErrorCode:=0;
-
-  if NOT Windows.DeleteFile(FName) then
-     ErrorCode:=GetLastError;
-end;
-
-
-procedure CloseFile(Handle: TFileHandle);
-
-begin
-   ErrorCode:=0;
-   if NOT CloseHandle(Handle) then
-     ErrorCode:=GetLastError;
-end;
-
-
-function SeekFile(Handle: TFileHandle; Pos: TFileInt; SeekType: Word): TFileInt;
-var tmp: longint;
-begin
-   ErrorCode:=0;
-   Tmp := SetFilePointer(Handle, Pos, nil, SeekType);
-
-   if tmp =$ffffffff then
-     begin
-       ErrorCode:=GetLastError;
-       SeekFile := 0
-     end
-       else SeekFile := tmp;
-end;
-
-
-function ReadFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-  Result : CPUWord;
-begin
-  ErrorCode:=0;
-  if Windows.ReadFile(Handle, Buff, Count, Result, nil) then
-    ErrorCode:=GetLastError;
-  ReadFile:=result;
-end;
-
-
-function WriteFile(Handle: TFileHandle; var Buff; Count: CPUWord): CPUWord;
-var
-   Written : CPUWord;
-   Size: Longint;
-begin
-  ErrorCode:=0;
-  if Windows.WriteFile(Handle, Buff, Count, Size, nil) then
-    ErrorCode:=GetLastError;
-  WriteFile:=Written;
-end;
-
-
-procedure FlushFile(Handle: TFileHandle);
-begin
-  ErrorCode:=0;
-  if FlushFileBuffers(Handle) then
-    ErrorCode:=GetLastError;
-end;
-
-
-procedure TruncateFile(Handle: TFileHandle);
-begin
-  ErrorCode:=0;
-  SeekFile(Handle, 0, skEnd);
-  if not(SetEndOfFile(Handle)) then
-    ErrorCode:=GetLastError;
-end;
-
-
-function EndOfFile(Handle: TFileHandle): Boolean;
-begin
-  ErrorCode:=0;
-  EndOfFile := FilePos(Handle) >= FileSize(Handle);
-end;
-
-
-function FilePos(Handle: TFileHandle): TFileInt;
-var
-  l : TFileInt;
-begin
-  ErrorCode:=0;
-  l:=SetFilePointer(Handle, 0, nil, FILE_CURRENT);
-  if l=-1 then
-    begin
-       l:=0;
-       ErrorCode:=GetLastError;
-    end;
-  FilePos:=l;
-end;
-
-
-function FileSize(Handle: TFileHandle): TFileInt;
-var
-  aktfilepos : TFileInt;
-begin
-  SetLastError(0);
-
-  AktFilePos := FilePos(Handle);
-  FileSize := SeekFile(Handle, 0, skEnd);
-  SeekFile(Handle, aktfilepos, skBeg);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:27  michael
-  + removed logs
- 
-}

+ 0 - 795
api/win32/keyboard.inc

@@ -1,795 +0,0 @@
-{
-   $Id$
-   System independent keyboard interface for windows
-
-   Copyright (c) 1999 by Florian Klaempfl
-   Member of the Free Pascal development team
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************}
-
-{ WARNING: Keyboard-Drivers (i.e. german) will only work under WinNT.
-           95 and 98 do not support keyboard-drivers other than us for win32
-           console-apps. So we always get the keys in us-keyboard layout
-           from Win9x.
-}
-
-uses
-{$ifndef DEBUG}
-   Windows,
-{$endif DEBUG}
-   Dos,
-   Event;
-
-const MaxQueueSize = 120;
-      FrenchKeyboard = $040C040C;
-      KeyboardActive : boolean =false;
-var
-   keyboardeventqueue : array[0..maxqueuesize] of TKeyEventRecord;
-   nextkeyevent,nextfreekeyevent : longint;
-   newKeyEvent    : THandle;            {sinaled if key is available}
-   lockVar        : TCriticalSection;   {for queue access}
-   lastShiftState : byte;               {set by handler for PollShiftStateEvent}
-   altNumActive   : boolean;            {for alt+0..9}
-   altNumBuffer   : string [3];
-   { used for keyboard specific stuff }
-   KeyBoardLayout : HKL;
-
-procedure incqueueindex(var l : longint);
-
-  begin
-     inc(l);
-     { wrap around? }
-     if l>maxqueuesize then
-       l:=0;
-  end;
-
-function keyEventsInQueue : boolean;
-begin
-  keyEventsInQueue := (nextkeyevent <> nextfreekeyevent);
-end;
-
-
-{ gets or peeks the next key from the queue, does not wait for new keys }
-function getKeyEventFromQueue (VAR t : TKeyEventRecord; Peek : boolean) : boolean;
-begin
-  EnterCriticalSection (lockVar);
-  if keyEventsInQueue then
-  begin
-    t := keyboardeventqueue[nextkeyevent];
-    if not peek then incqueueindex (nextkeyevent);
-    getKeyEventFromQueue := true;
-    if not keyEventsInQueue then ResetEvent (newKeyEvent);
-  end else
-  begin
-    getKeyEventFromQueue := false;
-    ResetEvent (newKeyEvent);
-  end;
-  LeaveCriticalSection (lockVar);
-end;
-
-
-{ gets the next key from the queue, does wait for new keys }
-function getKeyEventFromQueueWait (VAR t : TKeyEventRecord) : boolean;
-begin
-  WaitForSingleObject (newKeyEvent, INFINITE);
-  getKeyEventFromQueueWait := getKeyEventFromQueue (t, false);
-end;
-
-{ translate win32 shift-state to keyboard shift state }
-function transShiftState (ControlKeyState : dword) : byte;
-var b : byte;
-begin
-  b := 0;
-  if ControlKeyState and SHIFT_PRESSED <> 0 then  { win32 makes no difference between left and right shift }
-    b := b or kbShift;
-  if (ControlKeyState and LEFT_CTRL_PRESSED <> 0) or
-     (ControlKeyState  and RIGHT_CTRL_PRESSED <> 0) then
-    b := b or kbCtrl;
-  if (ControlKeyState and LEFT_ALT_PRESSED <> 0) or
-     (ControlKeyState and RIGHT_ALT_PRESSED <> 0) then
-    b := b or kbAlt;
-  transShiftState := b;
-end;
-
-{ The event-Handler thread from the unit event will call us if a key-event
-  is available }
-
-procedure HandleKeyboard;
-var
-   ir     : INPUT_RECORD;
-   dwRead : DWord;
-   i      : longint;
-   c      : word;
-   addThis: boolean;
-begin
-   dwRead:=1;
-   ReadConsoleInput(TextRec(Input).Handle,ir,1,dwRead);
-   if (dwRead=1) and (ir.EventType=KEY_EVENT) then
-     begin
-         with ir.KeyEvent do
-           begin
-              { key up events are ignored (except alt) }
-              if bKeyDown then
-                begin
-                   EnterCriticalSection (lockVar);
-                   for i:=1 to wRepeatCount do
-                     begin
-                        addThis := true;
-                        if (dwControlKeyState and LEFT_ALT_PRESSED <> 0) or
-                           (dwControlKeyState and RIGHT_ALT_PRESSED <> 0) then            {alt pressed}
-                          if (wVirtualKeyCode >= $60) and (wVirtualKeyCode <= $69) then   {0..9 on NumBlock}
-                          begin
-                            if length (altNumBuffer) = 3 then
-                              delete (altNumBuffer,1,1);
-                            altNumBuffer := altNumBuffer + char (wVirtualKeyCode-48);
-                            altNumActive   := true;
-                            addThis := false;
-                          end else
-                          begin
-                            altNumActive   := false;
-                            altNumBuffer   := '';
-                          end;
-                        if addThis then
-                        begin
-                          keyboardeventqueue[nextfreekeyevent]:=
-                            ir.KeyEvent;
-                          incqueueindex(nextfreekeyevent);
-                        end;
-                     end;
-
-                   lastShiftState := transShiftState (dwControlKeyState);  {save it for PollShiftStateEvent}
-                   SetEvent (newKeyEvent);             {event that a new key is available}
-                   LeaveCriticalSection (lockVar);
-                end else
-                begin
-                  lastShiftState := transShiftState (dwControlKeyState);   {save it for PollShiftStateEvent}
-                  {for alt-number we have to look for alt-key release}
-                  if altNumActive then
-                    if (wVirtualKeyCode = $12) then    {alt-released}
-                    begin
-                      if altNumBuffer <> '' then       {numbers with alt pressed?}
-                      begin
-                        Val (altNumBuffer, c, i);
-                        if (i = 0) and (c <= 255) then {valid number?}
-                        begin                          {add to queue}
-                          fillchar (ir, sizeof (ir), 0);
-                          bKeyDown := true;
-                          AsciiChar := char (c);
-                                                       {and add to queue}
-                          EnterCriticalSection (lockVar);
-                          keyboardeventqueue[nextfreekeyevent]:=
-                            ir.KeyEvent;
-                          incqueueindex(nextfreekeyevent);
-                          SetEvent (newKeyEvent);      {event that a new key is available}
-                          LeaveCriticalSection (lockVar);
-                        end;
-                      end;
-                      altNumActive   := false;         {clear alt-buffer}
-                      altNumBuffer   := '';
-                    end;
-                end;
-           end;
-     end;
-end;
-
-procedure InitKeyboard;
-begin
-   if KeyboardActive then
-     exit;
-   KeyBoardLayout:=GetKeyboardLayout(0);
-   lastShiftState := 0;
-   FlushConsoleInputBuffer(TextRec(Input).Handle);
-   newKeyEvent := CreateEvent (nil,        // address of security attributes
-                               true,       // flag for manual-reset event
-                               false,      // flag for initial state
-                               nil);       // address of event-object name
-   if newKeyEvent = INVALID_HANDLE_VALUE then
-   begin
-     // what to do here ????
-     RunError (217);
-   end;
-   InitializeCriticalSection (lockVar);
-   altNumActive := false;
-   altNumBuffer := '';
-
-   nextkeyevent:=0;
-   nextfreekeyevent:=0;
-   SetKeyboardEventHandler (@HandleKeyboard);
-   KeyboardActive:=true;
-end;
-
-procedure DoneKeyboard;
-begin
-   if not KeyboardActive then
-     exit;
-   SetKeyboardEventHandler(nil);     {hangs???}
-   DeleteCriticalSection (lockVar);
-   FlushConsoleInputBuffer(TextRec(Input).Handle);
-   closeHandle (newKeyEvent);
-   KeyboardActive:=false;
-end;
-
-{$define USEKEYCODES}
-
-{Translatetable Win32 -> Dos for Special Keys = Function Key, Cursor Keys
- and Keys other than numbers on numblock (to make fv happy) }
-{combinations under dos: Shift+Ctrl: same as Ctrl
-                         Shift+Alt : same as alt
-                         Ctrl+Alt  : nothing (here we get it like alt)}
-{$ifdef USEKEYCODES}
-   { use positive values for ScanCode we want to set
-   0 for key where we should leave the scancode
-   -1 for OEM specifc keys
-   -2 for unassigned
-   -3 for Kanji systems ???
-   }
-const
-  Unassigned = -2;
-  Kanji = -3;
-  OEM_specific = -1;
-  KeyToQwertyScan : array [0..255] of integer =
-  (
-  { 00 } 0,
-  { 01 VK_LBUTTON } 0,
-  { 02 VK_RBUTTON } 0,
-  { 03 VK_CANCEL } 0,
-  { 04 VK_MBUTTON } 0,
-  { 05 unassigned } -2,
-  { 06 unassigned } -2,
-  { 07 unassigned } -2,
-  { 08 VK_BACK } $E,
-  { 09 VK_TAB } $F,
-  { 0A unassigned } -2,
-  { 0B unassigned } -2,
-  { 0C VK_CLEAR ?? } 0,
-  { 0D VK_RETURN } 0,
-  { 0E unassigned } -2,
-  { 0F unassigned } -2,
-  { 10 VK_SHIFT } 0,
-  { 11 VK_CONTROL } 0,
-  { 12 VK_MENU (Alt key) } 0,
-  { 13 VK_PAUSE } 0,
-  { 14 VK_CAPITAL (Caps Lock) } 0,
-  { 15 Reserved for Kanji systems} -3,
-  { 16 Reserved for Kanji systems} -3,
-  { 17 Reserved for Kanji systems} -3,
-  { 18 Reserved for Kanji systems} -3,
-  { 19 Reserved for Kanji systems} -3,
-  { 1A unassigned } -2,
-  { 1B VK_ESCAPE } $1,
-  { 1C Reserved for Kanji systems} -3,
-  { 1D Reserved for Kanji systems} -3,
-  { 1E Reserved for Kanji systems} -3,
-  { 1F Reserved for Kanji systems} -3,
-  { 20 VK_SPACE} 0,
-  { 21 VK_PRIOR (PgUp) } 0,
-  { 22 VK_NEXT (PgDown) } 0,
-  { 23 VK_END } 0,
-  { 24 VK_HOME } 0,
-  { 25 VK_LEFT } 0,
-  { 26 VK_UP } 0,
-  { 27 VK_RIGHT } 0,
-  { 28 VK_DOWN } 0,
-  { 29 VK_SELECT ??? } 0,
-  { 2A OEM specific !! } -1,
-  { 2B VK_EXECUTE } 0,
-  { 2C VK_SNAPSHOT } 0,
-  { 2D VK_INSERT } 0,
-  { 2E VK_DELETE } 0,
-  { 2F VK_HELP } 0,
-  { 30 VK_0 '0' } 11,
-  { 31 VK_1 '1' } 2,
-  { 32 VK_2 '2' } 3,
-  { 33 VK_3 '3' } 4,
-  { 34 VK_4 '4' } 5,
-  { 35 VK_5 '5' } 6,
-  { 36 VK_6 '6' } 7,
-  { 37 VK_7 '7' } 8,
-  { 38 VK_8 '8' } 9,
-  { 39 VK_9 '9' } 10,
-  { 3A unassigned } -2,
-  { 3B unassigned } -2,
-  { 3C unassigned } -2,
-  { 3D unassigned } -2,
-  { 3E unassigned } -2,
-  { 3F unassigned } -2,
-  { 40 unassigned } -2,
-  { 41 VK_A 'A' } $1E,
-  { 42 VK_B 'B' } $30,
-  { 43 VK_C 'C' } $2E,
-  { 44 VK_D 'D' } $20,
-  { 45 VK_E 'E' } $12,
-  { 46 VK_F 'F' } $21,
-  { 47 VK_G 'G' } $22,
-  { 48 VK_H 'H' } $23,
-  { 49 VK_I 'I' } $17,
-  { 4A VK_J 'J' } $24,
-  { 4B VK_K 'K' } $25,
-  { 4C VK_L 'L' } $26,
-  { 4D VK_M 'M' } $32,
-  { 4E VK_N 'N' } $31,
-  { 4F VK_O 'O' } $18,
-  { 50 VK_P 'P' } $19,
-  { 51 VK_Q 'Q' } $10,
-  { 52 VK_R 'R' } $13,
-  { 53 VK_S 'S' } $1F,
-  { 54 VK_T 'T' } $14,
-  { 55 VK_U 'U' } $16,
-  { 56 VK_V 'V' } $2F,
-  { 57 VK_W 'W' } $11,
-  { 58 VK_X 'X' } $2D,
-  { 59 VK_Y 'Y' } $15,
-  { 5A VK_Z 'Z' } $2C,
-  { 5B unassigned } -2,
-  { 5C unassigned } -2,
-  { 5D unassigned } -2,
-  { 5E unassigned } -2,
-  { 5F unassigned } -2,
-  { 60 VK_NUMPAD0 NumKeyPad '0' } 11,
-  { 61 VK_NUMPAD1 NumKeyPad '1' } 2,
-  { 62 VK_NUMPAD2 NumKeyPad '2' } 3,
-  { 63 VK_NUMPAD3 NumKeyPad '3' } 4,
-  { 64 VK_NUMPAD4 NumKeyPad '4' } 5,
-  { 65 VK_NUMPAD5 NumKeyPad '5' } 6,
-  { 66 VK_NUMPAD6 NumKeyPad '6' } 7,
-  { 67 VK_NUMPAD7 NumKeyPad '7' } 8,
-  { 68 VK_NUMPAD8 NumKeyPad '8' } 9,
-  { 69 VK_NUMPAD9 NumKeyPad '9' } 10,
-  { 6A VK_MULTIPLY } 0,
-  { 6B VK_ADD } 0,
-  { 6C VK_SEPARATOR } 0,
-  { 6D VK_SUBSTRACT } 0,
-  { 6E VK_DECIMAL } 0,
-  { 6F VK_DIVIDE } 0,
-  { 70 VK_F1 'F1' } $3B,
-  { 71 VK_F2 'F2' } $3C,
-  { 72 VK_F3 'F3' } $3D,
-  { 73 VK_F4 'F4' } $3E,
-  { 74 VK_F5 'F5' } $3F,
-  { 75 VK_F6 'F6' } $40,
-  { 76 VK_F7 'F7' } $41,
-  { 77 VK_F8 'F8' } $42,
-  { 78 VK_F9 'F9' } $43,
-  { 79 VK_F10 'F10' } $44,
-  { 7A VK_F11 'F11' } $57,
-  { 7B VK_F12 'F12' } $58,
-  { 7C VK_F13 } 0,
-  { 7D VK_F14 } 0,
-  { 7E VK_F15 } 0,
-  { 7F VK_F16 } 0,
-  { 80 VK_F17 } 0,
-  { 81 VK_F18 } 0,
-  { 82 VK_F19 } 0,
-  { 83 VK_F20 } 0,
-  { 84 VK_F21 } 0,
-  { 85 VK_F22 } 0,
-  { 86 VK_F23 } 0,
-  { 87 VK_F24 } 0,
-  { 88 unassigned } -2,
-  { 89 VK_NUMLOCK } 0,
-  { 8A VK_SCROLL } 0,
-  { 8B unassigned } -2,
-  { 8C unassigned } -2,
-  { 8D unassigned } -2,
-  { 8E unassigned } -2,
-  { 8F unassigned } -2,
-  { 90 unassigned } -2,
-  { 91 unassigned } -2,
-  { 92 unassigned } -2,
-  { 93 unassigned } -2,
-  { 94 unassigned } -2,
-  { 95 unassigned } -2,
-  { 96 unassigned } -2,
-  { 97 unassigned } -2,
-  { 98 unassigned } -2,
-  { 99 unassigned } -2,
-  { 9A unassigned } -2,
-  { 9B unassigned } -2,
-  { 9C unassigned } -2,
-  { 9D unassigned } -2,
-  { 9E unassigned } -2,
-  { 9F unassigned } -2,
-  { A0 unassigned } -2,
-  { A1 unassigned } -2,
-  { A2 unassigned } -2,
-  { A3 unassigned } -2,
-  { A4 unassigned } -2,
-  { A5 unassigned } -2,
-  { A6 unassigned } -2,
-  { A7 unassigned } -2,
-  { A8 unassigned } -2,
-  { A9 unassigned } -2,
-  { AA unassigned } -2,
-  { AB unassigned } -2,
-  { AC unassigned } -2,
-  { AD unassigned } -2,
-  { AE unassigned } -2,
-  { AF unassigned } -2,
-  { B0 unassigned } -2,
-  { B1 unassigned } -2,
-  { B2 unassigned } -2,
-  { B3 unassigned } -2,
-  { B4 unassigned } -2,
-  { B5 unassigned } -2,
-  { B6 unassigned } -2,
-  { B7 unassigned } -2,
-  { B8 unassigned } -2,
-  { B9 unassigned } -2,
-  { BA OEM specific } 0,
-  { BB OEM specific } 0,
-  { BC OEM specific } 0,
-  { BD OEM specific } 0,
-  { BE OEM specific } 0,
-  { BF OEM specific } 0,
-  { C0 OEM specific } 0,
-  { C1 unassigned } -2,
-  { C2 unassigned } -2,
-  { C3 unassigned } -2,
-  { C4 unassigned } -2,
-  { C5 unassigned } -2,
-  { C6 unassigned } -2,
-  { C7 unassigned } -2,
-  { C8 unassigned } -2,
-  { C9 unassigned } -2,
-  { CA unassigned } -2,
-  { CB unassigned } -2,
-  { CC unassigned } -2,
-  { CD unassigned } -2,
-  { CE unassigned } -2,
-  { CF unassigned } -2,
-  { D0 unassigned } -2,
-  { D1 unassigned } -2,
-  { D2 unassigned } -2,
-  { D3 unassigned } -2,
-  { D4 unassigned } -2,
-  { D5 unassigned } -2,
-  { D6 unassigned } -2,
-  { D7 unassigned } -2,
-  { D8 unassigned } -2,
-  { D9 unassigned } -2,
-  { DA unassigned } -2,
-  { DB OEM specific } 0,
-  { DC OEM specific } 0,
-  { DD OEM specific } 0,
-  { DE OEM specific } 0,
-  { DF OEM specific } 0,
-  { E0 OEM specific } 0,
-  { E1 OEM specific } 0,
-  { E2 OEM specific } 0,
-  { E3 OEM specific } 0,
-  { E4 OEM specific } 0,
-  { E5 unassigned } -2,
-  { E6 OEM specific } 0,
-  { E7 unassigned } -2,
-  { E8 unassigned } -2,
-  { E9 OEM specific } 0,
-  { EA OEM specific } 0,
-  { EB OEM specific } 0,
-  { EC OEM specific } 0,
-  { ED OEM specific } 0,
-  { EE OEM specific } 0,
-  { EF OEM specific } 0,
-  { F0 OEM specific } 0,
-  { F1 OEM specific } 0,
-  { F2 OEM specific } 0,
-  { F3 OEM specific } 0,
-  { F4 OEM specific } 0,
-  { F5 OEM specific } 0,
-  { F6 unassigned } -2,
-  { F7 unassigned } -2,
-  { F8 unassigned } -2,
-  { F9 unassigned } -2,
-  { FA unassigned } -2,
-  { FB unassigned } -2,
-  { FC unassigned } -2,
-  { FD unassigned } -2,
-  { FE unassigned } -2,
-  { FF unassigned } -2
-  );
-{$endif  USEKEYCODES}
-type TTEntryT = packed record
-                  n,s,c,a : byte;   {normal,shift, ctrl, alt, normal only for f11,f12}
-                end;
-
-CONST
- DosTT : ARRAY [$3B..$58] OF TTEntryT =
-  ((n : $3B; s : $54; c : $5E; a: $68),      {3B F1}
-   (n : $3C; s : $55; c : $5F; a: $69),      {3C F2}
-   (n : $3D; s : $56; c : $60; a: $6A),      {3D F3}
-   (n : $3E; s : $57; c : $61; a: $6B),      {3E F4}
-   (n : $3F; s : $58; c : $62; a: $6C),      {3F F5}
-   (n : $40; s : $59; c : $63; a: $6D),      {40 F6}
-   (n : $41; s : $5A; c : $64; a: $6E),      {41 F7}
-   (n : $42; s : $5B; c : $65; a: $6F),      {42 F8}
-   (n : $43; s : $5C; c : $66; a: $70),      {43 F9}
-   (n : $44; s : $5D; c : $67; a: $71),      {44 F10}
-   (n : $45; s : $00; c : $00; a: $00),      {45 ???}
-   (n : $46; s : $00; c : $00; a: $00),      {46 ???}
-   (n : $47; s : $47; c : $77; a: $97),      {47 Home}
-   (n : $48; s : $00; c : $8D; a: $98),      {48 Up}
-   (n : $49; s : $49; c : $84; a: $99),      {49 PgUp}
-   (n : $4A; s : $00; c : $8E; a: $4A),      {4A -}
-   (n : $4B; s : $4B; c : $73; a: $9B),      {4B Left}
-   (n : $4C; s : $00; c : $00; a: $00),      {4C ???}
-   (n : $4D; s : $4D; c : $74; a: $9D),      {4D Right}
-   (n : $4E; s : $00; c : $90; a: $4E),      {4E +}
-   (n : $4F; s : $4F; c : $75; a: $9F),      {4F End}
-   (n : $50; s : $50; c : $91; a: $A0),      {50 Down}
-   (n : $51; s : $51; c : $76; a: $A1),      {51 PgDown}
-   (n : $52; s : $52; c : $92; a: $A2),      {52 Insert}
-   (n : $53; s : $53; c : $93; a: $A3),      {53 Del}
-   (n : $54; s : $00; c : $00; a: $00),      {54 ???}
-   (n : $55; s : $00; c : $00; a: $00),      {55 ???}
-   (n : $56; s : $00; c : $00; a: $00),      {56 ???}
-   (n : $85; s : $87; c : $89; a: $8B),      {57 F11}
-   (n : $86; s : $88; c : $8A; a: $8C));     {58 F12}
-
- DosTT09 : ARRAY [$02..$0F] OF TTEntryT =
-  ((n : $00; s : $00; c : $00; a: $78),      {02 1 }
-   (n : $00; s : $00; c : $00; a: $79),      {03 2 }
-   (n : $00; s : $00; c : $00; a: $7A),      {04 3 }
-   (n : $00; s : $00; c : $00; a: $7B),      {05 4 }
-   (n : $00; s : $00; c : $00; a: $7C),      {06 5 }
-   (n : $00; s : $00; c : $00; a: $7D),      {07 6 }
-   (n : $00; s : $00; c : $00; a: $7E),      {08 7 }
-   (n : $00; s : $00; c : $00; a: $7F),      {09 8 }
-   (n : $00; s : $00; c : $00; a: $80),      {0A 9 }
-   (n : $00; s : $00; c : $00; a: $81),      {0B 0 }
-   (n : $00; s : $00; c : $00; a: $82),      {0C ß }
-   (n : $00; s : $00; c : $00; a: $00),      {0D}
-   (n : $00; s : $09; c : $00; a: $00),      {0E Backspace}
-   (n : $00; s : $0F; c : $94; a: $00));     {0F Tab }
-
-
-function translateKey (t : TKeyEventRecord) : TKeyEvent;
-var key : TKeyEvent;
-    ss  : byte;
-{$ifdef  USEKEYCODES}
-    ScanCode  : byte;
-{$endif  USEKEYCODES}
-    b   : byte;
-begin
-  Key := 0;
-  if t.bKeyDown then
-  begin
-    { ascii-char is <> 0 if not a specal key }
-    { we return it here otherwise we have to translate more later }
-    if t.AsciiChar <> #0 then
-    begin
-      {drivers needs scancode, we return it here as under dos and linux
-       with $03000000 = the lowest two bytes is the physical representation}
-{$ifdef  USEKEYCODES}
-      Scancode:=KeyToQwertyScan[t.wVirtualKeyCode AND $00FF];
-      If ScanCode>0 then
-        t.wVirtualScanCode:=ScanCode;
-      Key := byte (t.AsciiChar) + (t.wVirtualScanCode shl 8) + $03000000;
-      ss := transShiftState (t.dwControlKeyState);
-      key := key or (ss shl 16);
-      if (ss and kbAlt <> 0) and (t.dwControlKeyState and RIGHT_ALT_PRESSED = 0) then
-        key := key and $FFFFFF00;
-{$else not USEKEYCODES}
-      Key := byte (t.AsciiChar) + ((t.wVirtualScanCode AND $00FF) shl 8) + $03000000;
-{$endif not USEKEYCODES}
-    end else
-    begin
-{$ifdef  USEKEYCODES}
-      Scancode:=KeyToQwertyScan[t.wVirtualKeyCode AND $00FF];
-      If ScanCode>0 then
-        t.wVirtualScanCode:=ScanCode;
-{$endif not USEKEYCODES}
-      translateKey := 0;
-      { ignore shift,ctrl,alt,numlock,capslock alone }
-      case t.wVirtualKeyCode of
-        $0010,         {shift}
-        $0011,         {ctrl}
-        $0012,         {alt}
-        $0014,         {capslock}
-        $0090,         {numlock}
-        $0091,         {scrollock}
-        { This should be handled !! }
-        { these last two are OEM specific
-          this is not good !!! }
-        $00DC,         {^ : next key i.e. a is modified }
-        { Strange on my keyboard this corresponds to double point over i or u PM }
-        $00DD: exit;   {´ and ` : next key i.e. e is modified }
-      end;
-
-      key := $03000000 + (t.wVirtualScanCode shl 8);  { make lower 8 bit=0 like under dos }
-    end;
-    { Handling of ~ key as AltGr 2 }
-    { This is also French keyboard specific !! }
-    { but without this I can not get a ~ !! PM }
-    if (t.wVirtualKeyCode=$32) and
-       (KeyBoardLayout = FrenchKeyboard) and
-       (t.dwControlKeyState and RIGHT_ALT_PRESSED <> 0) then
-      key:=(key and $ffffff00) or ord('~');
-    { ok, now add Shift-State }
-    ss := transShiftState (t.dwControlKeyState);
-    key := key or (ss shl 16);
-
-    { Reset Ascii-Char if Alt+Key, fv needs that, may be we
-      need it for other special keys too
-      18 Sept 1999 AD: not for right Alt i.e. for AltGr+ß = \ on german keyboard }
-    if ((ss and kbAlt <> 0) and (t.dwControlKeyState and RIGHT_ALT_PRESSED = 0)) or
-    (*
-      { yes, we need it for cursor keys, 25=left, 26=up, 27=right,28=down}
-      {aggg, this will not work because esc is also virtualKeyCode 27!!}
-      {if (t.wVirtualKeyCode >= 25) and (t.wVirtualKeyCode <= 28) then}
-        no VK_ESCAPE is $1B !!
-        there was a mistake :
-         VK_LEFT is $25 not 25 !! *)
-       { not $2E VK_DELETE because its only the Keypad point !! PM }
-      (t.wVirtualKeyCode in [$21..$28,$2C,$2D,$2F]) then
-      { if t.wVirtualScanCode in [$47..$49,$4b,$4d,$4f,$50..$53] then}
-        key := key and $FFFFFF00;
-
-    {and translate to dos-scancodes to make fv happy, we will convert this
-     back in translateKeyEvent}
-
-     if (t.dwControlKeyState and RIGHT_ALT_PRESSED) = 0 then {not for alt-gr}
-     if (t.wVirtualScanCode >= low (DosTT)) and
-        (t.wVirtualScanCode <= high (dosTT)) then
-     begin
-       b := 0;
-       if (ss and kbAlt) <> 0 then
-         b := DosTT[t.wVirtualScanCode].a
-       else
-       if (ss and kbCtrl) <> 0 then
-         b := DosTT[t.wVirtualScanCode].c
-       else
-       if (ss and kbShift) <> 0 then
-         b := DosTT[t.wVirtualScanCode].s
-       else
-         b := DosTT[t.wVirtualScanCode].n;
-       if b <> 0 then
-         key := (key and $FFFF00FF) or (longint (b) shl 8);
-     end;
-
-     {Alt-0 to Alt-9}
-     if (t.dwControlKeyState and RIGHT_ALT_PRESSED) = 0 then {not for alt-gr}
-       if (t.wVirtualScanCode >= low (DosTT09)) and
-          (t.wVirtualScanCode <= high (dosTT09)) then
-       begin
-         b := 0;
-         if (ss and kbAlt) <> 0 then
-           b := DosTT09[t.wVirtualScanCode].a
-         else
-         if (ss and kbCtrl) <> 0 then
-           b := DosTT09[t.wVirtualScanCode].c
-         else
-         if (ss and kbShift) <> 0 then
-           b := DosTT09[t.wVirtualScanCode].s
-         else
-           b := DosTT09[t.wVirtualScanCode].n;
-         if b <> 0 then
-           key := (key and $FFFF0000) or (longint (b) shl 8);
-       end;
-
-     TranslateKey := key;
-  end;
-  translateKey := Key;
-end;
-
-function GetKeyEvent: TKeyEvent;
-var t   : TKeyEventRecord;
-    key : TKeyEvent;
-begin
-  if PendingKeyEvent<>0 then
-  begin
-    GetKeyEvent:=PendingKeyEvent;
-    PendingKeyEvent:=0;
-    exit;
-  end;
-  key := 0;
-  repeat
-     if getKeyEventFromQueueWait (t) then
-       key := translateKey (t);
-  until key <> 0;
-{$ifdef DEBUG}
-  last_ir.KeyEvent:=t;
-{$endif DEBUG}
-  GetKeyEvent := key;
-end;
-
-function PollKeyEvent: TKeyEvent;
-var t   : TKeyEventRecord;
-    k   : TKeyEvent;
-begin
-  if PendingKeyEvent<>0 then
-    exit(PendingKeyEvent);
-  PollKeyEvent := 0;
-  if getKeyEventFromQueue (t, true) then
-  begin
-    { we get an enty for shift, ctrl, alt... }
-    k := translateKey (t);
-    while (k = 0) do
-    begin
-      getKeyEventFromQueue (t, false);  {remove it}
-      if not getKeyEventFromQueue (t, true) then exit;
-      k := translateKey (t)
-    end;
-    PollKeyEvent := k;
-  end;
-end;
-
-
-function TranslateKeyEvent(KeyEvent: TKeyEvent): TKeyEvent;
-begin
-  if KeyEvent and $03000000 = $03000000 then
-   begin
-     if KeyEvent and $000000FF <> 0 then
-     begin
-       TranslateKeyEvent := KeyEvent and $00FFFFFF;
-       exit;
-     end;
-     {translate function-keys and other specials, ascii-codes are already ok}
-     case (KeyEvent AND $0000FF00) shr 8 of
-       {F1..F10}
-       $3B..$44     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF1 + ((KeyEvent AND $0000FF00) SHR 8) - $3B + $02000000;
-       {F11,F12}
-       $85..$86     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF11 + ((KeyEvent AND $0000FF00) SHR 8) - $85 + $02000000;
-       {Shift F1..F10}
-       $54..$5D     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF1 + ((KeyEvent AND $0000FF00) SHR 8) - $54 + $02000000;
-       {Shift F11,F12}
-       $87..$88     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF11 + ((KeyEvent AND $0000FF00) SHR 8) - $87 + $02000000;
-       {Alt F1..F10}
-       $68..$71     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF1 + ((KeyEvent AND $0000FF00) SHR 8) - $68 + $02000000;
-       {Alt F11,F12}
-       $8B..$8C     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF11 + ((KeyEvent AND $0000FF00) SHR 8) - $8B + $02000000;
-       {Ctrl F1..F10}
-       $5E..$67     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF1 + ((KeyEvent AND $0000FF00) SHR 8) - $5E + $02000000;
-       {Ctrl F11,F12}
-       $89..$8A     : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdF11 + ((KeyEvent AND $0000FF00) SHR 8) - $89 + $02000000;
-
-       {normal,ctrl,alt}
-       $47,$77,$97  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdHome + $02000000;
-       $48,$8D,$98  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdUp + $02000000;
-       $49,$84,$99  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdPgUp + $02000000;
-       $4b,$73,$9B  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdLeft + $02000000;
-       $4d,$74,$9D  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdRight + $02000000;
-       $4f,$75,$9F  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdEnd + $02000000;
-       $50,$91,$A0  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdDown + $02000000;
-       $51,$76,$A1  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdPgDn + $02000000;
-       $52,$92,$A2  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdInsert + $02000000;
-       $53,$93,$A3  : TranslateKeyEvent := (KeyEvent AND $FCFF0000) + kbdDelete + $02000000;
-     else
-       TranslateKeyEvent := KeyEvent;
-     end;
-   end else
-     TranslateKeyEvent := KeyEvent;
-end;
-
-function TranslateKeyEventUniCode(KeyEvent: TKeyEvent): TKeyEvent;
-begin
-  exit (KeyEvent);  {???}
-end;
-
-function PollShiftStateEvent: TKeyEvent;
-var t : TKeyEvent;
-begin
-  {may be better to save the last state and return that if no key is in buffer???}
-  t := lastShiftState;
-  PollShiftStateEvent := t shl 16;
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:27  michael
-  + removed logs
- 
-}

+ 0 - 210
api/win32/mouse.inc

@@ -1,210 +0,0 @@
-{
-   $Id$
-   System independent mouse interface for win32
-
-   Copyright (c) 1999 by Florian Klaempfl
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-}
-
-uses
-   windows,dos,event;
-
-var
-   ChangeMouseEvents : TCriticalSection;
-Const
-  MouseEventActive : Boolean = false;
-
-procedure MouseEventHandler;
-
-  var
-     ir : INPUT_RECORD;
-     dwRead : DWord;
-     i: longint;
-     e : TMouseEvent;
-
-  begin
-     ReadConsoleInput(TextRec(Input).Handle,ir,1,dwRead);
-     if (dwRead=1) and (ir.EventType=_MOUSE_EVENT) then
-       begin
-          EnterCriticalSection(ChangeMouseEvents);
-          e.x:=ir.MouseEvent.dwMousePosition.x;
-          e.y:=ir.MouseEvent.dwMousePosition.y;
-          e.buttons:=0;
-          e.action:=0;
-          if (ir.MouseEvent.dwButtonState and FROM_LEFT_1ST_BUTTON_PRESSED<>0) then
-            e.buttons:=e.buttons or MouseLeftButton;
-          if (ir.MouseEvent.dwButtonState and FROM_LEFT_2ND_BUTTON_PRESSED<>0) then
-            e.buttons:=e.buttons or MouseMiddleButton;
-          if (ir.MouseEvent.dwButtonState and RIGHTMOST_BUTTON_PRESSED<>0) then
-            e.buttons:=e.buttons or MouseRightButton;
-
-          { can we compress the events? }
-          if (PendingMouseEvents>0) and
-            (e.buttons=PendingMouseTail^.buttons) and
-            (e.action=PendingMouseTail^.action) then
-            begin
-               PendingMouseTail^.x:=e.x;
-               PendingMouseTail^.y:=e.y;
-            end
-          else
-            begin
-               PutMouseEvent(e);
-               // this should be done in PutMouseEvent
-               inc(PendingMouseEvents);
-            end;
-          LeaveCriticalSection(ChangeMouseEvents);
-       end;
-  end;
-
-procedure InitMouse;
-
-var
-   mode : dword;
-
-begin
-  if MouseEventActive then
-    exit;
-  // enable mouse events
-  GetConsoleMode(TextRec(Input).Handle,@mode);
-  mode:=mode or ENABLE_MOUSE_INPUT;
-  SetConsoleMode(TextRec(Input).Handle,mode);
-
-  PendingMouseHead:=@PendingMouseEvent;
-  PendingMouseTail:=@PendingMouseEvent;
-  PendingMouseEvents:=0;
-  FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
-  InitializeCriticalSection(ChangeMouseEvents);
-  SetMouseEventHandler(@MouseEventHandler);
-  ShowMouse;
-  MouseEventActive:=true;
-end;
-
-
-procedure DoneMouse;
-var
-   mode : dword;
-begin
-  if not MouseEventActive then
-    exit;
-  HideMouse;
-  // disable mouse events
-  GetConsoleMode(TextRec(Input).Handle,@mode);
-  mode:=mode and (not ENABLE_MOUSE_INPUT);
-  SetConsoleMode(TextRec(Input).Handle,mode);
-
-  SetMouseEventHandler(nil);
-  DeleteCriticalSection(ChangeMouseEvents);
-  MouseEventActive:=false;
-end;
-
-
-function DetectMouse:byte;
-var
-  num : dword;
-begin
-  GetNumberOfConsoleMouseButtons(@num);
-  DetectMouse:=num;
-end;
-
-
-procedure ShowMouse;
-begin
-end;
-
-
-procedure HideMouse;
-begin
-end;
-
-
-function GetMouseX:word;
-begin
-  GetMouseX:=0;
-end;
-
-
-function GetMouseY:word;
-begin
-  GetMouseY:=0;
-end;
-
-
-function GetMouseButtons:word;
-begin
-  GetMouseButtons:=0;
-end;
-
-
-procedure SetMouseXY(x,y:word);
-begin
-end;
-
-
-procedure GetMouseEvent(var MouseEvent: TMouseEvent);
-
-var
-   b : byte;
-
-begin
-  repeat
-    EnterCriticalSection(ChangeMouseEvents);
-    b:=PendingMouseEvents;
-    LeaveCriticalSection(ChangeMouseEvents);
-    if b>0 then
-      break
-    else
-      sleep(50);
-  until false;
-  EnterCriticalSection(ChangeMouseEvents);
-  MouseEvent:=PendingMouseHead^;
-  inc(PendingMouseHead);
-  if longint(PendingMouseHead)=longint(@PendingMouseEvent)+sizeof(PendingMouseEvent) then
-   PendingMouseHead:=@PendingMouseEvent;
-  dec(PendingMouseEvents);
-  if (LastMouseEvent.x<>MouseEvent.x) or (LastMouseEvent.y<>MouseEvent.y) then
-   MouseEvent.Action:=MouseActionMove;
-  if (LastMouseEvent.Buttons<>MouseEvent.Buttons) then
-   begin
-     if (LastMouseEvent.Buttons=0) then
-      MouseEvent.Action:=MouseActionDown
-     else
-      MouseEvent.Action:=MouseActionUp;
-   end;
-  LastMouseEvent:=MouseEvent;
-  LeaveCriticalSection(ChangeMouseEvents);
-end;
-
-
-function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
-begin
-  EnterCriticalSection(ChangeMouseEvents);
-  if PendingMouseEvents>0 then
-   begin
-     MouseEvent:=PendingMouseHead^;
-     PollMouseEvent:=true;
-   end
-  else
-   PollMouseEvent:=false;
-  LeaveCriticalSection(ChangeMouseEvents);
-end;
-
-{
-  $Log$
-  Revision 1.2  2000-07-13 11:32:27  michael
-  + removed logs
- 
-}

+ 0 - 364
api/win32/video.inc

@@ -1,364 +0,0 @@
-{
-   $Id$
-   Copyright (c) 1999 by Florian Klaempfl
-
-   System independent low-level video interface for win32
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the Free
-   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-}
-
-
-uses
-  windows,dos;
-
-var
-  OldVideoBuf : PVideoBuf;
-  ConsoleInfo : TConsoleScreenBufferInfo;
-  ConsoleCursorInfo : TConsoleCursorInfo;
-  MaxVideoBufSize : DWord;
-
-procedure InitVideo;
-begin
-  ScreenColor:=true;
-  GetConsoleScreenBufferInfo(TextRec(Output).Handle, ConsoleInfo);
-  GetConsoleCursorInfo(TextRec(Output).Handle, ConsoleCursorInfo);
-
-  with ConsoleInfo.srWindow do
-    begin
-       ScreenWidth:=right-left+1;
-       ScreenHeight:=bottom-top+1;
-    end;
-
-  { srWindow is sometimes bigger then dwMaximumWindowSize
-    this led to wrong ScreenWidth and ScreenHeight values PM }
-  { damned: its also sometimes less !! PM }
-  with ConsoleInfo.dwMaximumWindowSize do
-    begin
-       {if ScreenWidth>X then}
-         ScreenWidth:=X;
-       {if ScreenHeight>Y then}
-         ScreenHeight:=Y;
-    end;
-
-  { TDrawBuffer only has FVMaxWidth elements
-    larger values lead to crashes }
-  if ScreenWidth> FVMaxWidth then
-    ScreenWidth:=FVMaxWidth;
-
-  CursorX:=ConsoleInfo.dwCursorPosition.x;
-  CursorY:=ConsoleInfo.dwCursorPosition.y;
-  if not ConsoleCursorInfo.bvisible then
-    CursorLines:=0
-  else
-    CursorLines:=ConsoleCursorInfo.dwSize;
-
-  { allocate back buffer }
-  MaxVideoBufSize:= ScreenWidth * ScreenHeight * 2;
-  VideoBufSize:=ScreenWidth*ScreenHeight*2;
-
-  GetMem(VideoBuf,MaxVideoBufSize);
-  GetMem(OldVideoBuf,MaxVideoBufSize);
-
-  {ClearScreen; not needed PM }
-end;
-
-
-procedure DoneVideo;
-begin
-  { ClearScreen; also not needed PM }
-  SetCursorType(crUnderLine);
-  { SetCursorPos(0,0); also not needed PM }
-  FreeMem(VideoBuf,MaxVideoBufSize);
-  FreeMem(OldVideoBuf,MaxVideoBufSize);
-  VideoBufSize:=0;
-end;
-
-
-function GetCapabilities: Word;
-begin
-  GetCapabilities:=cpColor or cpChangeCursor;
-end;
-
-
-procedure SetCursorPos(NewCursorX, NewCursorY: Word);
-var
-  pos : COORD;
-begin
-   pos.x:=NewCursorX;
-   pos.y:=NewCursorY;
-   SetConsoleCursorPosition(TextRec(Output).Handle,pos);
-   CursorX:=pos.x;
-   CursorY:=pos.y;
-end;
-
-
-function GetCursorType: Word;
-begin
-   GetConsoleCursorInfo(TextRec(Output).Handle,ConsoleCursorInfo);
-   if not ConsoleCursorInfo.bvisible then
-     GetCursorType:=crHidden
-   else
-     case ConsoleCursorInfo.dwSize of
-        1..30:
-          GetCursorType:=crUnderline;
-        31..70:
-          GetCursorType:=crHalfBlock;
-        71..100:
-          GetCursorType:=crBlock;
-     end;
-end;
-
-
-procedure SetCursorType(NewType: Word);
-begin
-   GetConsoleCursorInfo(TextRec(Output).Handle,ConsoleCursorInfo);
-   if newType=crHidden then
-     ConsoleCursorInfo.bvisible:=false
-   else
-     begin
-        ConsoleCursorInfo.bvisible:=true;
-        case NewType of
-           crUnderline:
-             ConsoleCursorInfo.dwSize:=10;
-
-           crHalfBlock:
-             ConsoleCursorInfo.dwSize:=50;
-
-           crBlock:
-             ConsoleCursorInfo.dwSize:=99;
-        end
-     end;
-   SetConsoleCursorInfo(TextRec(Output).Handle,ConsoleCursorInfo);
-end;
-
-
-function DefaultVideoModeSelector(const VideoMode: TVideoMode; Params: Longint): Boolean;
-begin
-end;
-
-
-procedure ClearScreen;
-begin
-  FillWord(VideoBuf^,VideoBufSize div 2,$0720);
-  UpdateScreen(true);
-end;
-
-
-{$IFDEF FPC}
-function WriteConsoleOutput(hConsoleOutput:HANDLE; lpBuffer:pointer; dwBufferSize:COORD; dwBufferCoord:COORD;
-   var lpWriteRegion:SMALL_RECT):WINBOOL; external 'kernel32' name 'WriteConsoleOutputA';
-{$ENDIF}
-
-procedure UpdateScreen(Force: Boolean);
-type TmpRec = Array[0..(1024*32) - 1] of TCharInfo;
-
-type WordRec = record
-                  One, Two: Byte;
-               end; { wordrec }
-
-var
-   BufSize,
-   BufCoord    : COORD;
-   WriteRegion : SMALL_RECT;
-   LineBuf     : ^TmpRec;
-   BufCounter  : Longint;
-   LineCounter,
-   ColCounter  : Longint;
-   smallforce  : boolean;
-{
-begin
-  if LockUpdateScreen<>0 then
-   exit;
-  if not force then
-   begin
-     asm
-        movl    VideoBuf,%esi
-        movl    OldVideoBuf,%edi
-        movl    VideoBufSize,%ecx
-        shrl    $2,%ecx
-        repe
-        cmpsl
-        orl     %ecx,%ecx
-        jz      .Lno_update
-        movb    $1,force
-.Lno_update:
-     end;
-   end;
-  if Force then
-   begin
-      BufSize.X := ScreenWidth;
-      BufSize.Y := ScreenHeight;
-
-      BufCoord.X := 0;
-      BufCoord.Y := 0;
-      with WriteRegion do
-        begin
-           Top :=0;
-           Left :=0;
-           Bottom := ScreenHeight-1;
-           Right := ScreenWidth-1;
-        end;
-      New(LineBuf);
-      BufCounter := 0;
-
-      for LineCounter := 1 to ScreenHeight do
-        begin
-           for ColCounter := 1 to ScreenWidth do
-             begin
-               LineBuf^[BufCounter].UniCodeChar := WordRec(VideoBuf^[BufCounter]).One;
-               LineBuf^[BufCounter].Attributes := WordRec(VideoBuf^[BufCounter]).Two;
-
-               Inc(BufCounter);
-             end; { for }
-        end; { for }
-
-      WriteConsoleOutput(TextRec(Output).Handle, LineBuf, BufSize, BufCoord, WriteRegion);
-      Dispose(LineBuf);
-
-      move(VideoBuf^,OldVideoBuf^,VideoBufSize);
-   end;
-end;
-}
-var
-   x1,y1,x2,y2 : longint;
-
-begin
-  if LockUpdateScreen<>0 then
-   exit;
-  if force then
-   smallforce:=true
-  else
-   begin
-     asm
-        movl    VideoBuf,%esi
-        movl    OldVideoBuf,%edi
-        movl    VideoBufSize,%ecx
-        shrl    $2,%ecx
-        repe
-        cmpsl
-        orl     %ecx,%ecx
-        jz      .Lno_update
-        movb    $1,smallforce
-.Lno_update:
-     end;
-   end;
-  if SmallForce then
-   begin
-      BufSize.X := ScreenWidth;
-      BufSize.Y := ScreenHeight;
-
-      BufCoord.X := 0;
-      BufCoord.Y := 0;
-      with WriteRegion do
-        begin
-           Top :=0;
-           Left :=0;
-           Bottom := ScreenHeight-1;
-           Right := ScreenWidth-1;
-        end;
-      New(LineBuf);
-      BufCounter := 0;
-      x1:=ScreenWidth+1;
-      x2:=-1;
-      y1:=ScreenHeight+1;
-      y2:=-1;
-      for LineCounter := 1 to ScreenHeight do
-        begin
-           for ColCounter := 1 to ScreenWidth do
-             begin
-               if (WordRec(VideoBuf^[BufCounter]).One<>WordRec(OldVideoBuf^[BufCounter]).One) or
-                 (WordRec(VideoBuf^[BufCounter]).Two<>WordRec(OldVideoBuf^[BufCounter]).Two) then
-                 begin
-                    if ColCounter<x1 then
-                      x1:=ColCounter;
-                    if ColCounter>x2 then
-                      x2:=ColCounter;
-                    if LineCounter<y1 then
-                      y1:=LineCounter;
-                    if LineCounter>y2 then
-                      y2:=LineCounter;
-                 end;
-               LineBuf^[BufCounter].UniCodeChar := WordRec(VideoBuf^[BufCounter]).One;
-               { If (WordRec(VideoBuf^[BufCounter]).Two and $80)<>0 then
-                 LineBuf^[BufCounter].Attributes := $100+WordRec(VideoBuf^[BufCounter]).Two
-               else }
-                 LineBuf^[BufCounter].Attributes := WordRec(VideoBuf^[BufCounter]).Two;
-
-               Inc(BufCounter);
-             end; { for }
-        end; { for }
-      BufSize.X := ScreenWidth;
-      BufSize.Y := ScreenHeight;
-
-      with WriteRegion do
-        begin
-           if force then
-             begin
-               Top := 0;
-               Left :=0;
-               Bottom := ScreenHeight-1;
-               Right := ScreenWidth-1;
-               BufCoord.X := 0;
-               BufCoord.Y := 0;
-             end
-           else
-             begin
-               Top := y1-1;
-               Left :=x1-1;
-               Bottom := y2-1;
-               Right := x2-1;
-               BufCoord.X := x1-1;
-               BufCoord.Y := y1-1;
-             end;
-        end;
-      {
-      writeln('X1: ',x1);
-      writeln('Y1: ',y1);
-      writeln('X2: ',x2);
-      writeln('Y2: ',y2);
-      }
-      WriteConsoleOutput(TextRec(Output).Handle, LineBuf, BufSize, BufCoord, WriteRegion);
-      Dispose(LineBuf);
-
-      move(VideoBuf^,OldVideoBuf^,VideoBufSize);
-   end;
-end;
-
-procedure RegisterVideoModes;
-begin
-  { don't know what to do for win32 (FK) }
-  RegisterVideoMode(80, 25, True, @DefaultVideoModeSelector, $00000003);
-end;
-
-procedure TargetEntry;
-begin
-end;
-
-procedure TargetExit;
-begin
-end;
-
-
-{
-  $Log$
-  Revision 1.4  2000-10-15 09:21:28  peter
-    * FVMaxWidth (merged)
-
-  Revision 1.3  2000/10/04 11:53:32  pierre
-   Add TargetEntry and TargetExit (merged)
-
-  Revision 1.2  2000/07/13 11:32:27  michael
-  + removed logs
-}