Browse Source

* merged freebsd from fixes

peter 25 years ago
parent
commit
a554625890

+ 1275 - 0
api/freebsd/Makefile

@@ -0,0 +1,1275 @@
+#
+# Makefile generated by fpcmake v1.00 [2000/10/27]
+#
+
+defaultrule: all
+
+#####################################################################
+# Autodetect OS (Linux or Dos or Windows NT)
+# define inUnix when running under Unix (Linux,FreeBSD)
+# define inWinNT when running under WinNT
+#####################################################################
+
+# 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
+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
+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 $(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

+ 44 - 0
api/freebsd/Makefile.fpc

@@ -0,0 +1,44 @@
+#
+#   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]
+
+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
+

+ 10 - 6
api/linux/Makefile

@@ -116,6 +116,8 @@ export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
 #####################################################################
 #####################################################################
 
 
 INC=../inc
 INC=../inc
+UNIXINC=../unix
+
 
 
 # Override defaults
 # Override defaults
 override PASEXT=.pas
 override PASEXT=.pas
@@ -192,7 +194,7 @@ endif
 
 
 # Targets
 # Targets
 
 
-override UNITOBJECTS+=terminfo $(APIOBJECTS)
+override UNITOBJECTS+=$(APIOBJECTS) terminfo
 
 
 # Clean
 # Clean
 
 
@@ -209,7 +211,8 @@ ZIPTARGET=install
 # Directories
 # Directories
 
 
 vpath %$(PASEXT) $(INC)
 vpath %$(PASEXT) $(INC)
-override NEEDINCDIR=$(INC)
+override NEEDUNITDIR=$(UNIXINC)
+override NEEDINCDIR=$(INC) $(UNIXINC)
 ifndef TARGETDIR
 ifndef TARGETDIR
 TARGETDIR=.
 TARGETDIR=.
 endif
 endif
@@ -1263,10 +1266,11 @@ endif
 # Users rules
 # Users rules
 #####################################################################
 #####################################################################
 
 
-video$(PPUEXT): $(INC)/video.pas video.inc
 
 
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc
+keyboard$(PPUEXT): $(INC)/keyboard.pas $(UNIXINC)/keyboard.inc 
+
+mouse$(PPUEXT): $(INC)/mouse.pas $(UNIXINC)/mouse.inc 
 
 
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc
+filectrl$(PPUEXT): $(INC)/filectrl.pas $(UNIXINC)/filectrl.inc  
 
 
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc
+video$(PPUEXT): $(INC)/video.pas $(UNIXINC)/video.inc 

+ 10 - 7
api/linux/Makefile.fpc

@@ -6,7 +6,7 @@
 defaulttarget=linux
 defaulttarget=linux
 
 
 [targets]
 [targets]
-units=terminfo $(APIOBJECTS)
+units= $(APIOBJECTS) terminfo
 
 
 [install]
 [install]
 unitsubdir=api
 unitsubdir=api
@@ -20,22 +20,25 @@ libversion=1.0
 fpcdir=../..
 fpcdir=../..
 targetdir=.
 targetdir=.
 sourcesdir=$(INC)
 sourcesdir=$(INC)
-incdir=$(INC)
+incdir=$(INC) $(UNIXINC)
+unitdir=$(UNIXINC)
 
 
 [presettings]
 [presettings]
 INC=../inc
 INC=../inc
+UNIXINC=../unix
+
 
 
 # Override defaults
 # Override defaults
 override PASEXT=.pas
 override PASEXT=.pas
 
 
 include $(INC)/Makefile.api
 include $(INC)/Makefile.api
 
 
-
 [rules]
 [rules]
-video$(PPUEXT): $(INC)/video.pas video.inc
 
 
-keyboard$(PPUEXT): $(INC)/keyboard.pas keyboard.inc
+keyboard$(PPUEXT): $(INC)/keyboard.pas $(UNIXINC)/keyboard.inc 
+
+mouse$(PPUEXT): $(INC)/mouse.pas $(UNIXINC)/mouse.inc 
 
 
-mouse$(PPUEXT): $(INC)/mouse.pas mouse.inc
+filectrl$(PPUEXT): $(INC)/filectrl.pas $(UNIXINC)/filectrl.inc  
 
 
-filectrl$(PPUEXT): $(INC)/filectrl.pas filectrl.inc
+video$(PPUEXT): $(INC)/video.pas $(UNIXINC)/video.inc 

+ 21 - 3
api/linux/filectrl.inc → api/unix/filectrl.inc

@@ -158,7 +158,25 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2000-07-13 11:32:24  michael
-  + removed logs
- 
+  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
+
 }
 }

