Browse Source

+ Final changes for documentation

michael 25 years ago
parent
commit
c4c93e0cd0
6 changed files with 93 additions and 7 deletions
  1. 71 0
      docs/progex/Makefile
  2. 7 0
      docs/progex/README
  3. 6 0
      docs/progex/c2tex
  4. 4 7
      docs/progex/ctest2.c
  5. 2 0
      docs/progex/foot.tex
  6. 3 0
      docs/progex/head.tex

+ 71 - 0
docs/progex/Makefile

@@ -0,0 +1,71 @@
+#######################################################################
+#
+# 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 convert the C programs to LaTeX examples which can be included.
+C2TEX=./c2tex
+
+# 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=plsubs psubs 
+COBJECTS=ctest ctest2
+LIBOBJECT=libsubs.so
+TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
+TEXOBJECTS:=$(TEXOBJECTS) subs.tex
+CTEXOBJECTS=$(addsuffix .tex, $(COBJECTS))
+
+all : $(LIBOBJECTS) $(OBJECTS) $(COBJECTS)
+
+tex : $(TEXOBJECTS) $(CTEXOBJECTS) subs.tex
+
+onetex : tex
+	$(MAKETEX) $(TEXOBJECTS)
+
+clean : 
+	rm -f *.o *.s *.so $(OBJECTS) $(COBJECTS) $(TEXOBJECTS) $(CTEXOBJECTS)
+ 
+$(OBJECTS): %: %.pp $(LIBOBJECT)
+	$(PP) $(PPOPTS) $*
+
+$(TEXOBJECTS): %.tex: %.pp head.tex foot.tex
+	$(PP2TEX) $*
+
+$(CTEXOBJECTS): %.tex: %.c head.tex foot.tex
+	$(C2TEX) $*
+
+libsubs.so: subs.pp
+	$(PP) $(PPOPTS) $<
+
+ctest: ctest.c libsubs.so
+	$(CC) -o ctest ctest.c -lsubs
+
+ctest2: ctest2.c libsubs.so
+	$(CC) -o ctest2 ctest2.c -ldl

+ 7 - 0
docs/progex/README

@@ -0,0 +1,7 @@
+These are the example programs that appear in the FPC documentation.
+ 
+Units guide, chapter on GPM unit :
+
+Example programs
+gpmex.pp  demonstrates the basic usage of the gpm unit.
+

+ 6 - 0
docs/progex/c2tex

@@ -0,0 +1,6 @@
+#!/bin/sh
+# Simply paste a header and footer to the program.
+#
+cat head.tex >  $1.tex
+cat $1.c    >> $1.tex
+cat foot.tex >> $1.tex

+ 4 - 7
docs/progex/ctest2.c

@@ -6,18 +6,15 @@ int main()
     void *lib;
     char *s;
     int FromPos, ToPos;
-    char* (*SubStr)(const char*, int*, int*);
-    printf("arh %d\n",RTLD_LAZY);
-    lib = dlopen("./libcaseudf.so", RTLD_LAZY);
-    printf("Result from dlopen (library handle): 0x%08x\n", lib);
+    char* (*SubStr)(const char*, int, int);
+
+    lib = dlopen("./libsubs.so", RTLD_LAZY);
     SubStr = dlsym(lib, "SUBSTR");
-    printf("Address of SubStr = 0x%08x, last error code = %i\n",
-      SubStr, dlerror());
 
     s = strdup("Test");
     FromPos = 2;
     ToPos = 3;
-    printf("Result from SubStr: '%s'\n", (*SubStr)(s, &FromPos, &ToPos));
+    printf("Result from SubStr: '%s'\n", (*SubStr)(s, FromPos, ToPos));
     dlclose(lib);
     return 0;
 }

+ 2 - 0
docs/progex/foot.tex

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

+ 3 - 0
docs/progex/head.tex

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