Browse Source

+ Initial implementation

michael 25 years ago
parent
commit
b4e9f9cd04

+ 53 - 0
docs/mathex/Makefile

@@ -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 - 0
docs/mathex/README

@@ -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 - 0
docs/mathex/ex1.pp

@@ -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 - 0
docs/mathex/ex2.pp

@@ -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 - 0
docs/mathex/ex3.pp

@@ -0,0 +1,10 @@
+Program Example3;
+
+{ Program to demonstrate the arcosh function. }
+
+Uses math;
+
+begin
+  Writeln(arcosh(1));
+  Writeln(arcosh(2));
+end.

+ 2 - 0
docs/mathex/foot.tex

@@ -0,0 +1,2 @@
+\end{verbatim}
+\end{FPCList}

+ 3 - 0
docs/mathex/head.tex

@@ -0,0 +1,3 @@
+\begin{FPCList}
+\item[Example]
+\begin{verbatim}

+ 8 - 0
docs/mathex/newex

@@ -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 - 0
docs/mathex/template.pp

@@ -0,0 +1,8 @@
+Program Example;
+
+{ Program to demonstrate the *** function. }
+
+Uses math;
+
+begin
+end.