  21.1.3.  Creating New Synaptic Objects

  We anticipate that many GENESIS users will want to write variants of
  the synchan and hebbsynchan objects to handle different kinds of
  synaptically-mediated behavior.  Currently, this means that one has to
  write a C function defining the object, usually in a user library.
  See ``Customizing GENESIS'' (Customizing.txt) and ``Defining New
  Objects and Commands'' (NewObjects.txt) for more information on this.
  In general, one should start by copying an existing object that is as
  close to the desired object as possible and then modifying it.  These
  modifications may involve adding new fields or deleting old ones.  In
  order to guarantee that the existing genesis commands for setting up
  synaptic connections work properly with the new objects (e.g.
  planarconnect, volumeconnect, planar/volumeweight, planar/volumedelay,
  etc.) we ask that aspiring synchan hackers obey the following
  guidelines:

  1. The structure definition for the new object should be of the
     following form:

         struct MyWeirdSynchan_type
         {
             SYNCHAN_TYPE
             /* use Synapse_type if using normal synapses */
             struct MyWeirdSynapse_type *synapse;
             /* ... put extra fields here if needed ... */
         };

  2. Some new kinds of synchans will have their own kinds of synapses
     with extra fields not found in the standard synapses.  The way to
     define these is as follows:

         struct MyWeirdSynapse_type
         {
           SYNAPSE_TYPE
           /* ... put extra fields here if needed ... */
         };

         typedef struct MyWeirdSynapse_type MyWeirdSynapse;

  An example of both (1) and (2) is in ``src/newconn/newconn_struct.h'',
  with the definition of HebbSynchan_type and HebbSynapse_type.  If your
  synapses are the same as previously-defined ones, then this step isn't
  necessary.

  3. You must have code like this in the CREATE action of your synchan
     type:

         ...
           SELECT_ACTION(action)
             {
             case CREATE:
               channel->synapse_size = (unsigned short) (sizeof(MyWeirdSynapse));
               channel->synapse = NULL;  /* no synapses to start with */

               break;
         ...

  Note that all you have to do is change the word ``Synapse'' in syn-
  chan.c to ``MyWeirdSynapse''.

  4. In your ``<library_name>_ext.h'' file (see ``Customizing GENESIS''
     (Customizing.txt) ) you must include (at least) the following:

         #include "newconn_struct.h"
         #include "synaptic_event.h"

         extern void RemovePendingSynapticEvents();

         /* and for hebbsynchan derivatives: */

         #include "seg_struct.h"  /* for compartment definition */

  If all this is done, and your code is correct, the new objects should
  work with the existing connection and weight/delay-setting functions
  in the same way as synchan and hebbsynchan do.
