mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:49:23 +02:00
+ Preparations for version 1.0.8
This commit is contained in:
parent
0ad9503509
commit
a2d3269fb8
@ -22,7 +22,7 @@
|
|||||||
#INSTALLDEBUG=1
|
#INSTALLDEBUG=1
|
||||||
|
|
||||||
# Which docs are made when 'html' is specified
|
# Which docs are made when 'html' is specified
|
||||||
HTML = user units ref prog
|
HTML = user units ref prog
|
||||||
|
|
||||||
# Can be 'report','book' or 'html'
|
# Can be 'report','book' or 'html'
|
||||||
PREAMBLETYPE = report
|
PREAMBLETYPE = report
|
||||||
@ -36,7 +36,7 @@ ifndef DOCINSTALLDIR
|
|||||||
DOCINSTALLDIR:=$(PREFIXINSTALLDIR)/doc/fpc-$(shell ppc386 -iV)
|
DOCINSTALLDIR:=$(PREFIXINSTALLDIR)/doc/fpc-$(shell ppc386 -iV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
FPDOC=fpdoc
|
FPDOC=/home/michael/projects/fpdoc/fpdoc
|
||||||
|
|
||||||
#
|
#
|
||||||
# Program definitions
|
# Program definitions
|
||||||
@ -124,7 +124,8 @@ endif
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
.PHONY: clean dvi help html ps psdist htmldist pdfdist txtdist \
|
.PHONY: clean dvi help html ps psdist htmldist pdfdist txtdist \
|
||||||
htm txt pdf refex alldist messages onechap gtk
|
htm txt pdf refex alldist messages onechap gtk \
|
||||||
|
user ref prog units
|
||||||
|
|
||||||
.SUFFIXES: .dvi .tex .ps .txt .pdf
|
.SUFFIXES: .dvi .tex .ps .txt .pdf
|
||||||
|
|
||||||
@ -186,6 +187,7 @@ clean:
|
|||||||
-$(MAKE) -C heapex clean
|
-$(MAKE) -C heapex clean
|
||||||
-$(MAKE) -C ipcex clean
|
-$(MAKE) -C ipcex clean
|
||||||
-$(MAKE) -C linuxex clean
|
-$(MAKE) -C linuxex clean
|
||||||
|
-$(MAKE) -C mmouseex clean
|
||||||
-$(MAKE) -C mouseex clean
|
-$(MAKE) -C mouseex clean
|
||||||
-$(MAKE) -C objectex clean
|
-$(MAKE) -C objectex clean
|
||||||
-$(MAKE) -C optex clean
|
-$(MAKE) -C optex clean
|
||||||
@ -198,6 +200,7 @@ clean:
|
|||||||
-$(MAKE) -C gpmex clean
|
-$(MAKE) -C gpmex clean
|
||||||
-$(MAKE) -C typinfex clean
|
-$(MAKE) -C typinfex clean
|
||||||
-$(MAKE) -C kbdex clean
|
-$(MAKE) -C kbdex clean
|
||||||
|
-$(MAKE) -C videoex clean
|
||||||
# Reference
|
# Reference
|
||||||
-$(MAKE) -C refex clean
|
-$(MAKE) -C refex clean
|
||||||
# Programmers manual
|
# Programmers manual
|
||||||
@ -280,7 +283,7 @@ endif
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
# Tex from XML
|
# Tex from XML
|
||||||
#####################################################################
|
#####################################################################
|
||||||
FPCLASSESOPT=--descr=classes.xml --input='../fcl/linux/classes.pp -I../fcl/inc'
|
FPCLASSESOPT=--package=fcl --descr=classes.xml --input='../fcl/linux/classes.pp -I../fcl/inc'
|
||||||
|
|
||||||
classes.tex: classes.xml
|
classes.tex: classes.xml
|
||||||
$(FPDOC) --output=. $(FPCLASSESOPT) --format=latex
|
$(FPDOC) --output=. $(FPCLASSESOPT) --format=latex
|
||||||
@ -476,7 +479,7 @@ htmlinstall: html
|
|||||||
cp -R buttons $(DOCINSTALLDIR)
|
cp -R buttons $(DOCINSTALLDIR)
|
||||||
cp -R pics $(DOCINSTALLDIR)
|
cp -R pics $(DOCINSTALLDIR)
|
||||||
cp -R $(HTML) $(DOCINSTALLDIR)
|
cp -R $(HTML) $(DOCINSTALLDIR)
|
||||||
find $(DOCINSTALLDIR) -name 'CVS' | xargs -n1 rm -rf
|
find $(DOCINSTALLDIR) -name 'CVS' -or -name '*.eps' | xargs -n1 rm -rf
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@echo Choose install from:
|
@echo Choose install from:
|
||||||
@ -507,27 +510,36 @@ txtdist: txt
|
|||||||
DOCPREFIX=doc
|
DOCPREFIX=doc
|
||||||
BASEDIR=$(shell pwd)
|
BASEDIR=$(shell pwd)
|
||||||
|
|
||||||
htmltar:
|
htmltar:
|
||||||
|
ifndef SKIPINSTALL
|
||||||
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
|
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
|
||||||
|
endif
|
||||||
cd $(DOCPREFIX) ; tar cz * > $(BASEDIR)/fpcdoc.tar.gz ; cd $(BASEDIR)
|
cd $(DOCPREFIX) ; tar cz * > $(BASEDIR)/fpcdoc.tar.gz ; cd $(BASEDIR)
|
||||||
rm -rf $(DOCPREFIX)
|
rm -rf $(DOCPREFIX)
|
||||||
|
|
||||||
htmlzip:
|
htmlzip:
|
||||||
|
ifndef SKIPINSTALL
|
||||||
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
|
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
|
||||||
|
endif
|
||||||
zip -D9rq doc-html $(DOCPREFIX)/*
|
zip -D9rq doc-html $(DOCPREFIX)/*
|
||||||
rm -rf $(DOCPREFIX)
|
rm -rf $(DOCPREFIX)
|
||||||
|
|
||||||
htmzip:
|
htmzip:
|
||||||
|
ifndef SKIPINSTALL
|
||||||
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
|
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
|
||||||
|
endif
|
||||||
makehtm `find $(DOCPREFIX) -name '*.html'`
|
makehtm `find $(DOCPREFIX) -name '*.html'`
|
||||||
zip -D9rq doc-htm `find $(DOCPREFIX) -name '*.htm' -or -name '*.gif' -or -name '*.css'`
|
zip -D9rq doc-htm `find $(DOCPREFIX) -name '*.htm' -or -name '*.gif' -or -name '*.png' -or -name '*.css'`
|
||||||
rm -rf $(DOCPREFIX)
|
rm -rf $(DOCPREFIX)
|
||||||
|
|
||||||
htmldist: htmlzip htmltar
|
htmldist: htmlzip htmltar
|
||||||
|
|
||||||
htmdist: htmzip
|
htmdist: htmzip
|
||||||
|
|
||||||
alldist: dvidist psdist txtdist pdfdist htmldist htmdist
|
alldist: dvidist psdist txtdist pdfdist
|
||||||
|
$(MAKE) htmltar
|
||||||
|
$(MAKE) htmlzip SKIPINSTALL=Y
|
||||||
|
$(MAKE) htmzip SKIPINSTALL=Y
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
-rm -f *.tar.gz *.zip
|
-rm -f *.tar.gz *.zip
|
||||||
@ -577,7 +589,10 @@ execute:
|
|||||||
|
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
# Revision 1.15 2002-11-10 12:22:10 carl
|
# Revision 1.16 2003-02-24 23:37:52 michael
|
||||||
|
# + Preparations for version 1.0.8
|
||||||
|
#
|
||||||
|
# Revision 1.15 2002/11/10 12:22:10 carl
|
||||||
# * update makefiles for testing
|
# * update makefiles for testing
|
||||||
# * update example which did not compile
|
# * update example which did not compile
|
||||||
#
|
#
|
||||||
|
20
docs/crt.tex
20
docs/crt.tex
@ -30,12 +30,32 @@ and Peter Vreman. It works on the \linux console, and in xterm and rxvt windows
|
|||||||
under X-Windows. The functionality for both is the same, except that under
|
under X-Windows. The functionality for both is the same, except that under
|
||||||
\linux the use of an early implementation (versions 0.9.1 and earlier of the
|
\linux the use of an early implementation (versions 0.9.1 and earlier of the
|
||||||
compiler) the crt unit automatically cleared the screen at program startup.
|
compiler) the crt unit automatically cleared the screen at program startup.
|
||||||
|
|
||||||
|
There are some caveats when using the CRT unit:
|
||||||
|
\begin{itemize}
|
||||||
|
\item Programs using the CRT unit will {\em not} be usable when input/output
|
||||||
|
is being redirected on the command-line.
|
||||||
|
|
||||||
|
\item For similar reasons they are not usable as CGI-scripts for use with a
|
||||||
|
webserver.
|
||||||
|
|
||||||
|
\item The use of the CRT unit and the graph unit may not always be supported.
|
||||||
|
|
||||||
|
\item On \linux or other unix OSes , executing other programs that expect
|
||||||
|
special terminal behaviour (using one of the special functions in the linux
|
||||||
|
unit) will not work. The terminal is set in RAW mode, which will destroy
|
||||||
|
most terminal emulation settings.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
This chapter is divided in two sections.
|
This chapter is divided in two sections.
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item The first section lists the pre-defined constants, types and variables.
|
\item The first section lists the pre-defined constants, types and variables.
|
||||||
\item The second section describes the functions which appear in the
|
\item The second section describes the functions which appear in the
|
||||||
interface part of the CRT unit.
|
interface part of the CRT unit.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% Types, Variables, Constants
|
||||||
\section{Types, Variables, Constants}
|
\section{Types, Variables, Constants}
|
||||||
Color definitions :
|
Color definitions :
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
|
@ -26,7 +26,7 @@ unit gives access to some operating system calls related to files, the
|
|||||||
file system, date and time. Except for the \palmos target, this unit is
|
file system, date and time. Except for the \palmos target, this unit is
|
||||||
available to all supported platforms.
|
available to all supported platforms.
|
||||||
|
|
||||||
The unit was first written for \dos by Florian kl\"ampfl. It was ported to
|
The unit was first written for \dos by Florian Kl\"ampfl. It was ported to
|
||||||
\linux by Mark May\footnote{Current e-mail address \textsf{mmay@dnaco.net}},
|
\linux by Mark May\footnote{Current e-mail address \textsf{mmay@dnaco.net}},
|
||||||
and enhanced by Micha\"el Van Canneyt. The \amiga version was ported by
|
and enhanced by Micha\"el Van Canneyt. The \amiga version was ported by
|
||||||
Nils Sjoholm.
|
Nils Sjoholm.
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
{\raggedleft\large%
|
{\raggedleft\large%
|
||||||
\begin{tabular}[t]{r}%
|
\begin{tabular}[t]{r}%
|
||||||
\@FPCDescription \\
|
\@FPCDescription \\
|
||||||
\@FPCVersion \\
|
Document version \@FPCVersion \\
|
||||||
\@date
|
\@date
|
||||||
\end{tabular}\par}%
|
\end{tabular}\par}%
|
||||||
\vskip 5cm%
|
\vskip 5cm%
|
||||||
@ -201,7 +201,7 @@
|
|||||||
%
|
%
|
||||||
% Some versions
|
% Some versions
|
||||||
%
|
%
|
||||||
\newcommand{\fpcversion}{1.0.6}
|
\newcommand{\fpcversion}{1.0.8}
|
||||||
%
|
%
|
||||||
% PDF support
|
% PDF support
|
||||||
%
|
%
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
This chapter of the documentation describe the GO32 unit for the Free Pascal
|
This chapter of the documentation describe the GO32 unit for the Free Pascal
|
||||||
compiler under \dos. It was donated by Thomas Schatzl
|
compiler under \dos. It was donated by Thomas Schatzl
|
||||||
(tom\_at\_work@geocities.com), for which my thanks.
|
(tom\_at\_work@geocities.com), for which my thanks.
|
||||||
This unit was first written for \dos by Florian Klaempfl.
|
This unit was first written for \dos by Florian Kl"ampfl.
|
||||||
This chapter is divided in four sections. The first two sections are an
|
This chapter is divided in four sections. The first two sections are an
|
||||||
introduction to the GO32 unit. The third section lists the pre-defined
|
introduction to the GO32 unit. The third section lists the pre-defined
|
||||||
constants, types and variables. The last section describes the functions
|
constants, types and variables. The last section describes the functions
|
||||||
|
@ -1373,13 +1373,19 @@ Procedure SetTextStyle (Font,Direction,Magnitude : Word);
|
|||||||
\var{SetTextStyle} controls the style of text to be put on the screen.
|
\var{SetTextStyle} controls the style of text to be put on the screen.
|
||||||
pre-defined constants for \var{Font} are:
|
pre-defined constants for \var{Font} are:
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{verbatim}
|
||||||
\item \var{DefaultFont=0;}
|
DefaultFont = 0;
|
||||||
\item \var{TriplexFont=2;}
|
TriplexFont = 1;
|
||||||
\item \var{SmallFont=2;}
|
SmallFont = 2;
|
||||||
\item \var{SansSerifFont=3;}
|
SansSerifFont = 3;
|
||||||
\item \var{GothicFont=4;}
|
GothicFont = 4;
|
||||||
\end{itemize}
|
ScriptFont = 5;
|
||||||
|
SimpleFont = 6;
|
||||||
|
TSCRFont = 7;
|
||||||
|
LCOMFont = 8;
|
||||||
|
EuroFont = 9;
|
||||||
|
BoldFont = 10;
|
||||||
|
\end{verbatim}
|
||||||
Pre-defined constants for \var{Direction} are :
|
Pre-defined constants for \var{Direction} are :
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
\FPCexampledir{mathex}
|
\FPCexampledir{mathex}
|
||||||
|
|
||||||
This chapter describes the \file{math} unit. The \var{math} unit
|
This chapter describes the \file{math} unit. The \var{math} unit
|
||||||
was initially written by Florian Klaempfl. It provides mathematical
|
was initially written by Florian Kl\"ampfl. It provides mathematical
|
||||||
functions which aren't covered by the system unit.
|
functions which aren't covered by the system unit.
|
||||||
|
|
||||||
This chapter starts out with a definition of all types and constants
|
This chapter starts out with a definition of all types and constants
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
The \var{Mouse} unit implements a platform independent mouse handling
|
The \var{Mouse} unit implements a platform independent mouse handling
|
||||||
interface. It is implemented identically on all platforms supported by
|
interface. It is implemented identically on all platforms supported by
|
||||||
\fpc{} and can be enhanced with custom drivers, should this be needed.
|
\fpc{} and can be enhanced with custom drivers, should this be needed.
|
||||||
|
It is intended to be used only in text-based screens, for instance in
|
||||||
|
conjunction with the keyboard and video unit. No support for graphical
|
||||||
|
screens is implemented, and there are (currently) no plans to implement
|
||||||
|
this.
|
||||||
|
|
||||||
\section{Constants, Types and Variables}
|
\section{Constants, Types and Variables}
|
||||||
\subsection{Constants}
|
\subsection{Constants}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
%\input{math.tex}
|
%\input{math.tex}
|
||||||
%\input{msmouse.tex}
|
%\input{msmouse.tex}
|
||||||
%\input{mmx.tex}
|
%\input{mmx.tex}
|
||||||
\input{mouse.tex}
|
%\input{mouse.tex}
|
||||||
%\input{objects.tex}
|
%\input{objects.tex}
|
||||||
%\input{printer.tex}
|
%\input{printer.tex}
|
||||||
%\input{sockets.tex}
|
%\input{sockets.tex}
|
||||||
@ -64,4 +64,5 @@
|
|||||||
%\input{makefile.tex}
|
%\input{makefile.tex}
|
||||||
%\input{classes.tex}
|
%\input{classes.tex}
|
||||||
%\input{excepti.tex}
|
%\input{excepti.tex}
|
||||||
|
\input{options.tex}
|
||||||
\end{document}
|
\end{document}
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
%
|
%
|
||||||
\chapter{The PRINTER unit.}
|
\chapter{The PRINTER unit.}
|
||||||
This chapter describes the PRINTER unit for Free Pascal. It was written for
|
This chapter describes the PRINTER unit for Free Pascal. It was written for
|
||||||
\dos by Florian kl\"ampfl, and it was written for \linux by Micha\"el Van
|
\dos by Florian Kl\"ampfl, and it was written for \linux by Micha\"el Van
|
||||||
Canneyt, and has been ported to \windows as well.
|
Canneyt, and has been ported to \windows and \ostwo as well.
|
||||||
Its basic functionality is the same for both systems, although there are
|
Its basic functionality is the same for al supported systems, although there
|
||||||
minor differences on \linux.
|
are minor differences on \linux.
|
||||||
|
|
||||||
The chapter is divided in 2 sections:
|
The chapter is divided in 2 sections:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
|
@ -3952,11 +3952,10 @@ should do thereafter (cf. \seet{Heaperrorresult}).
|
|||||||
|
|
||||||
\begin{FPCltable}{|c|l|}{Heap error result}{Heaperrorresult}
|
\begin{FPCltable}{|c|l|}{Heap error result}{Heaperrorresult}
|
||||||
\hline
|
\hline
|
||||||
Value returned & Memory manager action \\
|
Value returned & Memory manager action \\ \hline
|
||||||
\hline
|
0 & Generates a runtime error 203 \\
|
||||||
0 & Generates a runtime error 203 \\
|
1 & \var{GetMem},\var{ReallocMem} and \var{New} returns \var{nil} \\
|
||||||
1 & \var{GetMem},\var{ReallocMem} and \var{New} returns \var{nil} \\
|
2 & Try allocating the memory block once again \\
|
||||||
2 & Try allocating the memory block once again \\
|
|
||||||
\hline
|
\hline
|
||||||
\end{FPCltable}
|
\end{FPCltable}
|
||||||
|
|
||||||
@ -4064,7 +4063,8 @@ be filled with zeroes before the call returns.
|
|||||||
and should fill it with the contents of the memory block pointed to by
|
and should fill it with the contents of the memory block pointed to by
|
||||||
\var{P}, truncating this to the new size of needed. After that, the memory
|
\var{P}, truncating this to the new size of needed. After that, the memory
|
||||||
pointed to by P may be deallocated. The return value is a pointer to the
|
pointed to by P may be deallocated. The return value is a pointer to the
|
||||||
new memory block.
|
new memory block. Note that \var{P} may be \var{Nil}, in which case the
|
||||||
|
behaviour is equivalent to \var{GetMem}.
|
||||||
\item[MemSize] should return the total amount of memory available for
|
\item[MemSize] should return the total amount of memory available for
|
||||||
allocation. This function may return zero if the memory manager does not
|
allocation. This function may return zero if the memory manager does not
|
||||||
allow to determine this information.
|
allow to determine this information.
|
||||||
@ -5963,7 +5963,7 @@ i.e. under a separate directory. The directory will be named with the name
|
|||||||
specified in the \var{package} section.
|
specified in the \var{package} section.
|
||||||
\item[files] extra data files to be installed in the directory specified
|
\item[files] extra data files to be installed in the directory specified
|
||||||
with the \var{datadir} key.
|
with the \var{datadir} key.
|
||||||
\item[prefix] is the directory below wchich all installs are done.
|
\item[prefix] is the directory below which all installs are done.
|
||||||
This corresponds to the \var{--prefix} argument to \gnu \file{configure}.
|
This corresponds to the \var{--prefix} argument to \gnu \file{configure}.
|
||||||
It is used for the installation of programs and units. By default, this is
|
It is used for the installation of programs and units. By default, this is
|
||||||
\file{/usr} on \linux, and \file{/pp} on all other platforms.
|
\file{/usr} on \linux, and \file{/pp} on all other platforms.
|
||||||
|
79
docs/ref.tex
79
docs/ref.tex
@ -480,6 +480,15 @@ Const
|
|||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
The order of the fields in a constant record needs to be the same as in the type declaration,
|
The order of the fields in a constant record needs to be the same as in the type declaration,
|
||||||
otherwise a compile-time error will occur.
|
otherwise a compile-time error will occur.
|
||||||
|
|
||||||
|
\begin{remark}
|
||||||
|
It should be stressed that typed constants are initialized at program start.
|
||||||
|
This is also true for {\em local} typed constants. Local typed constants are
|
||||||
|
also initialized at program start. If their value was changed during previous
|
||||||
|
invocations of the function, they will retain their changed value, i.e. they
|
||||||
|
are not initialized each time the function is invoked.
|
||||||
|
\end{remark}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% resource strings
|
% resource strings
|
||||||
\section{Resource strings}
|
\section{Resource strings}
|
||||||
@ -799,7 +808,6 @@ conversions. Note, however, that the result of an expression that contains
|
|||||||
ansistrings and short strings will always be an ansistring.
|
ansistrings and short strings will always be an ansistring.
|
||||||
|
|
||||||
\subsection{Short strings}
|
\subsection{Short strings}
|
||||||
|
|
||||||
A string declaration declares a short string in the following cases:
|
A string declaration declares a short string in the following cases:
|
||||||
|
|
||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
@ -808,7 +816,6 @@ will always be a short string declaration.
|
|||||||
\item If the switch is on \var{\{\$H+\}}, and there is a length
|
\item If the switch is on \var{\{\$H+\}}, and there is a length
|
||||||
specifier, the declaration is a short string declaration.
|
specifier, the declaration is a short string declaration.
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
|
|
||||||
The predefined type \var{ShortString} is defined as a string of length 255:
|
The predefined type \var{ShortString} is defined as a string of length 255:
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
ShortString = String[255];
|
ShortString = String[255];
|
||||||
@ -829,21 +836,25 @@ Type
|
|||||||
\var{StreetString} can contain up to 255 characters.
|
\var{StreetString} can contain up to 255 characters.
|
||||||
|
|
||||||
\subsection{Ansistrings}
|
\subsection{Ansistrings}
|
||||||
|
|
||||||
If the \var{\{\$H\}} switch is on, then a string definition that doesn't
|
|
||||||
contain a length specifier, will be regarded as an ansistring.
|
|
||||||
|
|
||||||
Ansistrings are strings that have no length limit. They are reference
|
Ansistrings are strings that have no length limit. They are reference
|
||||||
counted. Internally, an ansistring is treated as a pointer.
|
counted and null terminated. Internally, an ansistring is treated as
|
||||||
|
a pointer. This is all handled transparantly, i.e. they can be manipulated
|
||||||
|
as a normal short string. Ansistrings can be defined using the predefined
|
||||||
|
\var{AnsiString} type.
|
||||||
|
|
||||||
If the string is empty (\var{''}), then the pointer is nil.
|
If the \var{\{\$H\}} switch is on, then a string definition using the
|
||||||
If the string is not empty, then the pointer points to a structure in
|
regular \var{String} keyword and that doesn't contain a length specifier,
|
||||||
heap memory.
|
will be regarded as an ansistring as well. If a length specifier is present,
|
||||||
|
a short string will be used, regardless of the \var{\{\$H\}} setting.
|
||||||
|
|
||||||
It is possible to typecast an ansistring to a pchar.
|
If the string is empty (\var{''}), then the internal pointer representation
|
||||||
If the string is empty (so the pointer is nil) then the compiler
|
of the string pointer is \var{Nil}. If the string is not empty, then the
|
||||||
makes sure that the typecasted pchar will point to a null byte. AnsiStrings
|
pointer points to a structure in heap memory.
|
||||||
can be unlimited in length.
|
|
||||||
|
The internal representation as a pointer, and the automatic null-termination
|
||||||
|
make it possible to typecast an ansistring to a pchar. If the string is empty
|
||||||
|
(so the pointer is nil) then the compiler makes sure that the typecasted
|
||||||
|
pchar will point to a null byte.
|
||||||
|
|
||||||
Assigning one ansistring to another doesn't involve moving the actual
|
Assigning one ansistring to another doesn't involve moving the actual
|
||||||
string. A statement
|
string. A statement
|
||||||
@ -855,13 +866,14 @@ The referece count of \var{S1} is increased by one, and finally \var{S1}
|
|||||||
(as a pointer) is copied to \var{S2}. This is a significant speed-up in
|
(as a pointer) is copied to \var{S2}. This is a significant speed-up in
|
||||||
the code.
|
the code.
|
||||||
|
|
||||||
If a reference count reaches zero, then the memory occupied by the
|
If the reference count reaches zero, then the memory occupied by the
|
||||||
string is deallocated automatically, so no memory leaks arise.
|
string is deallocated automatically, so no memory leaks arise.
|
||||||
|
|
||||||
When an ansistring is declared, the \fpc compiler initially
|
When an ansistring is declared, the \fpc compiler initially
|
||||||
allocates just memory for a pointer, not more. This pointer is guaranteed
|
allocates just memory for a pointer, not more. This pointer is guaranteed
|
||||||
to be nil, meaning that the string is initially empty. This is
|
to be nil, meaning that the string is initially empty. This is
|
||||||
true for local, global or part of a structure (arrays, records or objects).
|
true for local and global ansistrings or anstrings that are part of a
|
||||||
|
structure (arrays, records or objects).
|
||||||
|
|
||||||
This does introduce an overhead. For instance, declaring
|
This does introduce an overhead. For instance, declaring
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
@ -869,12 +881,15 @@ Var
|
|||||||
A : Array[1..100000] of string;
|
A : Array[1..100000] of string;
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
Will copy 100,000 times \var{nil} into \var{A}. When \var{A} goes out of scope, then
|
Will copy 100,000 times \var{nil} into \var{A}. When \var{A} goes out of scope, then
|
||||||
the 100,000 strings will be dereferenced one by one. All this happens
|
the reference count of the 100,000 strings will be decreased by 1 for each
|
||||||
|
of these strings. All this happens
|
||||||
invisibly for the programmer, but when considering performance issues,
|
invisibly for the programmer, but when considering performance issues,
|
||||||
this is important.
|
this is important.
|
||||||
|
|
||||||
Memory will be allocated only when the string is assigned a value.
|
Memory will be allocated only when the string is assigned a value.
|
||||||
If the string goes out of scope, then it is automatically dereferenced.
|
If the string goes out of scope, then its reference count is automatically
|
||||||
|
decreased by 1. If the reference count reaches zero, the memory reserved for
|
||||||
|
the string is released.
|
||||||
|
|
||||||
If a value is assigned to a character of a string that has a reference count
|
If a value is assigned to a character of a string that has a reference count
|
||||||
greater than 1, such as in the following
|
greater than 1, such as in the following
|
||||||
@ -922,6 +937,8 @@ It is therefore NOT advisable to typecast one of the following:
|
|||||||
\item strings that have reference count larger than 0.
|
\item strings that have reference count larger than 0.
|
||||||
(call uniquestring to ensure a string has reference count 1)
|
(call uniquestring to ensure a string has reference count 1)
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
|
|
||||||
|
% Constant strings
|
||||||
\subsection{Constant strings}
|
\subsection{Constant strings}
|
||||||
|
|
||||||
To specify a constant string, it must be enclosed in single-quotes, just
|
To specify a constant string, it must be enclosed in single-quotes, just
|
||||||
@ -943,8 +960,8 @@ between them. Strings can not be substracted, however.
|
|||||||
Whether the constant string is stored as an ansistring or a short string
|
Whether the constant string is stored as an ansistring or a short string
|
||||||
depends on the settings of the \var{\{\$H\}} switch.
|
depends on the settings of the \var{\{\$H\}} switch.
|
||||||
|
|
||||||
|
% PChar
|
||||||
\subsection{PChar}
|
\subsection{PChar - Null terminated strings}
|
||||||
\fpc supports the Delphi implementation of the \var{PChar} type. \var{PChar}
|
\fpc supports the Delphi implementation of the \var{PChar} type. \var{PChar}
|
||||||
is defined as a pointer to a \var{Char} type, but allows additional
|
is defined as a pointer to a \var{Char} type, but allows additional
|
||||||
operations.
|
operations.
|
||||||
@ -3124,7 +3141,7 @@ Because of this, the calling block must pass a parameter of {\em exactly}
|
|||||||
the same type as the declared parameter's type. If it does not, the compiler
|
the same type as the declared parameter's type. If it does not, the compiler
|
||||||
will generate an error.
|
will generate an error.
|
||||||
|
|
||||||
Variable parameters can be untyped. In that case the variable has no type,
|
Variable and constant parameters can be untyped. In that case the variable has no type,
|
||||||
and hence is incompatible with all other types. However, the address operator
|
and hence is incompatible with all other types. However, the address operator
|
||||||
can be used on it, or it can be can passed to a function that has also an
|
can be used on it, or it can be can passed to a function that has also an
|
||||||
untyped parameter. If an untyped parameter is used in an assigment,
|
untyped parameter. If an untyped parameter is used in an assigment,
|
||||||
@ -4929,6 +4946,7 @@ Functions concerning memory issues.
|
|||||||
\procref{New}{Dynamically allocate memory for variable}
|
\procref{New}{Dynamically allocate memory for variable}
|
||||||
\funcref{Ofs}{Return offset of variable}
|
\funcref{Ofs}{Return offset of variable}
|
||||||
\funcref{Ptr}{Combine segment and offset to pointer}
|
\funcref{Ptr}{Combine segment and offset to pointer}
|
||||||
|
\funcref{ReAllocMem}{Resize a memory block on the heap}
|
||||||
\procref{Release}{Release memory above mark point}
|
\procref{Release}{Release memory above mark point}
|
||||||
\funcref{Seg}{Return segment}
|
\funcref{Seg}{Return segment}
|
||||||
\procref{SetMemoryManager}{Set a memory manager}
|
\procref{SetMemoryManager}{Set a memory manager}
|
||||||
@ -7512,6 +7530,25 @@ In case \var{Param} is an invalid value, an empty string is returned.
|
|||||||
|
|
||||||
For an example, see \seef{Paramstr}.
|
For an example, see \seef{Paramstr}.
|
||||||
|
|
||||||
|
\begin{function}{ReAllocMem}
|
||||||
|
\Declaration
|
||||||
|
function ReAllocMem(var p:pointer;Size:Longint):pointer;
|
||||||
|
\Description
|
||||||
|
\var{ReAllocMem} resizes the memory pointed to by \var{P} so it has size
|
||||||
|
\var{Size}. The value of \var{P} may change during this operation.
|
||||||
|
The contents of the memory pointed to by \var{P} (if any) will be copied to
|
||||||
|
the new location, but may be truncated if the newly allocated memory block
|
||||||
|
is smaller in size. If a larger block is allocated, only the used memory is
|
||||||
|
initialized, extra memory will not be zeroed out.
|
||||||
|
|
||||||
|
Note that \var{P} may be nil, in that case the behaviour of \var{ReAllocMem}
|
||||||
|
is equivalent to \seep{Getmem}.
|
||||||
|
\Errors
|
||||||
|
If no memory is available then a run-time error will occur.
|
||||||
|
\SeeAlso
|
||||||
|
\seep{Getmem}, \seep{Freemem}
|
||||||
|
\end{function}
|
||||||
|
|
||||||
\begin{procedure}{ResetResourceTables}
|
\begin{procedure}{ResetResourceTables}
|
||||||
\Declaration
|
\Declaration
|
||||||
Procedure ResetResourceTables;
|
Procedure ResetResourceTables;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
\chapter{The SOCKETS unit.}
|
\chapter{The SOCKETS unit.}
|
||||||
This chapter describes the SOCKETS unit for Free Pascal.
|
This chapter describes the SOCKETS unit for Free Pascal.
|
||||||
it was written for \linux by Micha\"el Van Canneyt, and ported to \windows
|
it was written for \linux by Micha\"el Van Canneyt, and ported to \windows
|
||||||
by Florian Klaempfl.
|
by Florian Kl\"ampfl.
|
||||||
The chapter is divided in 2 sections:
|
The chapter is divided in 2 sections:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item The first section lists types, constants and variables from the
|
\item The first section lists types, constants and variables from the
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
\FPCexampledir{sysutex}
|
\FPCexampledir{sysutex}
|
||||||
|
|
||||||
This chapter describes the \file{sysutils} unit. The \file{sysutils} unit
|
This chapter describes the \file{sysutils} unit. The \file{sysutils} unit
|
||||||
was largely written by Gertjan Schouten, and completed by Michael Van Canneyt.
|
was largely written by Gertjan Schouten, and completed by Micha\"el Van Canneyt.
|
||||||
It aims to be compatible to the Delphi \file{sysutils} unit, but in contrast
|
It aims to be compatible to the Delphi \file{sysutils} unit, but in contrast
|
||||||
with the latter, it is designed to work on multiple platforms. It is implemented
|
with the latter, it is designed to work on multiple platforms. It is implemented
|
||||||
on all supported platforms.
|
on all supported platforms.
|
||||||
|
@ -246,8 +246,13 @@ your path variable to contain the \verb|C:\PP\BIN| directory.
|
|||||||
Usually this is done in the \file{AUTOEXEC.BAT} file.
|
Usually this is done in the \file{AUTOEXEC.BAT} file.
|
||||||
It should look something like this :
|
It should look something like this :
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
SET PATH=%PATH%;C:\PP\BIN
|
SET PATH=%PATH%;C:\PP\GO32V2\BIN
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
for \dos or
|
||||||
|
\begin{verbatim}
|
||||||
|
SET PATH=%PATH%;C:\PP\WIN32\BIN
|
||||||
|
\end{verbatim}
|
||||||
|
for \windows
|
||||||
(Again, assuming that you installed in the default location).
|
(Again, assuming that you installed in the default location).
|
||||||
|
|
||||||
|
|
||||||
@ -3583,4 +3588,9 @@ document pst
|
|||||||
end
|
end
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% Options summary tables
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
\input{options.tex}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
Loading…
Reference in New Issue
Block a user