/**
 * FUNCTION
 *   A generic PDB function.  Search for ___ to find the places that
 *   need to be changed.
 *
 *   Copyright (c) 2013 Samuel A. Rebelsky.  All rights reserved.
 *
 *   This file is part of The Glimmer Guide to GIMP Plugins (aka GGGP).
 *
 *   GGGP is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   GGGP is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with GGGP.  If not, see <http://www.gnu.org/licenses/>.
 */


// +---------+---------------------------------------------------------
// | Headers |
// +---------+

#include <libgimp/gimp.h>
#include <glib.h>

#include <stdio.h>


// +--------------------------+----------------------------------------
// | Function Predeclarations |
// +--------------------------+

static void query (void);
static void run (const gchar *name,
                 gint nparams,
                 const GimpParam *params,
                 gint *nreturn_vals,
                 GimpParam **return_vals);


// +-------------+-----------------------------------------------------
// | Boilerplate |
// +-------------+

/**
 * The four key functions.  This structure *must* be called PLUG_IN_INFO.
 */
GimpPlugInInfo PLUG_IN_INFO =
  {
    NULL,
    NULL,
    query,
    run
  };

/**
 * Indicate that we're ready to begin the main part of the code.
 */
MAIN ()


// +-------------------------+-----------------------------------------
// | Standard GIMP Functions |
// +-------------------------+

static void 
query (void)
{
  // Build the description of the parameters that the function expects.  
  // Each parameter has a type, a name, and a description
  // All plug-ins must take a run-mode.  
  static GimpParamDef args[] =
    {
      ___
    }; // args

  static GimpParamDef results[] =
    {
      ___
      ___
    }; // results

  // Tell the GIMP about our plugin.
  gimp_install_procedure (
    "gggp/___",                                         // Name
    "___",                                              // Blurb
    "___",                                              // Help
    "Samuel A. Rebelsky",                               // Author
    "Copyright (c) Samuel A. Rebelsky.  All rights reserved.",
                                                        // Copyright
    "2013",                                             // Year
    "",                                                 // Path
    NULL,                                               // Image types
    GIMP_PLUGIN,                                        // Type
    ___,                                                // Number of params
    ___,                                                // Number of return vals
    args,                                               // Param descriptions
    results                                             // Return descriptions
    );
} // query

static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *params,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  // Set up return values
  static GimpParam results[___];
  results[0].type = GIMP_PDB_STATUS;
  results[0].data.d_status = GIMP_PDB_SUCCESS;
  *nreturn_vals = ___;
  *return_vals = results;

  // Extract parameters
  ___

  // Do some computation
  ___

  // Fill in the results
  ____
} // run

