/*-------------------------------------------------------------------------
 * Name:   egci.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 EGCI_H
#define EGCI_H

#include "gcidefs.h"
#include <stdio.h>

/*-------------------------------------------------------------------------
 * EGCI functions
 *
 * These function are additions to the GCI interface (gci.h). 
 * The function have been added as they became necessary for some specific 
 * problems.
 *
 * Telelogic will strive to keep these functions unchanged.
 *
 */

Bool EGciGetAnyValue(GciValue *value);
Bool EGciGetAnyOrOmit(GciValue *value);
Bool EGciGetIfPresent(GciValue *value);
Bool EGciGetDefault(GciValue *value);


/* Set the value as omitted. */
GciStatus    EGciSetOMIT(GciValue *value);

/* Explicitly set the value as not omitted. */
GciStatus    EGciResetOMIT(GciValue *value);

/* Sets the value of the object. */
GciStatus    EGciSetBOOLEAN(GciValue *value, Bool v);
GciStatus    EGciSetSTRING(GciValue *value, const char *);
GciStatus    EGciSetINTEGER(GciValue *value, int number);
GciStatus    EGciSetNULL(GciValue *value);
GciValue   * EGciSetENUMERATEDByName(GciValue*, const char*);

/* Get the C representation of a GciValue. */
const char * EGciGetENUMERATEDName(GciValue *value);

/* Get the value of the choice. */
GciValue *   EGciGetChoiceMemberByName(GciValue *value, const char *name);
GciValue *   EGciGetChoiceMemberByTag(GciValue *value, GciTagClass tag_class, int tag);

/* Set the SEQUENCE/SET as empty. */
GciStatus    EGciSetEmptySET_OF(GciValue *value);
GciStatus    EGciSetEmptySEQUENCE_OF(GciValue *value);

/* Creates a value of the contained type of the SEQUENCE OF. */
GciValue *   EGciGetSEQUENCE_OFElement(GciValue *value);
/* Creates a value of the contained type of the SET OF. */
GciValue *   EGciGetSET_OFElement(GciValue *value);


/* Create value from the type identifier Gc<typename>D. */
GciValue *   EGciMkValue(int);

/* Create value from the type name. */
GciValue *   EGciMkValueFromTypeName(const char* tname);

/* Delete a created value. */
void         EGciRmValue(GciValue *value);

/* Assign one value ot another. */
GciStatus    EGciAssign(GciValue *lvalue, GciValue *rvalue);

/* Set the value of member named "name" in value 'val' to value 'mem_val' of the 
   SEQUENCE, SET or CHOICE object. */
GciStatus    EGciSetMemberByName(GciValue *val, const char* name, GciValue *mem_val);

/* Get the value of a member named "name" */
GciValue *   EGciGetFieldByName(GciValue *val, const char* name);


/* Textual printout of a value to the stream f.

 * The prefix string is written before the value is printed.
 * The suffix string is written after the value is printed.
 * Any of prefix and suffix can be NULL.
 */
void         EGciDumpValue(FILE* f, const char* prefix, GciValue* value, const char* suffix);


/* Sets the debug output stream to the given stream. */
void         EGciSetDebugStream(FILE* stream);

/* Error handling  */

unsigned int    EGciGetErrorCount();
const char*     EGciGetLastErrorMessage(void);
void            EGciClearError();

#endif
