home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Programming
/
vbcc_MorphOS
/
machines
/
amiga
/
doc
/
fd2libPPC.doc
< prev
next >
Wrap
Text File
|
2000-08-20
|
5KB
|
143 lines
fd2libPPC by Volker Barthelmann / Johnny Tevessen
INTRODUCTION
fd2libPPC takes .fd-files as input and generates assembler source to
create a library with stubs to call the functions (including stubs
for varargs functions).
LEGAL
fd2libPPC is public domain.
USAGE
Usage : fd2lib [-sd] [-nv] [-o <dir>] [-of <format>]
[-d] [-?|--help] [files/pattern]
-sd : Use small data model (else large data model)
Not yet supported.
-nv : No varargs logic - ...A and ...TagList will not be detected
-o : Specify directory to store source files in
-of : C printf style output format to generate compiling
script. Three `%s' are replaced with output file name
-d : Turn on debugging/verbose mode
-? : Show help/version and quit
files : FD files to convert, defaults to stdin
Commandline is parsed left-to-right. So specifying
> fd2lib alib_lib.fd -sd blib_lib.fd
will result in alib created using large data model.
There may also be a -prof option in future, but it's not yet
implemented.
fd2lib will process all the .fd-files specified at the command line
(not specifying any filename results in fd2lib using stdin (console)
as input) and will generate an assembler source for each library
function as functionname.s and a file containing all the library
vector offsets as libname_lvo.s.
Files are placed in the current directory. Specify an alternative
destination using the `-o <dir>' option.
GENERATED CODE
fd2libPPC creates code to be assembled with Frank Wille's pasm. It will
probably work for gas, too. The generated stubs should work for V.4 ABI,
ELF and ppc.library 44.44 and above.
VARARGS
Some functions take a pointer to a list of arguments as the last
argument. fd2lib has a hardcoded list of such function and creates
additional stubs that can be called with a variable number of arguments
from C (e.g. OpenWindowTagList and OpenWindowTags).
If you want to extend this list, you have to add the name of the
function and the name of the varargs function to the file vargs.h
and recompile fd2lib.
Since version 1.2 fd2lib also tries to recognize functions that might
have varargs automatically. It scans for `TagList' and `A' postfixes
and substitutes them with `Tags' or `'. `A's are only suggested to be
varargs if the letter right before is lowercase.
You may turn off automatic recognition by specifying `-nv'.
GOODIES
`-of <string>' allows you to get runtime output. You may use this
feature to show fd2lib's progress or to create batch files for post-
processing fd2lib's output. `%s' is substituted by the output asm file
just processed. E.g.:
> fd2libPPC -of "pasm %s" fd:dos_lib.fd >batchfile
> execute batchfile
will process dos' functions and then compile them straight-forward.
You may use `%s' upto three times in the format string. C like jokes
like `%30s' to show the file's name right-aligned are also allowed.
CREATING LIBRARIES
If you want to create a library from some .fd-files proceed like this:
> delete T:#?.(s|o) quiet
> fd2libPPC -o T: <all the .fd-files you want>
(copying pasm to ram: now may speed up the process)
> vc +ppc -c T:#?.s
> ppc-amigaos-ar q <name of resulting lib> T:*.o
> delete T:#?.(s|o)
MakeALIB.script
This is a small but smart script which will create an libamiga.a or
libamigas.a in T:. It will delete files from T: before and assumes
nothing is written to T: while it is running.
You have to assign FD: to a directory that contains the .fd-files for
the Amiga shared libraries and cd into the libsrc/AmigaLib directory
and start it from there. Otherwise you will get an error.
Without further parameters you will get a large data model amiga.lib.
To create small data model amigas.lib start the script with option
"-sd" (not yet supported).
It will then create all library stubs and LVOs with fd2libPPC (this
will result in many many small files in T: which will be assembled by
pasm - so having pasm in RAM: will speed it up quite a lot).
Then the support routines in libsrc/AmigaLib will be compiled/assembled
and the resulting object files will be put in T:, too. You must have
the C= includes.
The support routines are taken from libnix and have been changed a bit
to work with vbcc. I have not tested them and several support routines
from the original amiga.lib are missing.
The whole process may take quite some time and a few MB space in T:
The resulting libamiga.a should be free from any copyright and is a
rather good (but not complete) replacement for the original amiga.lib.
If everything went right you will be asked whether you want to have the
library installed to vlibppc:. Type <y> or do so manually if you don't
trust my script. :-)
Volker Barthelmann volker@vb.franken.de
Johnny Tevessen j.tevessen@line.org