+ Final changes for documentation

This commit is contained in:
michael 2000-06-15 19:05:55 +00:00
parent 0d58e53bfc
commit c4c93e0cd0
6 changed files with 93 additions and 7 deletions

71
docs/progex/Makefile Normal file
View File

@ -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
docs/progex/README Normal file
View File

@ -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
docs/progex/c2tex Normal file
View File

@ -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

View File

@ -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
docs/progex/foot.tex Normal file
View File

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

3
docs/progex/head.tex Normal file
View File

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