/*-------------------------------------------------------------------------
 * Name:   gcidefs.h
 * Author: ITEX C-Code Generator
 *
 * Copyright 1999-2000 Telelogic AB, All rights reserved.
 * 
 * This Program is owned by Telelogic and is protected by national
 * copyright laws and international copyright treaties. Telelogic
 * grants you the right to use this Program on one computer or in one
 * local computer network at any one time.  Under this License you may
 * only modify the source code for the purpose of adapting it to your
 * environment. You must reproduce and include any copyright and
 * trademark notices on all copies of the source code.  You may not
 * use, copy, merge, modify or transfer the Program except as provided
 * in this License.  Telelogic does not warrant that the Program will
 * meet your requirements or that the operation of the Program will be
 * uninterrupted and error free. You are solely responsible that the
 * selection of the Program and the modification of the source code
 * will achieve your intended results and that the results are
 * actually obtained.
 */
#ifndef GCIDEFS_H
#define GCIDEFS_H

/*-------------------------------------------------------------------------
 * The log event types for GciLog.
 * 
 * This enum must be defined *before* the inclusion of "static.h".
 */

enum GciLogValues
{
  GciLogStartTC = 100,
  GciLogStopTC  = 101,
  GciLogStartDEF= 102,
  GciLogStopDEF = 103,
  GciLogVerdict = 104,
  GciLogPVerdict= 105,
  GciLogMatch   = 106,
  GciLogNOMatch = 107,
  GciLogSendE   = 108,
  GciLogRecE    = 109,
  GciLogOtherE  = 110,
  GciLogTimeoutE= 111,
  GciLogAssign  = 112,
  GciLogStartT  = 113,
  GciLogStopT   = 114,
  GciLogCancelT = 115,
  GciLogReadT   = 116,
  GciLogAttach  = 117,
  GciLogImplSend= 118,
  GciLogGoto    = 119,
  GciLogRec     = 120,
  GciLogTimeout = 121,
  GciLogError   = 122,
  GciLogCreate  = 123,
  GciLogDone    = 124,
  GciLogActivate= 125,
  GciLogMessage = 126,
  GciLogMatchFailed = 127
};

typedef enum GciLogValues GciLogValues;

/* NOTE: These values was used in the code generator 4.0 (and older). They 
   were used in calling the GciLog function. They are obsolete as of 4.1 and only
   defined here for backward adaptor compiling compliance.
*/
#define IcLogMatchValue    0 
#define IcLogNoMatchValue  1
#define IcLogMessage       2

/*-------------------------------------------------------------------------
 *	Concurrent TTCN
 */
enum GciTCType {
  GciTCError = -1,
  GciMTC = 0,
  GciPTC = 1
};

typedef struct VcValue GciValue;
typedef enum GciTCType GciTCType;
typedef char* GciTCList;
typedef char* GciTGList;

/*-------------------------------------------------------------------------
  @struct Component data. Used in a configuration to list all components included
          in a configuration, Each component has a name, an id (descriptor in the gci
          interface) and two lists of used pcos and cps that the component uses.
*/
struct GciComponent {
  char *name;         /*@field Name of the component */
  int  id;            /*@field Id (descriptor) of the component unique for each component */
  int  type;          /*@field type of the component or rather role. GciMTC or GciPTC */
  char **usedPCOs;    /*@field a list of all used pco names. Last entry is always null */
  int  *usedPCOIds;   /*@field a list of all used pco identifiers. Last entry is always -1 */
  char **usedCPs;     /*@field a list of all used cp names. Last entry is always null */
  int  *usedCPIds;    /*@field a list of all used cp identifiers. Last entry is always -1 */
};

typedef struct GciComponent GciComponent;
typedef GciComponent *GciConf;

/**************************************************************************
  Type declarations
***************************************************************************/

/* USED BY THE ACM PACKAGE */
typedef int GciPCOID;
typedef long GciTimerID;
typedef void *GciPosition;
typedef enum {GCIRUNNING, GCISTOPPED, GCIEXPIRED} GciTimerStatus;

/*-------------------------------------------------------------------------
  @enum Status flag. This type is used in most of our internal functions
        as a return value if the function call was successful or a failure
*/
typedef enum 
{
GciNotOk  = 0,  /*@emem Failure status */
GciOk     = 1   /*@emem Success status */
} GciStatus;

/*-------------------------------------------------------------------------
   @enum Bool type we define this because all compiler does not have a builtin type for
         boolean
*/
typedef enum
{
  GcFALSE = 0, /* @emem GcFALSE */
  GcTRUE  = 1  /* @emem GcTRUE  */
} Bool;