+ 7 - 1
api/linux/gpm114.pas → api/unix/gpm114.pas

@@ -114,7 +114,13 @@ function Gpm_GetSnapshot(var Event: TGPMEvent): Longint; cdecl;external;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2000-07-13 06:29:39  michael
+  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
   + Initial import
 
 
   Revision 1.1  2000/01/06 01:20:31  peter
   Revision 1.1  2000/01/06 01:20:31  peter

+ 274 - 16
api/linux/keyboard.inc → api/unix/keyboard.inc

@@ -10,6 +10,10 @@ uses
 
 
 var
 var
   OldIO : TermIos;
   OldIO : TermIos;
+{$ifdef logging}
+  f : text;
+{$endif logging}
+
 Procedure SetRawMode(b:boolean);
 Procedure SetRawMode(b:boolean);
 Var
 Var
   Tio : Termios;
   Tio : Termios;
@@ -230,11 +234,40 @@ Begin
   Keypressed := (KeySend<>KeyPut) or sysKeyPressed;
   Keypressed := (KeySend<>KeyPut) or sysKeyPressed;
 End;
 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;
 Function ReadKey:char;
 Var
 Var
   ch       : char;
   ch       : char;
   OldState,
   OldState,
   State    : longint;
   State    : longint;
+  is_delay : boolean;
   fdsin    : fdSet;
   fdsin    : fdSet;
 Begin
 Begin
 {Check Buffer first}
 {Check Buffer first}
@@ -257,11 +290,20 @@ Begin
      FD_Zero(fdsin);
      FD_Zero(fdsin);
      fd_Set(StdInputHandle,fdsin);
      fd_Set(StdInputHandle,fdsin);
      State:=1;
      State:=1;
+{$ifdef logging}
+     write(f,'Esc');
+{$endif logging}
      if InCnt=0 then
      if InCnt=0 then
       Select(StdInputHandle+1,@fdsin,nil,nil,10);
       Select(StdInputHandle+1,@fdsin,nil,nil,10);
      while (State<>0) and (sysKeyPressed) do
      while (State<>0) and (sysKeyPressed) do
       begin
       begin
         ch:=ttyRecvChar;
         ch:=ttyRecvChar;
+{$ifdef logging}
+        if ord(ch)>31 then
+          write(f,ch)
+        else
+          write(f,'#',ord(ch):2);
+{$endif logging}
         OldState:=State;
         OldState:=State;
         State:=0;
         State:=0;
         case OldState of
         case OldState of
@@ -277,8 +319,8 @@ Begin
                'O' : State:=6;
                'O' : State:=6;
                else
                else
                 begin
                 begin
