/*
 * Header file for GCC UPC GASP events.
 *
 * (YOUR COPYRIGHT HERE)
 */
#ifndef _GASP_UPC_H
#define _GASP_UPC_H

/*
 * These typedefs are used to pass language-level constructs like
 * shared pointers to the tools so they can be used in upcall code.
 */
typedef void gasp_upc_PTS_t; /* (shared void *) */
typedef void gasp_upc_lock_t; /* (upc_lock_t) */

/*
 * If your implementation supports NB memory accesses (spec section
 * 5.4.6), change this as appropriate.
 */
#define GASP_UPC_NB_TRIVIAL    ((gasp_upc_nb_handle_t)0)
typedef void *gasp_upc_nb_handle_t;

/*
 * Define this macro to an integer value which is incremented when new
 * implementation-specific events are added to this file.  See the GASP spec
 * section 5.5 for more details.
 */
#define GASP_UPC_VERSION       010203

/*
 * Per the GASP spec section 5.3, these macros must be defined and system-
 * specific events must not fall between these ranges.  This is done so a
 * tool can distinguish between events created with gasp_create_event and
 * system events.  Note that any system-defined events must not have
 * event tags that fall in the range below.
 */
#define GASP_UPC_USEREVT_START 1000
#define GASP_UPC_USEREVT_END   9999

/*
 * The rest of this file should define symbols for each UPC GASP event
 * that is supported by your implementation.  As an example, the event
 * set below tells tool developers that they should expect events for
 * upc_notify, upc_wait, upc_barrier, and any implicit puts and gets.
 * Note that the presence of an event definition in this file does not
 * mean that tools can always expect to receive events of that type.
 * See spec section 5.5 for more details.
 */

#define _GASP_UPC_SYSEVT_START 10000

/* language ops */
#define GASP_UPC_NOTIFY               _GASP_UPC_SYSEVT_START+100
#define GASP_UPC_WAIT                 _GASP_UPC_SYSEVT_START+101
#define GASP_UPC_BARRIER              _GASP_UPC_SYSEVT_START+102

#define GASP_UPC_PUT                  _GASP_UPC_SYSEVT_START+110
#define GASP_UPC_GET                  _GASP_UPC_SYSEVT_START+111

/* atomic events issued by runtime on shutdown */
#define GASP_UPC_COLLECTIVE_EXIT      _GASP_UPC_SYSEVT_START+210
#define GASP_UPC_NONCOLLECTIVE_EXIT   _GASP_UPC_SYSEVT_START+211

/*
 * Finally, any implementation-specific events that are available in
 * your GASP implementation should be defined and briefly documented
 * in this file.  This allows tool developers to take advantage of
 * any platform-specific interesting events that are relevant to your
 * GAS language implementation.  An example imlementation-specific
 * event is shown below; feel free to add any events that might be
 * of interest to tools.
 */

/*
 * Example implementation-specific event for a fictituous UPC
 * implementation named FOO UPC: static initialization of shared array
 * data.  In FOO UPC static definitions of shared arrays like
 *
 *   shared int x[100][200];
 *
 * will generate a GASP_FOOUPC_STATICSHARED event immeidately upon
 * startup after gasp_init has been called.  The vararg arguments
 * for this event are as follows:
 *
 *  - const char *name: name of shared array
 *  - const char *type: type of shared array elements
 *  - size_t elem_size: element size, in bytes
 *  - ...
 *
 * etc.
 */
#define GASP_FOOUPC_STATICSHARED      _GASP_UPC_SYSEVT_START+10000

#endif

