/*
 * Skeleton Saver Module
 */

#include <exec/types.h>
#include <dos/dos.h>
#include <libraries/iffparse.h>
#include <devices/clipboard.h>
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>

#include <scan/modall.h>
#include <scan/loadsave.h>

/**************************************************************************
 * SM_SaveTrue()
 *
 * Write out a true color image buffer in the format that this module
 * saves in.
 *
 * The Buffer structure is defined in scan/buf.h.
 */

BOOL __saveds __asm SM_SaveTrue (register __a0 char *fname,
                                 register __a1 struct Buffer *buf,
                                 register __d0 int id,
                                 register __a2 LONG *args)
{
   Errorf("SM_SaveTrue");
   ReturnError(ERR_UserCancel, FALSE);
}

/*************************************************************************
 * SM_SaveMapped()
 *
 * Save out a rendered image in the format that this saver saves in.
 *
 * The MappedImage structure is defined in scan/loadsave.h.
 */

BOOL __saveds __asm SM_SaveMapped (register __a0 char *fname,
                                   register __a1 struct MappedImage *img,
                                   register __d0 int id,
                                   register __a2 LONG *args)
{
   Errorf("SM_SaveMapped");
   ReturnError(ERR_UserCancel, FALSE);
}


/**************************************************************************
 * SM_SavePalette()
 *
 * Save just a palette in the format that this module saves in.  Currently
 * ImageFX never saves a palette in anything but ILBM, but one never
 * knows.
 *
 * The Palette structure is defined in scan/loadsave.h.
 */

BOOL __saveds __asm SM_SavePalette (register __a0 char *fname,
                                    register __a1 struct Palette *palette,
                                    register __d0 int id)
{
   return(FALSE);
}

/*
 * This array is passed back to Image Scan to tell it what kinds of
 * file formats we can save.  It also tells Image Scan whether or not
 * we can handle True Color Buffers, Rendered Images, or Palettes, or
 * any combination thereof.  See the include file scan/loadsave.h for
 * details about the SaveFormat structure and its arguments.
 */

static
struct SaveFormat saveformats[] = {
   { "Skeleton", SAV_TRUE | SAV_MAPPED,   0 },
   { NULL }
};

/************************************************************************
 * SM_Signatures()
 *
 * Tell Image Scan what kinds of formats we can save.
 */

struct SaveFormat * __saveds SM_Signatures (void)
{
   return(saveformats);
}


/**********************************************************************\

               Library Functions and Initialization Stuff

\**********************************************************************/


/************************************************************************
 * Function table.  Referenced in "lib.o".
 *
 * The first four entries are the standard library vectors, defined
 * in "lib.o", the remaining entries define functions specific to
 * this module.
 *
 * The table ends with -1.
 *
 */
ULONG FuncTable[] = {
   /* These four MUST be present */
   (ULONG) LibOpen,
   (ULONG) LibClose,
   (ULONG) LibExpunge,
   (ULONG) LibNull,

   (ULONG) 0,                 /* unused */
   (ULONG) SM_SaveTrue,
   (ULONG) SM_SaveMapped,
   (ULONG) SM_SavePalette,
   (ULONG) SM_Signatures,

   /* End with -1L */
   (ULONG) -1L
};

/************************************************************************
 * ID string for this module.  References in "lib.o".
 *
 * Should be given in the standard 2.0 version string style.
 */
UBYTE LibraryID[]    = "$VER: Skeleton 1.03.00 (12.11.92)";

/************************************************************************
 * Type of module.  Referenced in "lib.o".
 *
 * Should be one of the NT_* defines in <scan/mod.h>
 *
 */
UBYTE LibraryType    = NT_SAVER;

/************************************************************************
 * Module initialization code.  Referenced by "lib.o".
 *
 * This is where you would initialize the ModuleBase structure that
 * is passed to you.
 *
 * Returns TRUE if all went well, or FALSE if something went wrong and
 * the module open should fail.
 *
 */
LONG __saveds __stdargs UserOpen (struct ModuleBase *modbase)
{
   return(TRUE);
}

/************************************************************************
 * Module cleanup code.  Referenced by "lib.o".
 *
 * This should cleanup anything you allocated or opened in UserOpen()
 * above.
 *
 * Always return TRUE.
 *
 */
LONG __saveds __stdargs UserClose (struct ModuleBase *modbase)
{
   return(TRUE);
}