/* ------------------------------------------------------------------------
  @enum The different verdict values 
*/
typedef enum {
  GciFail       = 0,  /* @emem Failure indication */
  GciInConc     = 1,  /* @emem Inconclusive */
  GciPass       = 2,  /* @emem Pass verdict */
  GciNone       = 3,  /* @emem No verdict */
  GciR          = 4   /* @emem Verdict contained in R variable. */
} GciVerdict;

/*-------------------------------------------------------------------------
  @enum Timer units | Internal units for the VcTimer value.
 */
typedef enum 
{ 
  Gcips = 0,   /* @emem Picoseconds. */
  Gcins = 1,   /* @emem Nanoseconds. */
  Gcius = 2,   /* @emem Microseconds. */
  Gcims = 3,   /* @emem Milliseconds. */
  Gcis  = 4,   /* @emem Seconds. */
  Gcimin = 5   /* @emem Minutes. */
} VcTimerUnits;

typedef VcTimerUnits GciTimeUnit;

/*-------------------------------------------------------------------------
 @enum GciTagClass, Tag Classes. 
*/
typedef enum 
{
  GcUNIVERSAL     = 1,      /* @emem GcUNIVERSAL */
  GcAPPLICATION   = 2,      /* @emem GcAPPLICATION */
  GcCONTEXT       = 3,      /* @emem GcCONTEXT */
  GcPRIVATE       = 4       /* @emem GcPRIVATE */
} GciTagClass;

/*-------------------------------------------------------------------------
  @enum Error id. All error messages has a type. This are all the different types 
*/
typedef enum {
  gci_no_error = 0,
  gci_failed_to_get_member_count,     /*@emem Failed to get number of members of structured value */
  gci_restriction_blocked_assignment, /*@emem The object's restriction doesn't permit this assignment. */
  gci_failed_to_access_member,        /*@emem Failed to get a child value to a structured value. */
  gci_failed_to_set_name,             /*@emem Failed to name value. */
  gci_failed_to_get_type,             /*@emem Failed to get type of value. */
  gci_illegal_type,                   /*@emem The object is of the wrong type. */
  gci_value_not_defined,              /*@emem The value is not defined. */
  gci_illegal_size,                   /*@emem Illegal size specified to function. */
  gci_negative_input,                 /*@emem Negative parameter to the function (not allowed) */
  gci_NULL_input,                     /*@emem The input to the function was NULL (not allowed) */
  gci_out_of_bounds,                  /*@emem The position value was out of bounds. */
  gci_member_not_found,               /*@emem The requested member does not exist in the structured type. */
  gci_object_not_found,               /*@emem The requested object could not be found. */
  gci_failed_to_allocate_memory,      /*@emem Malloc error */
  gci_not_a_member,                   /*@emem Object is not a member of the structured type. */
  gci_no_restriction,                 /*@emem This is not a restriction. */
  gci_wrong_restriction,              /*@emem The restriction is of the wrong type. */
  gci_member_has_wrong_type,          /*@emem The member is of the wrong type for the parent. */
  gci_choice_already_instantiated,    /*@emem The CHOICE object is already instantiated to a defined value. */
  gci_no_assignment_function,         /*@emem The assignment function for this value is undefined. */
  gci_no_copy_function,               /*@emem The copy function for this value is undefined. */
  gci_no_restriction_function,        /*@emem The restriction function for this value is undefined. */
  gci_tag_not_found,                  /*@emem The requested tag is not declared. */
  gci_overflow,                       /*@emem The calculation resulted in overflow. */
  gci_illegal_named_number,           /*@emem Named number is not a member of the type */
  gci_illegal_named_bit,              /*@emem Named bit is not a member of the type */
  gci_no_context,                     /*@emem No runtime context is active. */
  gci_failed_to_create_context,       /*@emem Failed to create runtime context. */
  gci_illegal_verdict,                /*@emem An illegal verdict was set (PASS after FAIL for instance) */
  gci_not_implemented,                /*@emem The called GCI function is not implemented. */
  gci_different_memory_types,         /*@emem The pointer are allocated with different memory stragegies */
  gci_line_number_error,              /*@emem Illegal line number detected when executing test case or step */
  gci_type_not_supported,             /*@emem The type is not supported */
  gci_err_msg_only
} EGciErrorNumber;

#ifdef ERROR
#undef ERROR
#endif

typedef enum 
{   ERROR, 
    MATCH, 
    NOMATCH, 
    VERDICT, 
    RETURN
} GciTestResult;

#endif
