Admin Panel

NAME
    sfdc - Compile SFD files into someting useful

SYNOPSIS
    sfdc [options] file1.sfd [file2.sfd ...]

      Options:
        --addvectors=TYPE       Add default functions
        --gateprefix=PREFIX     Prefix for gatestub functions
        --help -h               Show full help message and exit
        --libarg=LOCATION       Where to pass the libbase
        --libprefix=PREFIX      Prefix for library functions
        --sdi                   SDI header compatibility mode
        --man                   Show full manual page and exit
        --mode=MODE             What to do
        --output=FILE -o FILE   Where to store the output
        --quiet -q              Be quiet
        --target=TARGET         Specifies the machine target
        --version -v            Show version and exit

OPTIONS
    --addvectors
            This flag adds the standard library/device/BOOPSI functions to
            the list of function entries to process. Possible values are
            none, library, device and boopsi. The default is none. Useful
            when generating gate stub functions.

    --gateprefix
            Sets a function name prefix for the gate stub functions when
            generating gatestubs or gateproto files.

    --help  Show the full help message and exit. =item --libarg

            Specifies where to place the library base argument when
            generating gatestubs or gateproto and libproto files. Possible
            values are none, first and last. The default is none.

    --libprefix
            Sets a function name prefix for the local library functions when
            generating gatestubs or libproto files.

    --sdi   Turns on the SDI header compatibility mode. This will make sure
            that all header files (especially the gatestub and gateproto
            files are generated to be used in a SDI compatible environment.

    --man   Show the complete manual page and exit.

    --mode  Instructs sfdc what to do. sfdc can handle the following
            arguments:

            autoopen
                Generate C code for automatically opening the module. It is
                usually placed in a link library together with C stub
                functions.

            clib
                Generate C prototypes to be placed in Include/clib/.

            dump
                Dumps all information gathered from the SFD file.

            fd  Generate an old-style FD file.

            functable
                Generate a list of function names suitable for inclusion in
                a library function table. By defining the preprocessor
                symbol __SFDC_FUNCTABLE_M68K__, the list of functions will
                be modified so it's suitable for AmigaOS 4's m68k function
                table. =item gateproto

                Generate a prototype header file for library gate stubs.
                Useful for library and device developers.

            gatestubs
                Generate library gate stubs. Useful for library and device
                developers.

            interface
                Generate a struct with function pointers, like that uses in
                AmigaOS 4.

            libproto
                Generate a prototype header file for library functions. This
                is almost like clib, but for internal use by library and
                device developers.

            lvo Generate an assembler LVO include file.

            macros
                Generate a header file containing gcc specific preprocessor
                macros, similar to fd2inline's --new switch. For AROS
                targets, it generates a file suitable to be placed in the
                Include/defines/ directory. =item proto

                Generate header file to be placed in Include/proto/ that
                includes the C prototypes as well as compiler-specific
                inlines or pragma files.

            pragmas
                Generate a SAS/C/LATTICE/DICE and Maxon C/Storm C/Aztec C
                pragma file.

            stubs
                Generate C library stubs suitable to be compiled and
                archived into libamiga.a, libamigastubs.a or lib<module>.a.
                Using the %f escape sequence in the --output switch or a
                tool like splitasm.awk strongly is recommended.

            verify
                Just loads and parses the SFD file. This is the default.

    --output
            Specifies where the result will be stored. The following escape
            sequencies are allowed in the file name. If the sequence %f is
            present in the name, a new file will be created for each
            function processed.

            %b  The library base variable name ("DOSBase", for example).

            %f  The current funcion name ("Open", for example).

            %l  The name of the library or device (dos.library, for
                example).

            %n  The base name of the library or device ("dos", for example).

            If omitted, the result will be sent to the standard output
            instead of a file.

    --quiet Be quiet.

    --target
            Specifies the target when generating macros etc. The target
            names follow the GNU autoconf standard. Some possible values are
            listed below. The default is m68k-unknown-amigaos.

            i?86-pc-aros, i?86-linux-aros, ppc-aros ...
                AROS. Anything goes, as long as it ends in "-aros".

            i?86be-pc-amithlon, i?86be-amithlon
                Amithlon/big endian IA32.

            m68k-unknown-amigaos, m68k-amigaos
                Traditional AmigaOS/m68k.

            m68kvbcc-unknown-amigaos, m68k-amigaos
                Traditional AmigaOS/m68k but with the VBCC compiler.

            ppc-unknown-amigaos, ppc-amigaos
                AmigaOS 4/PowerPC.

            powerpc-unknown-morphos, ppc-morphos
                MorphOS/PowerPC.

    --version
            Prints the version and exits.

DESCRIPTION
    sfdc is an open source replacement for Amiga, Inc.'s sfd tool,
    distributed with NDK 3.9. It is also an replacement for fd2inline from
    GeekGadgets and the MorphOS team, later improved to death by Martin
    Blom. It's now a complete mess and needs a replacement. SFD files and
    sfdc might to be a good start.

    For developers using gcc, sfdc aims to handle all your needs when it
    comes to libraries, devices, datatypes, BOOPSI classes or similar
    modules. sfdc can also generate SAS/C, DICE and Storm C files for end
    users of such modules.

    The basis for all work performed by sfdc is the SFD file, which contains
    all required information about the module and the functions provided.
    From this information, sfdc can:

    *   Generate an old-style FD file for futher processing with other
        tools.

    *   Generate a C prototype file, such as those normally found in the
        Include/clib/ directory.

    *   Generate gcc inlines (actually preprocessor macros) or pragmas for
        direct library function calls (without going via library stubs).

    *   Generate the Include/proto/ file, which includes the Include/clib/
        file and either the inlines or pragmas.

    *   Generate an assembler LVO file, which contains the library offset of
        all functions in the library.

    *   Generate C stubs, which can be compiled and archived into a stub
        library. It can also generate auto-open and auto-close code.

    *   Generate library gateway stubs, which can be used as part of your
        module as glue between the module function table and your C
        functions.

    Additionally, sfdc does all this for several Amiga-like operating
    systems: traditional AmigaOS, native Amithlon, AROS and MorphOS.

    sfdc uses autoconf style identifies for the operating systems, making it
    easy to generate the correct output. Just make sure configure.in
    contains the AC_CANONICAL_SYSTEM command and use @host@ in your
    Makefile.in. Using autoconf and sfdc, it's easy to make for example a
    library that can be compiled or cross-compiiled for any of the mentioned
    architectures.

RETURN VALUE
    Returns 0 on success and 10 on errors.

NOTES
    Had I seen cvinclude.pl before I started writing this program, I might
    still have been using fd/clib files. Or maybe not.

AUTHOR
    Martin Blom <martin@blom.org>

HISTORY
    *   1.0 (2003-07-27)

        Initial release.

    *   1.1 (2003-12-22)

        Added workaround for workbench.library (base name is "wb"). Added
        AmigaOS 4 support. Added the --addvectors switch.

    *   1.2 (2004-06-16)

        Generates files for mathieeedoub*, though probably broken. Well they
        are the same as fd2inline generates at least.

    *   1.2a (2004-06-20)

        Replace AROS_LP with AROS_LD. Because it is guaranteed to define the
        function prototype. [verhaegs]

    *   1.3 (2004-11-12)

        Correctly handle the argument "type **arg", where there is no
        whitespace between the argument type and the argument name.

    *   Correctly handle the prototype "void function (void)", were there is
        a whitespace between the function name and the parenthesis and
        "void" is used to indicate no arguments.

    *   Replace "-" with "_" in base/library name.

    *   New special keyword for register specification (in addition to sysv
        and base): autoreg, which automatically allocates m68k registers for
        the arguments.

    *   sysv now works correctly with varargs functions. sysv combined with
        gatestubs work for m68k and i386 only for now. For AROS targets in
        macros, the correct AROS macro is used to fetch the function to be
        called.

    *   New --mode: functable. For proper code generation in AROS, make sure
        gateprotos are included before you include the functable.

    *   proto files now include Include/defines/ files when used in AROS.

    *   1.4 (2005-09-23)

        Added AmigaOS 4-style interfaces (C++ only for non-OS4 targets, and
        without implementation).

    *   The library base in the proto file is now defined for AmigaOS 4 too.

    *   AmigaOS 4 clib files now add __attribute__((linearvarargs)) to
        varargs functions.

    *   Added AmigaOS 4 support for stubs files.

    *   Added support for the 'iptr' gcc attribute.

    *   Added __SFDC_FUNCTABLE_M68K__ check in the functable mode.

    *   Added m68k stub functions to AmigaOS 4's gatestubs and gateproto.

    *   Added the autoopen mode.