mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:29:27 +02:00
+ Initial implementation
This commit is contained in:
parent
6a794bd6fa
commit
b4e9f9cd04
53
docs/mathex/Makefile
Normal file
53
docs/mathex/Makefile
Normal file
@ -0,0 +1,53 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Makefile to compile all examples and convert them to LaTeX
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
# Compiler
|
||||
PP=ppc386
|
||||
|
||||
# Unit directory
|
||||
# UNITDIR=/usr/lib/ppc/0.99.0/linuxunits
|
||||
|
||||
|
||||
# Any options you wish to pass.
|
||||
PPOPTS=
|
||||
|
||||
# Script to convert the programs to LaTeX examples which can be included.
|
||||
PP2TEX=../pp2tex
|
||||
|
||||
# Script to collect all examples in 1 file.
|
||||
MAKETEX=make1tex
|
||||
|
||||
#######################################################################
|
||||
# No need to edit after this line.
|
||||
#######################################################################
|
||||
|
||||
ifdef UNITDIR
|
||||
PPOPTS:=$(PPOPTS) -Up$(UNITDIR);
|
||||
endif
|
||||
|
||||
.SUFFIXES: .pp .tex
|
||||
|
||||
.PHONY: all tex clean
|
||||
|
||||
OBJECTS=ex1 ex2 ex3
|
||||
|
||||
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
|
||||
|
||||
all : $(OBJECTS)
|
||||
|
||||
tex : $(TEXOBJECTS)
|
||||
|
||||
onetex : tex
|
||||
$(MAKETEX) $(TEXOBJECTS)
|
||||
|
||||
clean :
|
||||
rm -f *.o *.s $(OBJECTS) $(TEXOBJECTS)
|
||||
|
||||
$(OBJECTS): %: %.pp
|
||||
$(PP) $(PPOPTS) $*
|
||||
|
||||
$(TEXOBJECTS): %.tex: %.pp head.tex foot.tex
|
||||
$(PP2TEX) $*
|
8
docs/mathex/README
Normal file
8
docs/mathex/README
Normal file
@ -0,0 +1,8 @@
|
||||
These are the example programs that appear in the FPC documentation.
|
||||
|
||||
Units guide, chapter on MATH unit :
|
||||
|
||||
Example programs
|
||||
ex1.pp contains an example of the arccos function.
|
||||
ex2.pp contains an example of the arcsin function.
|
||||
ex3.pp contains an example of the arcosh function.
|
20
docs/mathex/ex1.pp
Normal file
20
docs/mathex/ex1.pp
Normal file
@ -0,0 +1,20 @@
|
||||
Program Example1;
|
||||
|
||||
{ Program to demonstrate the arccos function. }
|
||||
|
||||
Uses math;
|
||||
|
||||
Procedure WriteRadDeg(X : float);
|
||||
|
||||
begin
|
||||
Writeln(X:8:5,' rad = ',radtodeg(x):8:5,' degrees.')
|
||||
end;
|
||||
|
||||
begin
|
||||
WriteRadDeg (arccos(1));
|
||||
WriteRadDeg (arccos(sqrt(3)/2));
|
||||
WriteRadDeg (arccos(sqrt(2)/2));
|
||||
WriteRadDeg (arccos(1/2));
|
||||
WriteRadDeg (arccos(0));
|
||||
WriteRadDeg (arccos(-1));
|
||||
end.
|
20
docs/mathex/ex2.pp
Normal file
20
docs/mathex/ex2.pp
Normal file
@ -0,0 +1,20 @@
|
||||
Program Example1;
|
||||
|
||||
{ Program to demonstrate the arcsin function. }
|
||||
|
||||
Uses math;
|
||||
|
||||
Procedure WriteRadDeg(X : float);
|
||||
|
||||
begin
|
||||
Writeln(X:8:5,' rad = ',radtodeg(x):8:5,' degrees.')
|
||||
end;
|
||||
|
||||
begin
|
||||
WriteRadDeg (arcsin(1));
|
||||
WriteRadDeg (arcsin(sqrt(3)/2));
|
||||
WriteRadDeg (arcsin(sqrt(2)/2));
|
||||
WriteRadDeg (arcsin(1/2));
|
||||
WriteRadDeg (arcsin(0));
|
||||
WriteRadDeg (arcsin(-1));
|
||||
end.
|
10
docs/mathex/ex3.pp
Normal file
10
docs/mathex/ex3.pp
Normal file
@ -0,0 +1,10 @@
|
||||
Program Example3;
|
||||
|
||||
{ Program to demonstrate the arcosh function. }
|
||||
|
||||
Uses math;
|
||||
|
||||
begin
|
||||
Writeln(arcosh(1));
|
||||
Writeln(arcosh(2));
|
||||
end.
|
2
docs/mathex/foot.tex
Normal file
2
docs/mathex/foot.tex
Normal file
@ -0,0 +1,2 @@
|
||||
\end{verbatim}
|
||||
\end{FPCList}
|
3
docs/mathex/head.tex
Normal file
3
docs/mathex/head.tex
Normal file
@ -0,0 +1,3 @@
|
||||
\begin{FPCList}
|
||||
\item[Example]
|
||||
\begin{verbatim}
|
8
docs/mathex/newex
Normal file
8
docs/mathex/newex
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
if [ -e ex${1}.pp ]; then
|
||||
mv ex${1}.pp ex${1}.pp.orig
|
||||
fi
|
||||
sed -e s/Example/Example$1/ -e s/\\\*\\\*\\\*/$2/ <template.pp >ex${1}.pp
|
||||
echo "ex${1}.pp contains an example of the $2 function." >>README
|
||||
joe ex${1}.pp
|
||||
ppc386 ex${1}.pp && ex${1}
|
8
docs/mathex/template.pp
Normal file
8
docs/mathex/template.pp
Normal file
@ -0,0 +1,8 @@
|
||||
Program Example;
|
||||
|
||||
{ Program to demonstrate the *** function. }
|
||||
|
||||
Uses math;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user