-                  PushKey(ch);
                   PushKey(#27);
                   PushKey(#27);
+                  PushKey(ch);
                 end;
                 end;
                end;
                end;
             end;
             end;
@@ -294,15 +336,16 @@ Begin
                'K' : PushExt(79);
                'K' : PushExt(79);
                '1' : State:=4;
                '1' : State:=4;
                '2' : State:=5;
                '2' : State:=5;
-               '3' : PushExt(83);
+               '3' : State:=12;{PushExt(83)}
                '4' : PushExt(79);
                '4' : PushExt(79);
                '5' : PushExt(73);
                '5' : PushExt(73);
                '6' : PushExt(81);
                '6' : PushExt(81);
+               '?' : State:=7;
               else
               else
                begin
                begin
-                 PushKey(ch);
-                 PushKey('[');
                  PushKey(#27);
                  PushKey(#27);
+                 PushKey('[');
+                 PushKey(ch);
                end;
                end;
               end;
               end;
               if ch in ['3'..'6'] then
               if ch in ['3'..'6'] then
@@ -315,30 +358,73 @@ Begin
                'C' : PushExt(61);
                'C' : PushExt(61);
                'D' : PushExt(62);
                'D' : PushExt(62);
                'E' : PushExt(63);
                'E' : PushExt(63);
+              else
+               begin
+                 PushKey(#27);
+                 PushKey('[');
+                 PushKey('[');
+                 PushKey(ch);
+               end;
               end;
               end;
             end;
             end;
-        4 : begin
+        4 : begin {Esc[1}
               case ch of
               case ch of
                '~' : PushExt(71);
                '~' : PushExt(71);
                '7' : PushExt(64);
                '7' : PushExt(64);
                '8' : PushExt(65);
                '8' : PushExt(65);
                '9' : PushExt(66);
                '9' : PushExt(66);
+              else
+               begin
+                 PushKey(#27);
+                 PushKey('[');
+                 PushKey('1');
+                 PushKey(ch);
+               end;
               end;
               end;
               if (Ch<>'~') then
               if (Ch<>'~') then
                State:=255;
                State:=255;
             end;
             end;
-        5 : begin
+        5 : begin {Esc[2}
               case ch of
               case ch of
                '~' : PushExt(82);
                '~' : PushExt(82);
                '0' : pushExt(67);
                '0' : pushExt(67);
                '1' : PushExt(68);
                '1' : PushExt(68);
-               '3' : PushExt(133);
-               '4' : PushExt(134);
+               '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;
               end;
               if (Ch<>'~') then
               if (Ch<>'~') then
                State:=255;
                State:=255;
             end;
             end;
-        6 : begin {Esc0 Function keys in vt100 mode PM }
+        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
               case ch of
                'P' : {F1}PushExt(59);
                'P' : {F1}PushExt(59);
                'Q' : {F2}PushExt(60);
                'Q' : {F2}PushExt(60);
@@ -350,15 +436,135 @@ Begin
                'l' : {F8}PushExt(66);
                'l' : {F8}PushExt(66);
                'w' : {F9}PushExt(67);
                'w' : {F9}PushExt(67);
                'x' : {F10}PushExt(68);
                '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;
             end;
             end;
-      255 : ;
+        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;
         end;
         if (State<>0) and (InCnt=0) then
         if (State<>0) and (InCnt=0) then
          Select(StdInputHandle+1,@fdsin,nil,nil,10);
          Select(StdInputHandle+1,@fdsin,nil,nil,10);
       end;
       end;
      if State=1 then
      if State=1 then
       PushKey(ch);
       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
    end
   else
   else
    Begin
    Begin
@@ -378,6 +584,7 @@ var
 begin
 begin
   arg:=6;
   arg:=6;
   shift:=0;
   shift:=0;
+  {$Ifndef BSD}
   if IOCtl(StdInputHandle,TIOCLINUX,@arg) then
   if IOCtl(StdInputHandle,TIOCLINUX,@arg) then
    begin
    begin
      if (arg and (2 or 8))<>0 then
      if (arg and (2 or 8))<>0 then
@@ -387,6 +594,7 @@ begin
      if (arg and 1)<>0 then
      if (arg and 1)<>0 then
       inc(shift,3);
       inc(shift,3);
    end;
    end;
+ {$endif}
   ShiftState:=shift;
   ShiftState:=shift;
 end;
 end;
 
 
@@ -397,6 +605,10 @@ procedure InitKeyboard;
 begin
 begin
   SetRawMode(true);
   SetRawMode(true);
   patchkeyboard;
   patchkeyboard;
+{$ifdef logging}
+     assign(f,'keyboard.log');
+     rewrite(f);
+{$endif logging}
 end;
 end;
 
 
 
 
@@ -404,6 +616,9 @@ procedure DoneKeyboard;
 begin
 begin
   unpatchkeyboard;
   unpatchkeyboard;
   SetRawMode(false);
   SetRawMode(false);
+{$ifdef logging}
+  close(f);
+{$endif logging}
 end;
 end;
 
 
 
 
@@ -588,13 +803,56 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2000-10-15 09:18:22  peter
-    * vt100 keys support merged
+  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  2000/10/04 11:53:31  pierre
-   Add TargetEntry and TargetExit (merged)
+  Revision 1.3  1998/10/29 12:49:48  peter
+    * more fixes
 
 
-  Revision 1.2  2000/07/13 11:32:25  michael
-  + removed logs
+  Revision 1.1  1998/10/26 11:31:47  peter
+    + inital include files
 
 
 }
 }

+ 115 - 19
api/linux/mouse.inc → api/unix/mouse.inc

@@ -23,6 +23,9 @@ var
   mousecurcell : TVideoCell;
   mousecurcell : TVideoCell;
 
 
 
 
+const
+  gpm_fs : longint = -1;
+
 procedure PlaceMouseCur(ofs:longint);
 procedure PlaceMouseCur(ofs:longint);
 {$ifndef NOMOUSE}
 {$ifndef NOMOUSE}
 var
 var
@@ -62,14 +65,23 @@ begin
   PendingMouseTail:=@PendingMouseEvent;
   PendingMouseTail:=@PendingMouseEvent;
   PendingMouseEvents:=0;
   PendingMouseEvents:=0;
   FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
   FillChar(LastMouseEvent,sizeof(TMouseEvent),0);
-{ 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_Open(connect,0);
-{ show mousepointer }
-  ShowMouse;
+  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}
 {$endif ndef NOMOUSE}
 end;
 end;
 
 
@@ -77,19 +89,51 @@ end;
 procedure DoneMouse;
 procedure DoneMouse;
 begin
 begin
 {$ifndef NOMOUSE}
 {$ifndef NOMOUSE}
-  HideMouse;
-  Gpm_Close;
+  If gpm_fs<>-1 then
+    begin
+      HideMouse;
+      Gpm_Close;
+      gpm_fs:=-1;
+    end;
 {$endif ndef NOMOUSE}
 {$endif ndef NOMOUSE}
 end;
 end;
 
 
 
 
 function DetectMouse:byte;
 function DetectMouse:byte;
+{$ifndef NOMOUSE}
+var
+  x : longint;
+  e : TGPMEvent;
+  connect : TGPMConnect;
+{$endif ndef NOMOUSE}
 begin
 begin
 {$ifdef NOMOUSE}
 {$ifdef NOMOUSE}
   DetectMouse:=0;
   DetectMouse:=0;
 {$else ndef NOMOUSE}
 {$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 }
 { always a mouse deamon present }
-  DetectMouse:=2;
+  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}
 {$endif ndef NOMOUSE}
 end;
 end;
 
 
@@ -173,6 +217,7 @@ begin
 {$ifdef NOMOUSE}
 {$ifdef NOMOUSE}
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
 {$else ndef NOMOUSE}
 {$else ndef NOMOUSE}
+  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
   if gpm_fd<0 then
   if gpm_fd<0 then
    exit;
    exit;
   Gpm_GetEvent(e);
   Gpm_GetEvent(e);
@@ -213,11 +258,15 @@ begin
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
   exit(false);
   exit(false);
 {$else ndef NOMOUSE}
 {$else ndef NOMOUSE}
+  fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
   if gpm_fd<0 then
   if gpm_fd<0 then
    exit(false);
    exit(false);
-  FD_Zero(fds);
-  FD_Set(gpm_fd,fds);
-  if (Select(gpm_fd+1,@fds,nil,nil,1)>0) then
+  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
    begin
      Gpm_GetSnapshot(e);
      Gpm_GetSnapshot(e);
      MouseEvent.x:=e.x-1;
      MouseEvent.x:=e.x-1;
@@ -237,7 +286,10 @@ begin
      else
      else
       MouseEvent.Action:=0;
       MouseEvent.Action:=0;
      end;
      end;
-     PollMouseEvent:=true;
+     if (gpm_fd<>-2) or (MouseEvent.Action<>0) then
+       PollMouseEvent:=true
+     else
+       PollMouseEvent:=false;
    end
    end
   else
   else
    PollMouseEvent:=false;
    PollMouseEvent:=false;
@@ -246,7 +298,51 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2000-07-13 11:32:25  michael
-  + removed logs
- 
-}
+  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
+
+}

+ 42 - 12
api/linux/terminfo.pas → api/unix/terminfo.pas

@@ -1,9 +1,10 @@
 {
 {
    $Id$
    $Id$
-   Copyright (c) 1997 Balazs Scheidler ([email protected])
 
 
    An interface unit for the terminfo database
    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
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    License as published by the Free Software Foundation; either
@@ -747,18 +748,47 @@ function tparam(const char *, char *, int, ...): PChar; cdecl; external;}
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2000-10-15 09:20:21  peter
-    * linux terminal fixes merged
-
-  Revision 1.2  2000/08/02 12:39:22  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
-    (merged from fixes branch)
+  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
   Revision 1.1  2000/07/13 06:29:39  michael
   + Initial import
   + 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
 }
 }

+ 31 - 0
api/unix/testkeyb.pas

@@ -0,0 +1,31 @@
+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.

+ 90 - 14
api/linux/video.inc → api/unix/video.inc

@@ -25,13 +25,20 @@ const
 
 
 procedure SendEscapeSeqNdx(Ndx: Word);
 procedure SendEscapeSeqNdx(Ndx: Word);
 var
 var
-  P: PChar;
+  P,pdelay: PChar;
 begin
 begin
   if not assigned(cur_term_Strings) then
   if not assigned(cur_term_Strings) then
     RunError(219);
     RunError(219);
   P:=cur_term_Strings^[Ndx];
   P:=cur_term_Strings^[Ndx];
   if assigned(p) then
   if assigned(p) then
-   fdWrite(TTYFd, P^, StrLen(P));
+   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;
 end;
 
 
 
 
@@ -627,31 +634,100 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2000-10-15 09:17:20  peter
-    * merged more fixes
+  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.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.5  2000/10/04 11:53:31  pierre
-   Add TargetEntry and TargetExit (merged)
+  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.4  2000/09/26 08:18:29  jonas
+  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
     + added preserving of rawness of terminal when going though
       init/donevideo
       init/donevideo
     * del_term() is now called in donevideo
     * del_term() is now called in donevideo
-    * if initvideo is called while the video is already initialized, the
+    * if initvideo is called while the video is already iniialized, the
       screen is cleared and the cursor is set home, instead of going
       screen is cleared and the cursor is set home, instead of going
       through the whole donevideo and then initvideo
       through the whole donevideo and then initvideo
-    (merged from fixes branch)
 
 
-  Revision 1.3  2000/08/02 12:39:22  jonas
+  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
     * 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
     * cur_term is not directly usable anymore for the largest part because
       of a different record layout in ncurses 4/5, therefore the pointers
       of a different record layout in ncurses 4/5, therefore the pointers
       cur_term_booleans, cur_term_numbers, cur_term_strings and
       cur_term_booleans, cur_term_numbers, cur_term_strings and
       cur_term_common are now available
       cur_term_common are now available
     * adapted video.inc to use the new naming convention
     * adapted video.inc to use the new naming convention
-    (merged from fixes branch)
 
 
-  Revision 1.2  2000/07/13 11:32:25  michael
-  + removed logs
+  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
+
+}